Skip to content

Commit

Permalink
Upgrade egui/eframe/egui_extras (0.30) and egui-probe (0.7.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
xangelix committed Dec 18, 2024
1 parent 846cc83 commit 207e7d2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ categories = ["gui", "visualization"]
serde = ["dep:serde", "egui/serde", "slab/serde"]

[dependencies]
egui = { version = "0.29" }
egui = { version = "0.30" }
slab = { version = "0.4" }
serde = { version = "1.0", features = ["derive"], optional = true }

egui-probe = { version = "0.6.0", features = ["derive"], optional = true }
egui-probe = { version = "0.7.0", features = ["derive"], optional = true }

[dev-dependencies]
eframe = { version = "0.29", features = ["serde", "persistence"] }
egui_extras = { version = "0.29", features = ["all_loaders"] }
eframe = { version = "0.30", features = ["serde", "persistence"] }
egui_extras = { version = "0.30", features = ["all_loaders"] }
syn = { version = "2.0", features = ["extra-traits"] }
serde_json = { version = "1.0" }

Expand Down
8 changes: 4 additions & 4 deletions demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ name = "demo"
path = "../examples/demo.rs"

[dependencies]
egui = { version = "0.29" }
egui-probe = { version = "0.6", features = ["derive"] }
eframe = { version = "0.29", features = ["serde", "persistence"] }
egui_extras = { version = "0.29", features = ["all_loaders"] }
egui = { version = "0.30" }
egui-probe = { version = "0.7", features = ["derive"] }
eframe = { version = "0.30", features = ["serde", "persistence"] }
egui_extras = { version = "0.30", features = ["all_loaders"] }
syn = { version = "2.0", features = ["extra-traits"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
Expand Down
13 changes: 8 additions & 5 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl SnarlStyle {
fn get_pin_size(&self, scale: f32, style: &Style) -> f32 {
self.pin_size
.zoomed(scale)
.unwrap_or_else(|| style.spacing.interact_size.y * 0.6)
.unwrap_or(style.spacing.interact_size.y * 0.6)
}

fn get_pin_fill(&self, style: &Style) -> Color32 {
Expand All @@ -372,11 +372,11 @@ impl SnarlStyle {
}

fn get_pin_shape(&self) -> PinShape {
self.pin_shape.unwrap_or(PinShape::Circle).into()
self.pin_shape.unwrap_or(PinShape::Circle)
}

fn get_pin_placement(&self) -> PinPlacement {
self.pin_placement.unwrap_or(PinPlacement::default())
self.pin_placement.unwrap_or_default()
}

fn get_wire_width(&self, scale: f32, style: &Style) -> f32 {
Expand Down Expand Up @@ -1089,6 +1089,7 @@ impl<T> Snarl<T> {
});
}

#[allow(clippy::too_many_arguments)]
fn draw_inputs<V>(
&mut self,
viewer: &mut V,
Expand Down Expand Up @@ -1239,6 +1240,7 @@ impl<T> Snarl<T> {
}
}

#[allow(clippy::too_many_arguments)]
fn draw_outputs<V>(
&mut self,
viewer: &mut V,
Expand Down Expand Up @@ -1388,6 +1390,7 @@ impl<T> Snarl<T> {
}
}

#[allow(clippy::too_many_arguments)]
fn draw_body<V>(
&mut self,
viewer: &mut V,
Expand All @@ -1413,8 +1416,8 @@ impl<T> Snarl<T> {

viewer.show_body(
node,
&inputs,
&outputs,
inputs,
outputs,
&mut body_ui,
snarl_state.scale(),
self,
Expand Down
4 changes: 1 addition & 3 deletions src/ui/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,7 @@ impl SnarlStateData {

fn load(cx: &Context, id: Id) -> Option<Self> {
cx.data(|d| {
let Some(small) = d.get_temp::<SnarlStateDataHeader>(id) else {
return None;
};
let small = d.get_temp::<SnarlStateDataHeader>(id)?;
let new_wires = d.get_temp(id);
let rect_selection = d.get_temp(id);

Expand Down
7 changes: 4 additions & 3 deletions src/ui/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ pub trait SnarlViewer<T> {
/// By default it draws a pin with the shape and style returned by [`SnarlViewer::show_input`].
///
/// If you want to draw the pin yourself, you can override this method.
#[allow(clippy::too_many_arguments)]
fn draw_input_pin(
&mut self,
pin: &InPin,
Expand All @@ -317,6 +318,7 @@ pub trait SnarlViewer<T> {
/// By default it draws a pin with the shape and style returned by [`SnarlViewer::show_output`].
///
/// If you want to draw the pin yourself, you can override this method.
#[allow(clippy::too_many_arguments)]
fn draw_output_pin(
&mut self,
pin: &OutPin,
Expand Down Expand Up @@ -350,9 +352,8 @@ pub trait SnarlViewer<T> {
) {
let _ = snarl;

match background {
Some(background) => background.draw(viewport, snarl_style, style, painter),
None => {}
if let Some(background) = background {
background.draw(viewport, snarl_style, style, painter)
}
}
}

0 comments on commit 207e7d2

Please sign in to comment.