Skip to content

Commit

Permalink
utilize ui.add instead of ui method
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Nov 28, 2023
1 parent acd8a96 commit 51c70ac
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
2 changes: 1 addition & 1 deletion rgis-ui/src/debug_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl<'w, 's> egui::Widget for DebugWindow<'w, 's> {
.collect::<Vec<_>>();

ui.vertical(|ui| {
DebugTable { last: &self.last }.ui(ui);
ui.add(DebugTable { last: &self.last });

use egui_plot::{Line, Plot, PlotPoints};
let line = Line::new(PlotPoints::Owned(sin));
Expand Down
37 changes: 14 additions & 23 deletions rgis-ui/src/side_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ impl<'a, 'w> SidePanel<'a, 'w> {
ui.vertical_centered_justified(|ui| {
egui::ScrollArea::vertical().show(ui, |ui| {
self.render_layers_heading(ui);
(AddLayerButton {
ui.add(AddLayerButton {
events: self.events,
})
.ui(ui);
});
self.render_layers(ui);
});
});
Expand All @@ -57,13 +56,12 @@ impl<'a, 'w> SidePanel<'a, 'w> {

fn render_layers(&mut self, ui: &mut egui::Ui) {
for (i, layer) in self.layers.iter_top_to_bottom().enumerate() {
Layer {
ui.add(Layer {
is_move_down_enabled: i < self.layers.count() - 1,
is_move_up_enabled: i > 0,
layer,
events: self.events,
}
.ui(ui);
});
ui.separator();
}
}
Expand Down Expand Up @@ -263,29 +261,22 @@ impl<'a, 'w> Widget for Layer<'a, 'w> {
}
}

OperationButton::<rgis_geo_ops::ConvexHull>::new(
ui.add(OperationButton::<rgis_geo_ops::ConvexHull>::new(
self.events,
layer,
)
.ui(ui);
OperationButton::<rgis_geo_ops::Outliers>::new(self.events, layer)
.ui(ui);
OperationButton::<rgis_geo_ops::Rotate>::new(self.events, layer)
.ui(ui);
OperationButton::<rgis_geo_ops::Simplify>::new(self.events, layer)
.ui(ui);
OperationButton::<rgis_geo_ops::Smoothing>::new(self.events, layer)
.ui(ui);
OperationButton::<rgis_geo_ops::Triangulate>::new(
));
ui.add(OperationButton::<rgis_geo_ops::Outliers>::new(self.events, layer));
ui.add(OperationButton::<rgis_geo_ops::Rotate>::new(self.events, layer));
ui.add(OperationButton::<rgis_geo_ops::Simplify>::new(self.events, layer));
ui.add(OperationButton::<rgis_geo_ops::Smoothing>::new(self.events, layer));
ui.add(OperationButton::<rgis_geo_ops::Triangulate>::new(
self.events,
layer,
)
.ui(ui);
OperationButton::<rgis_geo_ops::UnsignedArea>::new(
));
ui.add(OperationButton::<rgis_geo_ops::UnsignedArea>::new(
self.events,
layer,
)
.ui(ui);
));
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion rgis-ui/src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ fn render_window<W: Window + 'static>(
.open(&mut is_window_open.0)
.resizable(false)
.show(egui_ctx.get_mut(), |ui| {
window.ui(ui);
ui.add(window);
});
}
}

0 comments on commit 51c70ac

Please sign in to comment.