From 5cd1acb78bb619ab130c6e699a186b2461787700 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Sat, 14 Dec 2024 15:31:28 +0100 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=94=A7=20trunk:=20watch=20"examples"?= =?UTF-8?q?=20directory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Trunk.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Trunk.toml b/Trunk.toml index fb27cad..a9bf3ea 100644 --- a/Trunk.toml +++ b/Trunk.toml @@ -1,2 +1,5 @@ [build] target = "demo/index.html" + +[watch] +watch = ["demo", "examples"] From 5cb7ec80ad7cc34fa4fe76aacaef818dd86d8216 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Sat, 14 Dec 2024 15:37:48 +0100 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=94=A7=20trunk:=20watch=20"nodui"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Trunk.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Trunk.toml b/Trunk.toml index a9bf3ea..aa2f8ac 100644 --- a/Trunk.toml +++ b/Trunk.toml @@ -2,4 +2,4 @@ target = "demo/index.html" [watch] -watch = ["demo", "examples"] +watch = ["demo", "examples", "nodui"] From e015cc847a6f3c452248c19191c7ab72e1df6807 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Sat, 14 Dec 2024 15:38:53 +0100 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=92=84=20in=20progress=20connection?= =?UTF-8?q?=20is=20now=20renderer=20on=20tooltip=20layer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nodui/src/editor/connections.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nodui/src/editor/connections.rs b/nodui/src/editor/connections.rs index 813db3f..8a5e761 100644 --- a/nodui/src/editor/connections.rs +++ b/nodui/src/editor/connections.rs @@ -1,6 +1,6 @@ //! Rendering of connections. -use egui::{epaint::PathStroke, Color32, Shape}; +use egui::{epaint::PathStroke, Color32, LayerId, Shape}; use crate::ConnectionInProgress; @@ -34,7 +34,7 @@ impl GraphEditor> { crate::socket::SocketInteraction::InProgress(in_progress) => (None, Some(in_progress)), }; - let layer_id = egui::LayerId::new(egui::Order::Background, id); + let layer_id = LayerId::new(egui::Order::Background, id); let mut painter = ui.painter().clone(); painter.set_layer_id(layer_id); @@ -108,7 +108,12 @@ where show: impl FnOnce(&egui::Painter, ConnectionInProgress), ) { if let Some(connection) = self.connection.take() { - show(&self.painter, connection); + let mut top_most_painter = self.painter.clone(); + top_most_painter.set_layer_id(LayerId::new( + egui::Order::Tooltip, + self.painter.layer_id().id, + )); + show(&top_most_painter, connection); } } From 9572b0c793eb4c14972b9d1a5277e348f8aa95d7 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Sat, 14 Dec 2024 15:42:38 +0100 Subject: [PATCH 4/4] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20ConnectionUI:=20relax?= =?UTF-8?q?=20constraint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nodui/src/editor/connections.rs | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/nodui/src/editor/connections.rs b/nodui/src/editor/connections.rs index 8a5e761..3b9bbdd 100644 --- a/nodui/src/editor/connections.rs +++ b/nodui/src/editor/connections.rs @@ -45,22 +45,18 @@ impl GraphEditor> { connection: in_progress, }; build_fn(&mut connections_ui); + + // If user didn't render the in progress connection, we do it for them. + connections_ui + .in_progress_connection_line(egui::Stroke::new(5.0, connections_ui.preferred_color())); + let ConnectionsUi { - preferred_color, - painter, + preferred_color: _, + painter: _, sockets, - connection: in_progress, + connection: _, } = connections_ui; - if let Some(connection) = in_progress { - // The user didn't render the in progress connection, so we do it for them. - - painter.add(Shape::LineSegment { - points: [connection.source.pos(), connection.pointer_pos], - stroke: egui::Stroke::new(5.0, preferred_color).into(), - }); - } - let position = viewport.grid.canvas_to_graph(state.viewport_position); state.store(ui.ctx(), id); @@ -97,10 +93,7 @@ impl ConnectionsUi { } } -impl ConnectionsUi -where - S: PartialEq, -{ +impl ConnectionsUi { /// Render the connection the user is currently doing. #[inline] pub fn in_progress_connection(