Skip to content

Commit

Permalink
Merge pull request #41 from xangelix/egui-0.29
Browse files Browse the repository at this point in the history
Update egui to 0.29
  • Loading branch information
zakarumych authored Oct 14, 2024
2 parents e6be075 + d66eb1e commit 08f12b3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 40 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
workspace = { members = ["demo"] }
[package]
name = "egui-snarl"
version = "0.4.4"
version = "0.5.0"
edition = "2021"
description = "Node-graphs for egui"
license = "MIT OR Apache-2.0"
Expand All @@ -15,16 +15,16 @@ categories = ["gui", "visualization"]
serde = ["dep:serde", "egui/serde", "slab/serde"]

[dependencies]
egui = { version = "0.28" }
egui = { version = "0.29" }
slab = { version = "0.4" }
serde = { version = "1.0", features = ["derive"], optional = true }
tiny-fn = { version = "0.1.6" }
tiny-fn = { version = "0.1.7" }

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

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

Expand Down
6 changes: 3 additions & 3 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.28" }
egui = { version = "0.29" }
egui-probe = { version = "0.5", features = ["derive"] }
eframe = { version = "0.28", features = ["serde", "persistence"] }
egui_extras = { version = "0.28", features = ["all_loaders"] }
eframe = { version = "0.29", features = ["serde", "persistence"] }
egui_extras = { version = "0.29", features = ["all_loaders"] }
syn = { version = "2.0", features = ["extra-traits"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
Expand Down
63 changes: 32 additions & 31 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use std::{collections::HashMap, hash::Hash};

use egui::{
collapsing_header::paint_default_icon, epaint::Shadow, pos2, vec2, Align, Color32, Frame, Id,
Layout, Margin, Modifiers, PointerButton, Pos2, Rect, Rounding, Sense, Shape, Stroke, Ui, Vec2,
Layout, Margin, Modifiers, PointerButton, Pos2, Rect, Rounding, Sense, Shape, Stroke, Ui,
UiBuilder, Vec2,
};

use crate::{InPin, InPinId, Node, NodeId, OutPin, OutPinId, Snarl};
Expand Down Expand Up @@ -1099,11 +1100,11 @@ impl<T> Snarl<T> {
return None;
}

let node_ui = &mut ui.child_ui_with_id_source(
node_frame_rect,
Layout::top_down(Align::Center),
node_id,
None,
let node_ui = &mut ui.new_child(
UiBuilder::new()
.max_rect(node_frame_rect)
.layout(Layout::top_down(Align::Center))
.id_salt(node_id),
);

let mut new_pins_size = Vec2::ZERO;
Expand Down Expand Up @@ -1140,11 +1141,11 @@ impl<T> Snarl<T> {
// Show input pins.

// Input pins on the left.
let inputs_ui = &mut ui.child_ui_with_id_source(
payload_rect,
Layout::top_down(Align::Min),
"inputs",
None,
let inputs_ui = &mut ui.new_child(
UiBuilder::new()
.max_rect(payload_rect)
.layout(Layout::top_down(Align::Min))
.id_salt("inputs"),
);

inputs_ui.set_clip_rect(payload_clip_rect.intersect(viewport));
Expand Down Expand Up @@ -1261,11 +1262,11 @@ impl<T> Snarl<T> {

// Outputs are placed under the header and must not go outside of the header frame.

let outputs_ui = &mut ui.child_ui_with_id_source(
payload_rect,
Layout::top_down(Align::Max),
"outputs",
None,
let outputs_ui = &mut ui.new_child(
UiBuilder::new()
.max_rect(payload_rect)
.layout(Layout::top_down(Align::Max))
.id_salt("outputs"),
);

outputs_ui.set_clip_rect(payload_clip_rect.intersect(viewport));
Expand Down Expand Up @@ -1397,11 +1398,11 @@ impl<T> Snarl<T> {
Rect::from_min_max(pos2(body_left, body_top), pos2(body_right, body_bottom));
body_rect = node_state.align_body(body_rect);

let mut body_ui = ui.child_ui_with_id_source(
body_rect,
Layout::left_to_right(Align::Min),
"body",
None,
let mut body_ui = ui.new_child(
UiBuilder::new()
.max_rect(body_rect)
.layout(Layout::left_to_right(Align::Min))
.id_salt("body"),
);
body_ui.set_clip_rect(payload_clip_rect.intersect(viewport));

Expand Down Expand Up @@ -1443,11 +1444,11 @@ impl<T> Snarl<T> {

footer_rect = node_state.align_footer(footer_rect);

let mut footer_ui = ui.child_ui_with_id_source(
footer_rect,
Layout::left_to_right(Align::Min),
"footer",
None,
let mut footer_ui = ui.new_child(
UiBuilder::new()
.max_rect(footer_rect)
.layout(Layout::left_to_right(Align::Min))
.id_salt("footer"),
);
footer_ui.set_clip_rect(payload_clip_rect.intersect(viewport));

Expand Down Expand Up @@ -1480,11 +1481,11 @@ impl<T> Snarl<T> {
let mut header_frame_rect = Rect::NAN; //node_rect + header_frame.total_margin();

// Show node's header
let header_ui: &mut Ui = &mut ui.child_ui_with_id_source(
node_rect + header_frame.total_margin(),
Layout::top_down(Align::Center),
"header",
None,
let header_ui: &mut Ui = &mut ui.new_child(
UiBuilder::new()
.max_rect(node_rect + header_frame.total_margin())
.layout(Layout::top_down(Align::Center))
.id_salt("header"),
);

header_frame.show(header_ui, |ui: &mut Ui| {
Expand Down

0 comments on commit 08f12b3

Please sign in to comment.