-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide Plugin::run()
with an egui:Ui
#197
Comments
Plugin
with an egui:Ui
Plugin::run()
with an egui:Ui
We could try this. In general, I was debating with myself what the Map should actually be in the egui;s terminology. Whether it should be a widget, or maybe some sort of container where one could put widgets.
It's fine, I don't mind making breaking changes at this moment. |
In a sense, this resemble much a Regardless, I wonder if there would be a path to a closure-based API would feel more natural for egui. Something like: fn some_ui(ui: &mut eguiUi) {
walkers::Map::new(tile_manager, map_memory)
.center(centre_position)
.show(ui, |projector| {
// create a Ui whose min pos is at provided coordinates and max_rect accounts for the size of the map widget
projector.ui_at(lat, lon).label("hello");
// or more closure things like
projector.show_at(lat, lon, egui::vec2(width, height), |ui| {
ui.painter().circle(ui.max_rect().center(), ...);
});
});
} Here
|
Plugins are currently only provided with a painter. Although this is sufficient for drawing, it may building interactive element more complicated, in particular tooltips.
My (possibly naive) suggestion would be:
Map::ui()
, allocate a child ui that uses the providedUi
'savailable_size()
.Plugin::run()
, instead of theResponse
andPainter
(both of which can be obtained from theUi
.That would, of course, be a breaking change. If that's a concern, one could add a
Plugin::run_ui()
method which by default delegates to the existingPlugin::run()
without changing its signature.Would you accept such a PR? If so, would be ok with the breaking change or prefer the work-around?
The text was updated successfully, but these errors were encountered: