egui_canvas 0.1.2

A TKinter-like canvas widget for egui.
Documentation
# egui_canvas: a TKinter-like canvas widget for the egui crate.


[![MIT License](https://img.shields.io/gitlab/license/67375734)](https://gitlab.com/urciteniefilipdubina/egui_canvas/-/blob/main/LICENSE)
[![Version](https://img.shields.io/crates/v/egui_canvas)](https://crates.io/crates/egui_canvas)
[![Documentation](https://img.shields.io/docsrs/egui_canvas)](https://docs.rs/egui_canvas)

___

This crate implements a `Canvas` struct, which implements
[egui](https://crates.io/crates/egui)'s `Widget` trait while aiming to be
as similar to TKinter (python) Canvas widget as possible.

In practise, this means it is an global state holder for `egui::Shape`
objects and a click handler closure.

This is a **hobby project** and will not be regularly updated/maintained.

If you find out something is not working / could be made better, open an issue.

Check out [the documentation](https://docs.rs/egui_canvas/) and
[the examples](https://gitlab.com/urciteniefilipdubina/egui_canvas/-/tree/main/examples).

___

# Cargo features


- `click` - enables click handler functionality. Enabled by default.
- `image` - enables image functionality. Not yet implemented.

___

# TODOs


- Tests
- Image support (the feature does nothing yet)
- GitLab pipelines

___

# Known limitations


- For click handler to be able to mutate the canvas object itself
(or an overlying object which owns the canvas object), it needs to have
a mutable pointer to said object moved into it at definition, because
a reference couldn't be guaranteed to live long enough. This makes mutating
(or even accessing) the canvas object from the click handler `unsafe`. For now,
safety is ensured by the fact that dropping the canvas object needs to wait
for a lock on the `Mutex` of the click handler, which is locked if the click
handler is running.
- Shapes need to be wrapped in `std::rc::Rc`.
- Full-sized canvas can't cover the whole window
(`egui::Ui::available_size` doesn't return the whole size of the window)

___

# Dependencies / Companion crates


- This crate needs to be used together with the `eframe` and `egui` crates
(because it only implements a widget)
- You may find it useful to use crate `native-dialog` together with this one