From 1983540a4f269b1112f07e6f5253f62578023129 Mon Sep 17 00:00:00 2001 From: fschutt Date: Sun, 5 Sep 2021 07:45:24 +0200 Subject: [PATCH] Fix nodegraph disconnect function --- api.json | 35 + api/c/azul.h | 5 + api/cpp/azul.hpp | 5 + api/rust/src/lib.rs | 15 + azul-core/src/svg.rs | 55 +- azul-css/src/css_properties.rs | 14 + azul-css/src/lib.rs | 10 +- azul-desktop/src/shell/win32.rs | 29 +- azul-dll/src/lib.rs | 10 + azul-dll/src/python.rs | 20 + azul-dll/src/widgets/node_graph.rs | 1219 ++++++++++++++-------------- examples/rust/nodegraph.rs | 23 +- 12 files changed, 818 insertions(+), 622 deletions(-) diff --git a/api.json b/api.json index 8117f51ed..f0ab9dab8 100644 --- a/api.json +++ b/api.json @@ -11611,6 +11611,13 @@ {"items": {"type": "SvgPathElementVec"}} ], "functions": { + "reverse": { + "doc": "Reverses the order of points in the path so that the path runs in the opposite direction afterwards", + "fn_args": [ + {"self": "refmut"} + ], + "fn_body": "svgpath.reverse()" + }, "tessellate_fill": { "fn_args": [ {"self": "ref"}, @@ -11638,6 +11645,13 @@ {"CubicCurve": {"type": "SvgCubicCurve"}} ], "functions": { + "reverse": { + "doc": "Reverses the order of points in the path so that the path runs in the opposite direction afterwards", + "fn_args": [ + {"self": "refmut"} + ], + "fn_body": "svgpathelement.reverse()" + }, "get_start": { "doc": "Returns the starting point of this item", "fn_args": [ @@ -11766,6 +11780,13 @@ {"end": {"type": "SvgPoint"}} ], "functions": { + "reverse": { + "doc": "Reverses the order of points in the path so that the path runs in the opposite direction afterwards", + "fn_args": [ + {"self": "refmut"} + ], + "fn_body": "svgline.reverse()" + }, "get_start": { "doc": "Returns the starting point of this item", "fn_args": [ @@ -11853,6 +11874,13 @@ {"end": {"type": "SvgPoint"}} ], "functions": { + "reverse": { + "doc": "Reverses the order of points in the curve so that the curve runs in the opposite direction afterwards", + "fn_args": [ + {"self": "refmut"} + ], + "fn_body": "svgquadraticcurve.reverse()" + }, "get_start": { "doc": "Returns the starting point of this item", "fn_args": [ @@ -11941,6 +11969,13 @@ {"end": {"type": "SvgPoint"}} ], "functions": { + "reverse": { + "doc": "Reverses the order of points in the curve so that the curve runs in the opposite direction afterwards", + "fn_args": [ + {"self": "refmut"} + ], + "fn_body": "svgcubiccurve.reverse()" + }, "get_start": { "doc": "Returns the starting point of this item", "fn_args": [ diff --git a/api/c/azul.h b/api/c/azul.h index bc8fa2c45..268eff979 100644 --- a/api/c/azul.h +++ b/api/c/azul.h @@ -12531,9 +12531,11 @@ extern DLLIMPORT AzTessellatedSvgNode AzSvgStyledNode_tessellate(const AzSvgStyl extern DLLIMPORT void AzSvgStyledNode_delete(AzSvgStyledNode* restrict instance); extern DLLIMPORT AzTessellatedSvgNode AzSvgCircle_tessellateFill(const AzSvgCircle* svgcircle, AzSvgFillStyle fill_style); extern DLLIMPORT AzTessellatedSvgNode AzSvgCircle_tessellateStroke(const AzSvgCircle* svgcircle, AzSvgStrokeStyle stroke_style); +extern DLLIMPORT void AzSvgPath_reverse(AzSvgPath* restrict svgpath); extern DLLIMPORT AzTessellatedSvgNode AzSvgPath_tessellateFill(const AzSvgPath* svgpath, AzSvgFillStyle fill_style); extern DLLIMPORT AzTessellatedSvgNode AzSvgPath_tessellateStroke(const AzSvgPath* svgpath, AzSvgStrokeStyle stroke_style); extern DLLIMPORT void AzSvgPath_delete(AzSvgPath* restrict instance); +extern DLLIMPORT void AzSvgPathElement_reverse(AzSvgPathElement* restrict svgpathelement); extern DLLIMPORT AzSvgPoint AzSvgPathElement_getStart(const AzSvgPathElement* svgpathelement); extern DLLIMPORT AzSvgPoint AzSvgPathElement_getEnd(const AzSvgPathElement* svgpathelement); extern DLLIMPORT AzSvgRect AzSvgPathElement_getBounds(const AzSvgPathElement* svgpathelement); @@ -12546,6 +12548,7 @@ extern DLLIMPORT AzTessellatedSvgNode AzSvgPathElement_tessellateStroke(const Az extern DLLIMPORT float AzSvgVector_angleDegrees(const AzSvgVector* svgvector); extern DLLIMPORT AzSvgVector AzSvgVector_normalize(const AzSvgVector* svgvector); extern DLLIMPORT AzSvgVector AzSvgVector_rotate90DegCcw(const AzSvgVector* svgvector); +extern DLLIMPORT void AzSvgLine_reverse(AzSvgLine* restrict svgline); extern DLLIMPORT AzSvgPoint AzSvgLine_getStart(const AzSvgLine* svgline); extern DLLIMPORT AzSvgPoint AzSvgLine_getEnd(const AzSvgLine* svgline); extern DLLIMPORT AzSvgRect AzSvgLine_getBounds(const AzSvgLine* svgline); @@ -12555,6 +12558,7 @@ extern DLLIMPORT float AzSvgLine_getXAtT(const AzSvgLine* svgline, float t); extern DLLIMPORT float AzSvgLine_getYAtT(const AzSvgLine* svgline, float t); extern DLLIMPORT AzSvgVector AzSvgLine_getTangentVectorAtT(const AzSvgLine* svgline, float t); extern DLLIMPORT AzTessellatedSvgNode AzSvgLine_tessellateStroke(const AzSvgLine* svgline, AzSvgStrokeStyle stroke_style); +extern DLLIMPORT void AzSvgQuadraticCurve_reverse(AzSvgQuadraticCurve* restrict svgquadraticcurve); extern DLLIMPORT AzSvgPoint AzSvgQuadraticCurve_getStart(const AzSvgQuadraticCurve* svgquadraticcurve); extern DLLIMPORT AzSvgPoint AzSvgQuadraticCurve_getEnd(const AzSvgQuadraticCurve* svgquadraticcurve); extern DLLIMPORT AzSvgRect AzSvgQuadraticCurve_getBounds(const AzSvgQuadraticCurve* svgquadraticcurve); @@ -12564,6 +12568,7 @@ extern DLLIMPORT float AzSvgQuadraticCurve_getXAtT(const AzSvgQuadraticCurve* sv extern DLLIMPORT float AzSvgQuadraticCurve_getYAtT(const AzSvgQuadraticCurve* svgquadraticcurve, float t); extern DLLIMPORT AzSvgVector AzSvgQuadraticCurve_getTangentVectorAtT(const AzSvgQuadraticCurve* svgquadraticcurve, float t); extern DLLIMPORT AzTessellatedSvgNode AzSvgQuadraticCurve_tessellateStroke(const AzSvgQuadraticCurve* svgquadraticcurve, AzSvgStrokeStyle stroke_style); +extern DLLIMPORT void AzSvgCubicCurve_reverse(AzSvgCubicCurve* restrict svgcubiccurve); extern DLLIMPORT AzSvgPoint AzSvgCubicCurve_getStart(const AzSvgCubicCurve* svgcubiccurve); extern DLLIMPORT AzSvgPoint AzSvgCubicCurve_getEnd(const AzSvgCubicCurve* svgcubiccurve); extern DLLIMPORT AzSvgRect AzSvgCubicCurve_getBounds(const AzSvgCubicCurve* svgcubiccurve); diff --git a/api/cpp/azul.hpp b/api/cpp/azul.hpp index b33e95a6d..2426bbbb4 100644 --- a/api/cpp/azul.hpp +++ b/api/cpp/azul.hpp @@ -10495,9 +10495,11 @@ namespace dll { void SvgStyledNode_delete(SvgStyledNode* restrict instance); TessellatedSvgNode SvgCircle_tessellateFill(const SvgCircle* svgcircle, AzSvgFillStyle fill_style); TessellatedSvgNode SvgCircle_tessellateStroke(const SvgCircle* svgcircle, AzSvgStrokeStyle stroke_style); + void SvgPath_reverse(SvgPath* restrict svgpath); TessellatedSvgNode SvgPath_tessellateFill(const SvgPath* svgpath, AzSvgFillStyle fill_style); TessellatedSvgNode SvgPath_tessellateStroke(const SvgPath* svgpath, AzSvgStrokeStyle stroke_style); void SvgPath_delete(SvgPath* restrict instance); + void SvgPathElement_reverse(SvgPathElement* restrict svgpathelement); SvgPoint SvgPathElement_getStart(const SvgPathElement* svgpathelement); SvgPoint SvgPathElement_getEnd(const SvgPathElement* svgpathelement); SvgRect SvgPathElement_getBounds(const SvgPathElement* svgpathelement); @@ -10510,6 +10512,7 @@ namespace dll { float SvgVector_angleDegrees(const SvgVector* svgvector); SvgVector SvgVector_normalize(const SvgVector* svgvector); SvgVector SvgVector_rotate90DegCcw(const SvgVector* svgvector); + void SvgLine_reverse(SvgLine* restrict svgline); SvgPoint SvgLine_getStart(const SvgLine* svgline); SvgPoint SvgLine_getEnd(const SvgLine* svgline); SvgRect SvgLine_getBounds(const SvgLine* svgline); @@ -10519,6 +10522,7 @@ namespace dll { float SvgLine_getYAtT(const SvgLine* svgline, float t); SvgVector SvgLine_getTangentVectorAtT(const SvgLine* svgline, float t); TessellatedSvgNode SvgLine_tessellateStroke(const SvgLine* svgline, AzSvgStrokeStyle stroke_style); + void SvgQuadraticCurve_reverse(SvgQuadraticCurve* restrict svgquadraticcurve); SvgPoint SvgQuadraticCurve_getStart(const SvgQuadraticCurve* svgquadraticcurve); SvgPoint SvgQuadraticCurve_getEnd(const SvgQuadraticCurve* svgquadraticcurve); SvgRect SvgQuadraticCurve_getBounds(const SvgQuadraticCurve* svgquadraticcurve); @@ -10528,6 +10532,7 @@ namespace dll { float SvgQuadraticCurve_getYAtT(const SvgQuadraticCurve* svgquadraticcurve, float t); SvgVector SvgQuadraticCurve_getTangentVectorAtT(const SvgQuadraticCurve* svgquadraticcurve, float t); TessellatedSvgNode SvgQuadraticCurve_tessellateStroke(const SvgQuadraticCurve* svgquadraticcurve, AzSvgStrokeStyle stroke_style); + void SvgCubicCurve_reverse(SvgCubicCurve* restrict svgcubiccurve); SvgPoint SvgCubicCurve_getStart(const SvgCubicCurve* svgcubiccurve); SvgPoint SvgCubicCurve_getEnd(const SvgCubicCurve* svgcubiccurve); SvgRect SvgCubicCurve_getBounds(const SvgCubicCurve* svgcubiccurve); diff --git a/api/rust/src/lib.rs b/api/rust/src/lib.rs index 1cfce52d9..cc248d23b 100644 --- a/api/rust/src/lib.rs +++ b/api/rust/src/lib.rs @@ -10351,8 +10351,10 @@ mod dll { pub(crate) fn AzSvgStyledNode_tessellate(_: &AzSvgStyledNode) -> AzTessellatedSvgNode; pub(crate) fn AzSvgCircle_tessellateFill(_: &AzSvgCircle, _: AzSvgFillStyle) -> AzTessellatedSvgNode; pub(crate) fn AzSvgCircle_tessellateStroke(_: &AzSvgCircle, _: AzSvgStrokeStyle) -> AzTessellatedSvgNode; + pub(crate) fn AzSvgPath_reverse(_: &mut AzSvgPath); pub(crate) fn AzSvgPath_tessellateFill(_: &AzSvgPath, _: AzSvgFillStyle) -> AzTessellatedSvgNode; pub(crate) fn AzSvgPath_tessellateStroke(_: &AzSvgPath, _: AzSvgStrokeStyle) -> AzTessellatedSvgNode; + pub(crate) fn AzSvgPathElement_reverse(_: &mut AzSvgPathElement); pub(crate) fn AzSvgPathElement_getStart(_: &AzSvgPathElement) -> AzSvgPoint; pub(crate) fn AzSvgPathElement_getEnd(_: &AzSvgPathElement) -> AzSvgPoint; pub(crate) fn AzSvgPathElement_getBounds(_: &AzSvgPathElement) -> AzSvgRect; @@ -10365,6 +10367,7 @@ mod dll { pub(crate) fn AzSvgVector_angleDegrees(_: &AzSvgVector) -> f32; pub(crate) fn AzSvgVector_normalize(_: &AzSvgVector) -> AzSvgVector; pub(crate) fn AzSvgVector_rotate90DegCcw(_: &AzSvgVector) -> AzSvgVector; + pub(crate) fn AzSvgLine_reverse(_: &mut AzSvgLine); pub(crate) fn AzSvgLine_getStart(_: &AzSvgLine) -> AzSvgPoint; pub(crate) fn AzSvgLine_getEnd(_: &AzSvgLine) -> AzSvgPoint; pub(crate) fn AzSvgLine_getBounds(_: &AzSvgLine) -> AzSvgRect; @@ -10374,6 +10377,7 @@ mod dll { pub(crate) fn AzSvgLine_getYAtT(_: &AzSvgLine, _: f32) -> f32; pub(crate) fn AzSvgLine_getTangentVectorAtT(_: &AzSvgLine, _: f32) -> AzSvgVector; pub(crate) fn AzSvgLine_tessellateStroke(_: &AzSvgLine, _: AzSvgStrokeStyle) -> AzTessellatedSvgNode; + pub(crate) fn AzSvgQuadraticCurve_reverse(_: &mut AzSvgQuadraticCurve); pub(crate) fn AzSvgQuadraticCurve_getStart(_: &AzSvgQuadraticCurve) -> AzSvgPoint; pub(crate) fn AzSvgQuadraticCurve_getEnd(_: &AzSvgQuadraticCurve) -> AzSvgPoint; pub(crate) fn AzSvgQuadraticCurve_getBounds(_: &AzSvgQuadraticCurve) -> AzSvgRect; @@ -10383,6 +10387,7 @@ mod dll { pub(crate) fn AzSvgQuadraticCurve_getYAtT(_: &AzSvgQuadraticCurve, _: f32) -> f32; pub(crate) fn AzSvgQuadraticCurve_getTangentVectorAtT(_: &AzSvgQuadraticCurve, _: f32) -> AzSvgVector; pub(crate) fn AzSvgQuadraticCurve_tessellateStroke(_: &AzSvgQuadraticCurve, _: AzSvgStrokeStyle) -> AzTessellatedSvgNode; + pub(crate) fn AzSvgCubicCurve_reverse(_: &mut AzSvgCubicCurve); pub(crate) fn AzSvgCubicCurve_getStart(_: &AzSvgCubicCurve) -> AzSvgPoint; pub(crate) fn AzSvgCubicCurve_getEnd(_: &AzSvgCubicCurve) -> AzSvgPoint; pub(crate) fn AzSvgCubicCurve_getBounds(_: &AzSvgCubicCurve) -> AzSvgRect; @@ -16100,6 +16105,8 @@ pub mod svg { #[doc(inline)] pub use crate::dll::AzSvgPath as SvgPath; impl SvgPath { + /// Reverses the order of points in the path so that the path runs in the opposite direction afterwards + pub fn reverse(&mut self) { unsafe { crate::dll::AzSvgPath_reverse(self) } } /// Calls the `SvgPath::tessellate_fill` function. pub fn tessellate_fill(&self, fill_style: SvgFillStyle) -> crate::svg::TessellatedSvgNode { unsafe { crate::dll::AzSvgPath_tessellateFill(self, fill_style) } } /// Calls the `SvgPath::tessellate_stroke` function. @@ -16110,6 +16117,8 @@ pub mod svg { #[doc(inline)] pub use crate::dll::AzSvgPathElement as SvgPathElement; impl SvgPathElement { + /// Reverses the order of points in the path so that the path runs in the opposite direction afterwards + pub fn reverse(&mut self) { unsafe { crate::dll::AzSvgPathElement_reverse(self) } } /// Returns the starting point of this item pub fn get_start(&self) -> crate::svg::SvgPoint { unsafe { crate::dll::AzSvgPathElement_getStart(self) } } /// Returns the ending point of this item @@ -16149,6 +16158,8 @@ pub mod svg { #[doc(inline)] pub use crate::dll::AzSvgLine as SvgLine; impl SvgLine { + /// Reverses the order of points in the path so that the path runs in the opposite direction afterwards + pub fn reverse(&mut self) { unsafe { crate::dll::AzSvgLine_reverse(self) } } /// Returns the starting point of this item pub fn get_start(&self) -> crate::svg::SvgPoint { unsafe { crate::dll::AzSvgLine_getStart(self) } } /// Returns the ending point of this item @@ -16173,6 +16184,8 @@ pub mod svg { #[doc(inline)] pub use crate::dll::AzSvgQuadraticCurve as SvgQuadraticCurve; impl SvgQuadraticCurve { + /// Reverses the order of points in the curve so that the curve runs in the opposite direction afterwards + pub fn reverse(&mut self) { unsafe { crate::dll::AzSvgQuadraticCurve_reverse(self) } } /// Returns the starting point of this item pub fn get_start(&self) -> crate::svg::SvgPoint { unsafe { crate::dll::AzSvgQuadraticCurve_getStart(self) } } /// Returns the ending point of this item @@ -16197,6 +16210,8 @@ pub mod svg { #[doc(inline)] pub use crate::dll::AzSvgCubicCurve as SvgCubicCurve; impl SvgCubicCurve { + /// Reverses the order of points in the curve so that the curve runs in the opposite direction afterwards + pub fn reverse(&mut self) { unsafe { crate::dll::AzSvgCubicCurve_reverse(self) } } /// Returns the starting point of this item pub fn get_start(&self) -> crate::svg::SvgPoint { unsafe { crate::dll::AzSvgCubicCurve_getStart(self) } } /// Returns the ending point of this item diff --git a/azul-core/src/svg.rs b/azul-core/src/svg.rs index 9947568a5..412d7eef0 100644 --- a/azul-core/src/svg.rs +++ b/azul-core/src/svg.rs @@ -38,6 +38,11 @@ pub struct SvgLine { } impl SvgLine { + pub fn reverse(&mut self) { + let temp = self.start; + self.start = self.end; + self.end = temp; + } pub fn get_start(&self) -> SvgPoint { self.start } pub fn get_end(&self) -> SvgPoint { self.end } @@ -94,6 +99,13 @@ pub enum SvgPathElement { } impl SvgPathElement { + pub fn reverse(&mut self) { + match self { + SvgPathElement::Line(l) => l.reverse(), + SvgPathElement::QuadraticCurve(qc) => qc.reverse(), + SvgPathElement::CubicCurve(cc) => cc.reverse(), + } + } pub fn get_start(&self) -> SvgPoint { match self { SvgPathElement::Line(l) => l.get_start(), @@ -164,6 +176,38 @@ pub struct SvgPath { pub items: SvgPathElementVec, } +impl SvgPath { + pub fn is_closed(&self) -> bool { + let first = self.items.as_ref().first(); + let last = self.items.as_ref().last(); + match (first, last) { + (Some(f), Some(l)) => (f.get_start() == l.get_end()), + _ => false, + } + } + + // reverses the order of elements in the path + pub fn reverse(&mut self) { + // swap self.items with a default vec + let mut vec = SvgPathElementVec::from_const_slice(&[]); + core::mem::swap(&mut vec, &mut self.items); + let mut vec = vec.into_library_owned_vec(); + + // reverse the order of items in the vec + vec.reverse(); + + // reverse the order inside the item itself + // i.e. swap line.start and line.end + for item in vec.iter_mut() { + item.reverse(); + } + + // swap back + let mut vec = SvgPathElementVec::from_vec(vec); + core::mem::swap(&mut vec, &mut self.items); + } +} + #[derive(Debug, Clone, PartialEq, PartialOrd)] #[repr(C)] pub struct SvgMultiPolygon { @@ -183,17 +227,6 @@ impl_vec_clone!(SvgMultiPolygon, SvgMultiPolygonVec, SvgMultiPolygonVecDestructo impl_vec_partialeq!(SvgMultiPolygon, SvgMultiPolygonVec); impl_vec_partialord!(SvgMultiPolygon, SvgMultiPolygonVec); -impl SvgPath { - pub fn is_closed(&self) -> bool { - let first = self.items.as_ref().first(); - let last = self.items.as_ref().last(); - match (first, last) { - (Some(f), Some(l)) => (f.get_start() == l.get_end()), - _ => false, - } - } -} - /// One `SvgNode` corresponds to one SVG `` element #[derive(Debug, Clone, PartialOrd, PartialEq)] #[repr(C, u8)] diff --git a/azul-css/src/css_properties.rs b/azul-css/src/css_properties.rs index 77075b935..9afdc98a8 100644 --- a/azul-css/src/css_properties.rs +++ b/azul-css/src/css_properties.rs @@ -1464,6 +1464,15 @@ const STEP_SIZE_F32: f32 = 0.05; impl SvgCubicCurve { + pub fn reverse(&mut self) { + let mut temp = self.start; + self.start = self.end; + self.end = temp; + temp = self.ctrl_1; + self.ctrl_1 = self.ctrl_2; + self.ctrl_2 = temp; + } + pub fn get_start(&self) -> SvgPoint { self.start } pub fn get_end(&self) -> SvgPoint { self.end } @@ -1617,6 +1626,11 @@ pub struct SvgQuadraticCurve { } impl SvgQuadraticCurve { + pub fn reverse(&mut self) { + let mut temp = self.start; + self.start = self.end; + self.end = temp; + } pub fn get_start(&self) -> SvgPoint { self.start } pub fn get_end(&self) -> SvgPoint { self.end } pub fn get_bounds(&self) -> SvgRect { diff --git a/azul-css/src/lib.rs b/azul-css/src/lib.rs index 068176ca7..1b2d6a842 100644 --- a/azul-css/src/lib.rs +++ b/azul-css/src/lib.rs @@ -176,9 +176,13 @@ macro_rules! impl_vec_as_hashmap {($struct_type:ident, $struct_name:ident) => ( } pub fn remove_hm_item(&mut self, remove_key: &$struct_type) { - let mut vec = self.clone().into_library_owned_vec(); - vec.retain(|v| v == remove_key); - *self = Self::from_vec(vec); + *self = Self::from_vec( + self + .as_ref() + .iter() + .filter_map(|r| if *r == *remove_key { None } else { Some(*r) }) + .collect::>() + ); } pub fn contains_hm_item(&self, searched: &$struct_type) -> bool { diff --git a/azul-desktop/src/shell/win32.rs b/azul-desktop/src/shell/win32.rs index 6aa880abd..81d02c259 100644 --- a/azul-desktop/src/shell/win32.rs +++ b/azul-desktop/src/shell/win32.rs @@ -2533,9 +2533,9 @@ unsafe extern "system" fn WindowProc( WM_MOUSEMOVE, WM_DESTROY, WM_PAINT, WM_ACTIVATE, WM_MOUSEWHEEL, WM_SIZE, WM_NCHITTEST, WM_LBUTTONDOWN, WM_DPICHANGED, WM_RBUTTONDOWN, - WM_LBUTTONUP, WM_RBUTTONUP, WM_MOUSELEAVE, - WM_DISPLAYCHANGE, WM_SIZING, WM_WINDOWPOSCHANGED, - WM_QUIT, WM_HSCROLL, WM_VSCROLL, + WM_LBUTTONUP, WM_RBUTTONUP, WM_MBUTTONUP, WM_MBUTTONDOWN, + WM_MOUSELEAVE, WM_DISPLAYCHANGE, WM_SIZING, + WM_QUIT, WM_HSCROLL, WM_VSCROLL, WM_WINDOWPOSCHANGED, WM_KEYUP, WM_KEYDOWN, WM_SYSKEYUP, WM_SYSKEYDOWN, WM_CHAR, WM_SYSCHAR, WHEEL_DELTA, WM_SETFOCUS, WM_KILLFOCUS, @@ -2988,8 +2988,10 @@ unsafe extern "system" fn WindowProc( current_window.internal.current_window_state.keyboard_state.current_char = None.into(); current_window.internal.current_window_state.keyboard_state.pressed_scancodes.insert_hm_item(scancode); if let Some(vk) = vk { + println!("SYSKEYDOWN {:?}", vk); current_window.internal.current_window_state.keyboard_state.current_virtual_keycode = Some(vk).into(); current_window.internal.current_window_state.keyboard_state.pressed_virtual_keycodes.insert_hm_item(vk); + println!("current keyboard_state: {:#?}", current_window.internal.current_window_state.keyboard_state); } mem::drop(app_borrow); @@ -3056,6 +3058,7 @@ unsafe extern "system" fn WindowProc( current_window.internal.current_window_state.keyboard_state.current_char = None.into(); current_window.internal.current_window_state.keyboard_state.pressed_scancodes.remove_hm_item(&scancode); if let Some(vk) = vk { + println!("SYSKEYUP {:?}", vk); current_window.internal.current_window_state.keyboard_state.pressed_virtual_keycodes.remove_hm_item(&vk); current_window.internal.current_window_state.keyboard_state.current_virtual_keycode = None.into(); } @@ -3163,6 +3166,26 @@ unsafe extern "system" fn WindowProc( mem::drop(app_borrow); DefWindowProcW(hwnd, msg, wparam, lparam) }, + WM_MBUTTONDOWN => { + if let Some(current_window) = app_borrow.windows.get_mut(&hwnd_key) { + let previous_state = current_window.internal.current_window_state.clone(); + current_window.internal.previous_window_state = Some(previous_state); + current_window.internal.current_window_state.mouse_state.middle_down = true; + PostMessageW(hwnd, AZ_REDO_HIT_TEST, 0, 0); + } + mem::drop(app_borrow); + DefWindowProcW(hwnd, msg, wparam, lparam) + }, + WM_MBUTTONUP => { + if let Some(current_window) = app_borrow.windows.get_mut(&hwnd_key) { + let previous_state = current_window.internal.current_window_state.clone(); + current_window.internal.previous_window_state = Some(previous_state); + current_window.internal.current_window_state.mouse_state.middle_down = false; + PostMessageW(hwnd, AZ_REDO_HIT_TEST, 0, 0); + } + mem::drop(app_borrow); + DefWindowProcW(hwnd, msg, wparam, lparam) + }, WM_LBUTTONDOWN => { if let Some(current_window) = app_borrow.windows.get_mut(&hwnd_key) { let previous_state = current_window.internal.current_window_state.clone(); diff --git a/azul-dll/src/lib.rs b/azul-dll/src/lib.rs index 8b05bd2c7..a81d3c7dd 100644 --- a/azul-dll/src/lib.rs +++ b/azul-dll/src/lib.rs @@ -3370,6 +3370,8 @@ pub use AzSvgCircleTT as AzSvgCircle; /// Re-export of rust-allocated (stack based) `SvgPath` struct pub type AzSvgPathTT = azul_impl::svg::SvgPath; pub use AzSvgPathTT as AzSvgPath; +/// Reverses the order of points in the path so that the path runs in the opposite direction afterwards +#[no_mangle] pub extern "C" fn AzSvgPath_reverse(svgpath: &mut AzSvgPath) { svgpath.reverse() } /// Equivalent to the Rust `SvgPath::tessellate_fill()` function. #[no_mangle] pub extern "C" fn AzSvgPath_tessellateFill(svgpath: &AzSvgPath, fill_style: AzSvgFillStyle) -> AzTessellatedSvgNode { azul_impl::svg::tessellate_path_fill(svgpath, fill_style) } /// Equivalent to the Rust `SvgPath::tessellate_stroke()` function. @@ -3380,6 +3382,8 @@ pub use AzSvgPathTT as AzSvgPath; /// Re-export of rust-allocated (stack based) `SvgPathElement` struct pub type AzSvgPathElementTT = azul_impl::svg::SvgPathElement; pub use AzSvgPathElementTT as AzSvgPathElement; +/// Reverses the order of points in the path so that the path runs in the opposite direction afterwards +#[no_mangle] pub extern "C" fn AzSvgPathElement_reverse(svgpathelement: &mut AzSvgPathElement) { svgpathelement.reverse() } /// Returns the starting point of this item #[no_mangle] pub extern "C" fn AzSvgPathElement_getStart(svgpathelement: &AzSvgPathElement) -> AzSvgPoint { svgpathelement.get_start() } /// Returns the ending point of this item @@ -3416,6 +3420,8 @@ pub use AzSvgVectorTT as AzSvgVector; /// Re-export of rust-allocated (stack based) `SvgLine` struct pub type AzSvgLineTT = azul_impl::svg::SvgLine; pub use AzSvgLineTT as AzSvgLine; +/// Reverses the order of points in the path so that the path runs in the opposite direction afterwards +#[no_mangle] pub extern "C" fn AzSvgLine_reverse(svgline: &mut AzSvgLine) { svgline.reverse() } /// Returns the starting point of this item #[no_mangle] pub extern "C" fn AzSvgLine_getStart(svgline: &AzSvgLine) -> AzSvgPoint { svgline.get_start() } /// Returns the ending point of this item @@ -3438,6 +3444,8 @@ pub use AzSvgLineTT as AzSvgLine; /// Re-export of rust-allocated (stack based) `SvgQuadraticCurve` struct pub type AzSvgQuadraticCurveTT = azul_impl::svg::SvgQuadraticCurve; pub use AzSvgQuadraticCurveTT as AzSvgQuadraticCurve; +/// Reverses the order of points in the curve so that the curve runs in the opposite direction afterwards +#[no_mangle] pub extern "C" fn AzSvgQuadraticCurve_reverse(svgquadraticcurve: &mut AzSvgQuadraticCurve) { svgquadraticcurve.reverse() } /// Returns the starting point of this item #[no_mangle] pub extern "C" fn AzSvgQuadraticCurve_getStart(svgquadraticcurve: &AzSvgQuadraticCurve) -> AzSvgPoint { svgquadraticcurve.get_start() } /// Returns the ending point of this item @@ -3460,6 +3468,8 @@ pub use AzSvgQuadraticCurveTT as AzSvgQuadraticCurve; /// Re-export of rust-allocated (stack based) `SvgCubicCurve` struct pub type AzSvgCubicCurveTT = azul_impl::svg::SvgCubicCurve; pub use AzSvgCubicCurveTT as AzSvgCubicCurve; +/// Reverses the order of points in the curve so that the curve runs in the opposite direction afterwards +#[no_mangle] pub extern "C" fn AzSvgCubicCurve_reverse(svgcubiccurve: &mut AzSvgCubicCurve) { svgcubiccurve.reverse() } /// Returns the starting point of this item #[no_mangle] pub extern "C" fn AzSvgCubicCurve_getStart(svgcubiccurve: &AzSvgCubicCurve) -> AzSvgPoint { svgcubiccurve.get_start() } /// Returns the ending point of this item diff --git a/azul-dll/src/python.rs b/azul-dll/src/python.rs index 25ed55d90..489290ce9 100644 --- a/azul-dll/src/python.rs +++ b/azul-dll/src/python.rs @@ -30276,6 +30276,11 @@ impl AzSvgPath { } } + fn reverse(&mut self) -> () { + unsafe { mem::transmute(crate::AzSvgPath_reverse( + mem::transmute(self), + )) } + } fn tessellate_fill(&self, fill_style: AzSvgFillStyle) -> AzTessellatedSvgNode { unsafe { mem::transmute(crate::AzSvgPath_tessellateFill( mem::transmute(self), @@ -30401,6 +30406,11 @@ impl AzSvgLine { } } + fn reverse(&mut self) -> () { + unsafe { mem::transmute(crate::AzSvgLine_reverse( + mem::transmute(self), + )) } + } fn get_start(&self) -> AzSvgPoint { unsafe { mem::transmute(crate::AzSvgLine_getStart( mem::transmute(self), @@ -30474,6 +30484,11 @@ impl AzSvgQuadraticCurve { } } + fn reverse(&mut self) -> () { + unsafe { mem::transmute(crate::AzSvgQuadraticCurve_reverse( + mem::transmute(self), + )) } + } fn get_start(&self) -> AzSvgPoint { unsafe { mem::transmute(crate::AzSvgQuadraticCurve_getStart( mem::transmute(self), @@ -30548,6 +30563,11 @@ impl AzSvgCubicCurve { } } + fn reverse(&mut self) -> () { + unsafe { mem::transmute(crate::AzSvgCubicCurve_reverse( + mem::transmute(self), + )) } + } fn get_start(&self) -> AzSvgPoint { unsafe { mem::transmute(crate::AzSvgCubicCurve_getStart( mem::transmute(self), diff --git a/azul-dll/src/widgets/node_graph.rs b/azul-dll/src/widgets/node_graph.rs index ee2fbb534..e784944a1 100644 --- a/azul-dll/src/widgets/node_graph.rs +++ b/azul-dll/src/widgets/node_graph.rs @@ -732,7 +732,7 @@ struct NodeLocalDataset { backref: RefAny, // RefAny } -#[derive(Copy, Clone)] +#[derive(Debug, Copy, Clone)] enum InputOrOutput { Input(usize), Output(usize), @@ -1317,7 +1317,7 @@ fn render_node(node: &Node, graph_offset: (f32, f32), node_info: &NodeTypeInfo, const CSS_MATCH_2639191696846875011_PROPERTIES: &[NodeDataInlineCssProperty] = &[ // .node_configuration_field_container NodeDataInlineCssProperty::Normal(CssProperty::FlexDirection( - LayoutFlexDirectionValue::Exact(LayoutFlexDirection::Row), + LayoutFlexDirectionValue::Exact(LayoutFlexDirection::Column), )), NodeDataInlineCssProperty::Normal(CssProperty::PaddingTop(LayoutPaddingTopValue::Exact( LayoutPaddingTop { @@ -1774,606 +1774,613 @@ fn render_node(node: &Node, graph_offset: (f32, f32), node_info: &NodeTypeInfo, let node_local_dataset = RefAny::new(node_local_dataset); Dom::div() - .with_callbacks(vec![ - CallbackData { - event: EventFilter::Hover(HoverEventFilter::LeftMouseDown), - data: node_local_dataset.clone(), - callback: Callback { cb: nodegraph_set_active_node }, - }, - ].into()) .with_inline_css_props(vec![ - // .node_graph_node - NodeDataInlineCssProperty::Normal(CssProperty::OverflowX( - LayoutOverflowValue::Exact(LayoutOverflow::Visible) - )), - NodeDataInlineCssProperty::Normal(CssProperty::OverflowY( - LayoutOverflowValue::Exact(LayoutOverflow::Visible) - )), - NodeDataInlineCssProperty::Normal(CssProperty::BackgroundContent( - StyleBackgroundContentVecValue::Exact(StyleBackgroundContentVec::from_const_slice( - STYLE_BACKGROUND_CONTENT_11535310356736632656_ITEMS, - )), - )), - NodeDataInlineCssProperty::Normal(CssProperty::BorderTopColor( - StyleBorderTopColorValue::Exact(StyleBorderTopColor { - inner: ColorU { - r: 0, - g: 180, - b: 219, - a: 255, - }, - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::BorderRightColor( - StyleBorderRightColorValue::Exact(StyleBorderRightColor { - inner: ColorU { - r: 0, - g: 180, - b: 219, - a: 255, - }, - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::BorderLeftColor( - StyleBorderLeftColorValue::Exact(StyleBorderLeftColor { - inner: ColorU { - r: 0, - g: 180, - b: 219, - a: 255, - }, - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::BorderBottomColor( - StyleBorderBottomColorValue::Exact(StyleBorderBottomColor { - inner: ColorU { - r: 0, - g: 180, - b: 219, - a: 255, - }, - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::BorderTopStyle( - StyleBorderTopStyleValue::Exact(StyleBorderTopStyle { - inner: BorderStyle::Solid, - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::BorderRightStyle( - StyleBorderRightStyleValue::Exact(StyleBorderRightStyle { - inner: BorderStyle::Solid, - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::BorderLeftStyle( - StyleBorderLeftStyleValue::Exact(StyleBorderLeftStyle { - inner: BorderStyle::Solid, - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::BorderBottomStyle( - StyleBorderBottomStyleValue::Exact(StyleBorderBottomStyle { - inner: BorderStyle::Solid, - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::BorderTopWidth( - LayoutBorderTopWidthValue::Exact(LayoutBorderTopWidth { - inner: PixelValue::const_px(1), - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::BorderRightWidth( - LayoutBorderRightWidthValue::Exact(LayoutBorderRightWidth { - inner: PixelValue::const_px(1), - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::BorderLeftWidth( - LayoutBorderLeftWidthValue::Exact(LayoutBorderLeftWidth { - inner: PixelValue::const_px(1), - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::BorderBottomWidth( - LayoutBorderBottomWidthValue::Exact(LayoutBorderBottomWidth { - inner: PixelValue::const_px(1), - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::BoxShadowLeft(StyleBoxShadowValue::Exact( - StyleBoxShadow { - offset: [ - PixelValueNoPercent { - inner: PixelValue::const_px(0), - }, - PixelValueNoPercent { - inner: PixelValue::const_px(0), - }, - ], - color: ColorU { - r: 0, - g: 131, - b: 176, - a: 119, - }, - blur_radius: PixelValueNoPercent { - inner: PixelValue::const_px(3), - }, - spread_radius: PixelValueNoPercent { - inner: PixelValue::const_px(0), - }, - clip_mode: BoxShadowClipMode::Outset, - }, - ))), - NodeDataInlineCssProperty::Normal(CssProperty::BoxShadowRight(StyleBoxShadowValue::Exact( - StyleBoxShadow { - offset: [ - PixelValueNoPercent { - inner: PixelValue::const_px(0), - }, - PixelValueNoPercent { - inner: PixelValue::const_px(0), - }, - ], - color: ColorU { - r: 0, - g: 131, - b: 176, - a: 119, - }, - blur_radius: PixelValueNoPercent { - inner: PixelValue::const_px(3), - }, - spread_radius: PixelValueNoPercent { - inner: PixelValue::const_px(0), - }, - clip_mode: BoxShadowClipMode::Outset, - }, - ))), - NodeDataInlineCssProperty::Normal(CssProperty::BoxShadowTop(StyleBoxShadowValue::Exact( - StyleBoxShadow { - offset: [ - PixelValueNoPercent { - inner: PixelValue::const_px(0), - }, - PixelValueNoPercent { - inner: PixelValue::const_px(0), - }, - ], - color: ColorU { - r: 0, - g: 131, - b: 176, - a: 119, - }, - blur_radius: PixelValueNoPercent { - inner: PixelValue::const_px(3), - }, - spread_radius: PixelValueNoPercent { - inner: PixelValue::const_px(0), - }, - clip_mode: BoxShadowClipMode::Outset, - }, - ))), - NodeDataInlineCssProperty::Normal(CssProperty::BoxShadowBottom( - StyleBoxShadowValue::Exact(StyleBoxShadow { - offset: [ - PixelValueNoPercent { - inner: PixelValue::const_px(0), - }, - PixelValueNoPercent { - inner: PixelValue::const_px(0), - }, - ], - color: ColorU { - r: 0, - g: 131, - b: 176, - a: 119, - }, - blur_radius: PixelValueNoPercent { - inner: PixelValue::const_px(3), - }, - spread_radius: PixelValueNoPercent { - inner: PixelValue::const_px(0), - }, - clip_mode: BoxShadowClipMode::Outset, - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::TextColor(StyleTextColorValue::Exact( - StyleTextColor { - inner: ColorU { - r: 255, - g: 255, - b: 255, - a: 255, - }, - }, - ))), - NodeDataInlineCssProperty::Normal(CssProperty::FontFamily(StyleFontFamilyVecValue::Exact( - StyleFontFamilyVec::from_const_slice(STYLE_FONT_FAMILY_8122988506401935406_ITEMS), - ))), - NodeDataInlineCssProperty::Normal(CssProperty::Height(LayoutHeightValue::Exact( - LayoutHeight { - inner: PixelValue::const_px(300), - }, - ))), - NodeDataInlineCssProperty::Normal(CssProperty::PaddingTop(LayoutPaddingTopValue::Exact( - LayoutPaddingTop { - inner: PixelValue::const_px(10), - }, - ))), - NodeDataInlineCssProperty::Normal(CssProperty::PaddingBottom( - LayoutPaddingBottomValue::Exact(LayoutPaddingBottom { - inner: PixelValue::const_px(10), - }), - )), - NodeDataInlineCssProperty::Normal(CssProperty::PaddingLeft(LayoutPaddingLeftValue::Exact( - LayoutPaddingLeft { - inner: PixelValue::const_px(10), - }, - ))), - NodeDataInlineCssProperty::Normal(CssProperty::PaddingRight( - LayoutPaddingRightValue::Exact(LayoutPaddingRight { - inner: PixelValue::const_px(10), - }), - )), NodeDataInlineCssProperty::Normal(CssProperty::Position(LayoutPositionValue::Exact( LayoutPosition::Absolute, ))), - NodeDataInlineCssProperty::Normal(CssProperty::Transform(StyleTransformVecValue::Exact( - vec![StyleTransform::Translate(node_transform)].into(), - ))), - NodeDataInlineCssProperty::Normal(CssProperty::Width(LayoutWidthValue::Exact( - LayoutWidth { - inner: PixelValue::const_px(250), - }, - ))), ].into()) - .with_ids_and_classes({ - const IDS_AND_CLASSES_4480169002427296613: &[IdOrClass] = - &[Class(AzString::from_const_str("node_graph_node"))]; - IdOrClassVec::from_const_slice(IDS_AND_CLASSES_4480169002427296613) - }) - .with_children(DomVec::from_vec(vec![ - Dom::text(AzString::from_const_str("X")) - .with_inline_css_props(CSS_MATCH_7395766480280098891) - .with_callbacks(vec![ - CallbackData { - event: EventFilter::Hover(HoverEventFilter::MouseUp), - data: node_local_dataset.clone(), - callback: Callback { cb: nodegraph_delete_node }, - }, - ].into()) - .with_ids_and_classes({ - const IDS_AND_CLASSES_7122017923389407516: &[IdOrClass] = - &[Class(AzString::from_const_str("node_close_button"))]; - IdOrClassVec::from_const_slice(IDS_AND_CLASSES_7122017923389407516) - }), - Dom::text(node_info.name.clone()) - .with_inline_css_props(CSS_MATCH_1739273067404038547) - .with_ids_and_classes({ - const IDS_AND_CLASSES_15777790571346582635: &[IdOrClass] = - &[Class(AzString::from_const_str("node_label"))]; - IdOrClassVec::from_const_slice(IDS_AND_CLASSES_15777790571346582635) - }), + .with_children(vec![ Dom::div() - .with_inline_css_props(CSS_MATCH_3354247437065914166) - .with_ids_and_classes({ - const IDS_AND_CLASSES_5590500152394859708: &[IdOrClass] = - &[Class(AzString::from_const_str("node_body"))]; - IdOrClassVec::from_const_slice(IDS_AND_CLASSES_5590500152394859708) - }) - .with_children(DomVec::from_vec(vec![ - Dom::div() - .with_inline_css_props(CSS_MATCH_16946967739775705757) - .with_ids_and_classes({ - const IDS_AND_CLASSES_3626404106673061698: &[IdOrClass] = - &[Class(AzString::from_const_str("inputs"))]; - IdOrClassVec::from_const_slice(IDS_AND_CLASSES_3626404106673061698) - }) - .with_children(DomVec::from_vec(vec![Dom::div() - .with_inline_css_props(CSS_MATCH_705881630351954657) - .with_ids_and_classes({ - const IDS_AND_CLASSES_12825690349660780627: &[IdOrClass] = - &[Class(AzString::from_const_str("node_input_wrapper"))]; - IdOrClassVec::from_const_slice( - IDS_AND_CLASSES_12825690349660780627, - ) - }) - .with_children(DomVec::from_vec( - inputs - .into_iter() - .enumerate() - .map(|(io_id, (input_label, input_color))| { - use self::InputOrOutput::*; - - Dom::div() - .with_inline_css_props(CSS_MATCH_9863994880298313101) - .with_ids_and_classes({ - const IDS_AND_CLASSES_5020681879750641508: - &[IdOrClass] = &[Class(AzString::from_const_str( - "node_input_container", - ))]; - IdOrClassVec::from_const_slice( - IDS_AND_CLASSES_5020681879750641508, - ) - }) - .with_children(DomVec::from_vec(vec![ - Dom::div() - .with_inline_css_props( - CSS_MATCH_4700400755767504372, - ) - .with_ids_and_classes({ - const IDS_AND_CLASSES_9154857442066749879: - &[IdOrClass] = - &[Class(AzString::from_const_str( - "node_input_connection_label_wrapper", - ))]; - IdOrClassVec::from_const_slice( - IDS_AND_CLASSES_9154857442066749879, - ) - }) - .with_children(DomVec::from_vec(vec![Dom::text( - input_label.clone(), - ) - .with_inline_css_props( - CSS_MATCH_11452431279102104133, - ) - .with_ids_and_classes({ - const IDS_AND_CLASSES_16291496011772407931: - &[IdOrClass] = - &[Class(AzString::from_const_str( - "node_input_connection_label", - ))]; - IdOrClassVec::from_const_slice( - IDS_AND_CLASSES_16291496011772407931, - ) - })])), - Dom::div() - .with_callbacks(vec![ - CallbackData { - event: EventFilter::Hover(HoverEventFilter::LeftMouseUp), - data: RefAny::new(NodeInputOutputLocalDataset { - io_id: Input(io_id), - backref: node_local_dataset.clone(), - }), - callback: Callback { cb: nodegraph_input_output_connect }, - }, - CallbackData { - event: EventFilter::Hover(HoverEventFilter::RightMouseUp), - data: RefAny::new(NodeInputOutputLocalDataset { - io_id: Input(io_id), - backref: node_local_dataset.clone(), - }), - callback: Callback { cb: nodegraph_input_output_disconnect }, - }, - ].into()) - .with_inline_css_props(NodeDataInlineCssPropertyVec::from_vec(vec![ - // .node_input - NodeDataInlineCssProperty::Normal(CssProperty::BackgroundContent( - StyleBackgroundContentVecValue::Exact(vec![StyleBackgroundContent::Color(input_color)].into()), - )), - NodeDataInlineCssProperty::Normal(CssProperty::Cursor(StyleCursorValue::Exact( - StyleCursor::Pointer, - ))), - NodeDataInlineCssProperty::Normal(CssProperty::Height(LayoutHeightValue::Exact( - LayoutHeight { - inner: PixelValue::const_px(15), - }, - ))), - NodeDataInlineCssProperty::Normal(CssProperty::Width(LayoutWidthValue::Exact( - LayoutWidth { - inner: PixelValue::const_px(15), - }, - ))), - ]) - ) - .with_ids_and_classes({ - const IDS_AND_CLASSES_2128818677168244823: - &[IdOrClass] = &[Class( - AzString::from_const_str("node_input"), - )]; - IdOrClassVec::from_const_slice( - IDS_AND_CLASSES_2128818677168244823, - ) - }), - ])) - }).collect() - )) - ])), - Dom::div() - .with_inline_css_props(CSS_MATCH_7432473243011547380) - .with_ids_and_classes({ - const IDS_AND_CLASSES_746059979773622802: &[IdOrClass] = - &[Class(AzString::from_const_str("node_content_wrapper"))]; - IdOrClassVec::from_const_slice(IDS_AND_CLASSES_746059979773622802) - }) - .with_children({ - - let mut fields = Vec::new(); - - for (field_idx, field) in node.fields.iter().enumerate() { - - let field_local_dataset = RefAny::new(NodeFieldLocalDataset { - field_idx, - backref: node_local_dataset.clone(), - }); - - let div = Dom::div() - .with_inline_css_props(CSS_MATCH_2639191696846875011) - .with_ids_and_classes({ - const IDS_AND_CLASSES_4413230059125905311: &[IdOrClass] = - &[Class(AzString::from_const_str( - "node_configuration_field_container", - ))]; - IdOrClassVec::from_const_slice( - IDS_AND_CLASSES_4413230059125905311, - ) - }) - .with_children(DomVec::from_vec(vec![ - Dom::text(field.key.clone()) - .with_inline_css_props(CSS_MATCH_1198521124955124418) - .with_ids_and_classes({ - const IDS_AND_CLASSES_12334207996395559585: - &[IdOrClass] = - &[Class(AzString::from_const_str( - "node_configuration_field_label", - ))]; - IdOrClassVec::from_const_slice( - IDS_AND_CLASSES_12334207996395559585, - ) - }), - - match &field.value { - NodeTypeFieldValue::TextInput(initial_text) => { - TextInput::new(initial_text.clone()) - .with_on_focus_lost(field_local_dataset, nodegraph_on_textinput_focus_lost) - .dom() - }, - NodeTypeFieldValue::NumberInput(initial_value) => { - NumberInput::new(*initial_value) - .with_on_focus_lost(field_local_dataset, nodegraph_on_numberinput_focus_lost) - .dom() - }, - NodeTypeFieldValue::CheckBox(initial_checked) => { - CheckBox::new(*initial_checked) - .with_on_toggle(field_local_dataset, nodegraph_on_checkbox_value_changed) - .dom() - }, - NodeTypeFieldValue::ColorInput(initial_color) => { - ColorInput::new(*initial_color) - .with_on_value_change(field_local_dataset, nodegraph_on_colorinput_value_changed) - .dom() - }, - NodeTypeFieldValue::FileInput(file_path) => { - FileInput::new(file_path.clone()) - .with_on_path_change(field_local_dataset, nodegraph_on_fileinput_button_clicked) - .dom() - }, - } - ])); - - fields.push(div); - } - - DomVec::from_vec(fields) - }), - Dom::div() - .with_inline_css_props(CSS_MATCH_14906563417280941890) - .with_ids_and_classes({ - const IDS_AND_CLASSES_4737474624251936466: &[IdOrClass] = - &[Class(AzString::from_const_str("outputs"))]; - IdOrClassVec::from_const_slice(IDS_AND_CLASSES_4737474624251936466) - }) - .with_children(DomVec::from_vec(vec![Dom::div() - .with_inline_css_props(CSS_MATCH_10339190304804100510) - .with_ids_and_classes({ - const IDS_AND_CLASSES_12883576328110161157: &[IdOrClass] = - &[Class(AzString::from_const_str("node_output_wrapper"))]; - IdOrClassVec::from_const_slice( - IDS_AND_CLASSES_12883576328110161157, - ) - }) - .with_children(DomVec::from_vec( - outputs - .into_iter() - .enumerate() - .map(|(io_id, (output_label, output_color))| { - use self::InputOrOutput::*; - Dom::div() - .with_inline_css_props(CSS_MATCH_12400244273289328300) - .with_ids_and_classes({ - const IDS_AND_CLASSES_10917819668096233812: - &[IdOrClass] = &[Class(AzString::from_const_str( - "node_output_container", - ))]; - IdOrClassVec::from_const_slice( - IDS_AND_CLASSES_10917819668096233812, - ) - }) - .with_children(DomVec::from_vec(vec![ - Dom::div() - .with_callbacks(vec![ - CallbackData { - event: EventFilter::Hover(HoverEventFilter::LeftMouseUp), - data: RefAny::new(NodeInputOutputLocalDataset { - io_id: Output(io_id), - backref: node_local_dataset.clone(), - }), - callback: Callback { cb: nodegraph_input_output_connect }, - }, - CallbackData { - event: EventFilter::Hover(HoverEventFilter::RightMouseUp), - data: RefAny::new(NodeInputOutputLocalDataset { - io_id: Output(io_id), - backref: node_local_dataset.clone(), - }), - callback: Callback { cb: nodegraph_input_output_disconnect }, - }, - ].into()) - .with_inline_css_props( - NodeDataInlineCssPropertyVec::from_vec(vec![ - // .node_output - NodeDataInlineCssProperty::Normal(CssProperty::BackgroundContent( - StyleBackgroundContentVecValue::Exact(vec![ - StyleBackgroundContent::Color(output_color) - ].into()), - )), - NodeDataInlineCssProperty::Normal(CssProperty::Cursor(StyleCursorValue::Exact( - StyleCursor::Pointer, - ))), - NodeDataInlineCssProperty::Normal(CssProperty::Height(LayoutHeightValue::Exact( - LayoutHeight { - inner: PixelValue::const_px(15), - }, - ))), - NodeDataInlineCssProperty::Normal(CssProperty::Width(LayoutWidthValue::Exact( - LayoutWidth { - inner: PixelValue::const_px(15), - }, - ))), - ]) - ) - .with_ids_and_classes({ - const IDS_AND_CLASSES_17632471664405317563: - &[IdOrClass] = &[Class( - AzString::from_const_str("node_output"), - )]; - IdOrClassVec::from_const_slice( - IDS_AND_CLASSES_17632471664405317563, - ) - }), - Dom::div() - .with_inline_css_props( - CSS_MATCH_12038890904436132038, - ) - .with_ids_and_classes({ - const IDS_AND_CLASSES_1667960214206134147: - &[IdOrClass] = - &[Class(AzString::from_const_str( - "node_output_connection_label_wrapper", - ))]; - IdOrClassVec::from_const_slice( - IDS_AND_CLASSES_1667960214206134147, - ) - }) - .with_children(DomVec::from_vec(vec![Dom::text( - output_label.clone(), - ) - .with_inline_css_props( - CSS_MATCH_2008162367868363199, - ) - .with_ids_and_classes({ - const IDS_AND_CLASSES_2974914452796301884: - &[IdOrClass] = - &[Class(AzString::from_const_str( - "node_output_connection_label", - ))]; - IdOrClassVec::from_const_slice( - IDS_AND_CLASSES_2974914452796301884, - ) - })])), - ])) - }).collect() - ))])), - ])), - ])) - .with_dataset(Some(node_local_dataset).into()) + .with_callbacks(vec![ + CallbackData { + event: EventFilter::Hover(HoverEventFilter::LeftMouseDown), + data: node_local_dataset.clone(), + callback: Callback { cb: nodegraph_set_active_node }, + }, + ].into()) + .with_inline_css_props(vec![ + // .node_graph_node + NodeDataInlineCssProperty::Normal(CssProperty::OverflowX( + LayoutOverflowValue::Exact(LayoutOverflow::Visible) + )), + NodeDataInlineCssProperty::Normal(CssProperty::Position(LayoutPositionValue::Exact( + LayoutPosition::Relative, + ))), + NodeDataInlineCssProperty::Normal(CssProperty::OverflowY( + LayoutOverflowValue::Exact(LayoutOverflow::Visible) + )), + NodeDataInlineCssProperty::Normal(CssProperty::BackgroundContent( + StyleBackgroundContentVecValue::Exact(StyleBackgroundContentVec::from_const_slice( + STYLE_BACKGROUND_CONTENT_11535310356736632656_ITEMS, + )), + )), + NodeDataInlineCssProperty::Normal(CssProperty::BorderTopColor( + StyleBorderTopColorValue::Exact(StyleBorderTopColor { + inner: ColorU { + r: 0, + g: 180, + b: 219, + a: 255, + }, + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::BorderRightColor( + StyleBorderRightColorValue::Exact(StyleBorderRightColor { + inner: ColorU { + r: 0, + g: 180, + b: 219, + a: 255, + }, + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::BorderLeftColor( + StyleBorderLeftColorValue::Exact(StyleBorderLeftColor { + inner: ColorU { + r: 0, + g: 180, + b: 219, + a: 255, + }, + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::BorderBottomColor( + StyleBorderBottomColorValue::Exact(StyleBorderBottomColor { + inner: ColorU { + r: 0, + g: 180, + b: 219, + a: 255, + }, + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::BorderTopStyle( + StyleBorderTopStyleValue::Exact(StyleBorderTopStyle { + inner: BorderStyle::Solid, + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::BorderRightStyle( + StyleBorderRightStyleValue::Exact(StyleBorderRightStyle { + inner: BorderStyle::Solid, + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::BorderLeftStyle( + StyleBorderLeftStyleValue::Exact(StyleBorderLeftStyle { + inner: BorderStyle::Solid, + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::BorderBottomStyle( + StyleBorderBottomStyleValue::Exact(StyleBorderBottomStyle { + inner: BorderStyle::Solid, + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::BorderTopWidth( + LayoutBorderTopWidthValue::Exact(LayoutBorderTopWidth { + inner: PixelValue::const_px(1), + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::BorderRightWidth( + LayoutBorderRightWidthValue::Exact(LayoutBorderRightWidth { + inner: PixelValue::const_px(1), + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::BorderLeftWidth( + LayoutBorderLeftWidthValue::Exact(LayoutBorderLeftWidth { + inner: PixelValue::const_px(1), + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::BorderBottomWidth( + LayoutBorderBottomWidthValue::Exact(LayoutBorderBottomWidth { + inner: PixelValue::const_px(1), + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::BoxShadowLeft(StyleBoxShadowValue::Exact( + StyleBoxShadow { + offset: [ + PixelValueNoPercent { + inner: PixelValue::const_px(0), + }, + PixelValueNoPercent { + inner: PixelValue::const_px(0), + }, + ], + color: ColorU { + r: 0, + g: 131, + b: 176, + a: 119, + }, + blur_radius: PixelValueNoPercent { + inner: PixelValue::const_px(3), + }, + spread_radius: PixelValueNoPercent { + inner: PixelValue::const_px(0), + }, + clip_mode: BoxShadowClipMode::Outset, + }, + ))), + NodeDataInlineCssProperty::Normal(CssProperty::BoxShadowRight(StyleBoxShadowValue::Exact( + StyleBoxShadow { + offset: [ + PixelValueNoPercent { + inner: PixelValue::const_px(0), + }, + PixelValueNoPercent { + inner: PixelValue::const_px(0), + }, + ], + color: ColorU { + r: 0, + g: 131, + b: 176, + a: 119, + }, + blur_radius: PixelValueNoPercent { + inner: PixelValue::const_px(3), + }, + spread_radius: PixelValueNoPercent { + inner: PixelValue::const_px(0), + }, + clip_mode: BoxShadowClipMode::Outset, + }, + ))), + NodeDataInlineCssProperty::Normal(CssProperty::BoxShadowTop(StyleBoxShadowValue::Exact( + StyleBoxShadow { + offset: [ + PixelValueNoPercent { + inner: PixelValue::const_px(0), + }, + PixelValueNoPercent { + inner: PixelValue::const_px(0), + }, + ], + color: ColorU { + r: 0, + g: 131, + b: 176, + a: 119, + }, + blur_radius: PixelValueNoPercent { + inner: PixelValue::const_px(3), + }, + spread_radius: PixelValueNoPercent { + inner: PixelValue::const_px(0), + }, + clip_mode: BoxShadowClipMode::Outset, + }, + ))), + NodeDataInlineCssProperty::Normal(CssProperty::BoxShadowBottom( + StyleBoxShadowValue::Exact(StyleBoxShadow { + offset: [ + PixelValueNoPercent { + inner: PixelValue::const_px(0), + }, + PixelValueNoPercent { + inner: PixelValue::const_px(0), + }, + ], + color: ColorU { + r: 0, + g: 131, + b: 176, + a: 119, + }, + blur_radius: PixelValueNoPercent { + inner: PixelValue::const_px(3), + }, + spread_radius: PixelValueNoPercent { + inner: PixelValue::const_px(0), + }, + clip_mode: BoxShadowClipMode::Outset, + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::TextColor(StyleTextColorValue::Exact( + StyleTextColor { + inner: ColorU { + r: 255, + g: 255, + b: 255, + a: 255, + }, + }, + ))), + + NodeDataInlineCssProperty::Normal(CssProperty::Display(LayoutDisplayValue::Exact( + LayoutDisplay::Block + ))), + NodeDataInlineCssProperty::Normal(CssProperty::FontFamily(StyleFontFamilyVecValue::Exact( + StyleFontFamilyVec::from_const_slice(STYLE_FONT_FAMILY_8122988506401935406_ITEMS), + ))), + NodeDataInlineCssProperty::Normal(CssProperty::PaddingTop(LayoutPaddingTopValue::Exact( + LayoutPaddingTop { + inner: PixelValue::const_px(10), + }, + ))), + NodeDataInlineCssProperty::Normal(CssProperty::PaddingBottom( + LayoutPaddingBottomValue::Exact(LayoutPaddingBottom { + inner: PixelValue::const_px(10), + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::PaddingLeft(LayoutPaddingLeftValue::Exact( + LayoutPaddingLeft { + inner: PixelValue::const_px(10), + }, + ))), + NodeDataInlineCssProperty::Normal(CssProperty::PaddingRight( + LayoutPaddingRightValue::Exact(LayoutPaddingRight { + inner: PixelValue::const_px(10), + }), + )), + NodeDataInlineCssProperty::Normal(CssProperty::Transform(StyleTransformVecValue::Exact( + vec![StyleTransform::Translate(node_transform)].into(), + ))), + NodeDataInlineCssProperty::Normal(CssProperty::Width(LayoutWidthValue::Exact( + LayoutWidth { + inner: PixelValue::const_px(250), + }, + ))), + ].into()) + .with_ids_and_classes({ + const IDS_AND_CLASSES_4480169002427296613: &[IdOrClass] = + &[Class(AzString::from_const_str("node_graph_node"))]; + IdOrClassVec::from_const_slice(IDS_AND_CLASSES_4480169002427296613) + }) + .with_children(DomVec::from_vec(vec![ + Dom::text(AzString::from_const_str("X")) + .with_inline_css_props(CSS_MATCH_7395766480280098891) + .with_callbacks(vec![ + CallbackData { + event: EventFilter::Hover(HoverEventFilter::MouseUp), + data: node_local_dataset.clone(), + callback: Callback { cb: nodegraph_delete_node }, + }, + ].into()) + .with_ids_and_classes({ + const IDS_AND_CLASSES_7122017923389407516: &[IdOrClass] = + &[Class(AzString::from_const_str("node_close_button"))]; + IdOrClassVec::from_const_slice(IDS_AND_CLASSES_7122017923389407516) + }), + Dom::text(node_info.name.clone()) + .with_inline_css_props(CSS_MATCH_1739273067404038547) + .with_ids_and_classes({ + const IDS_AND_CLASSES_15777790571346582635: &[IdOrClass] = + &[Class(AzString::from_const_str("node_label"))]; + IdOrClassVec::from_const_slice(IDS_AND_CLASSES_15777790571346582635) + }), + Dom::div() + .with_inline_css_props(CSS_MATCH_3354247437065914166) + .with_ids_and_classes({ + const IDS_AND_CLASSES_5590500152394859708: &[IdOrClass] = + &[Class(AzString::from_const_str("node_body"))]; + IdOrClassVec::from_const_slice(IDS_AND_CLASSES_5590500152394859708) + }) + .with_children(DomVec::from_vec(vec![ + Dom::div() + .with_inline_css_props(CSS_MATCH_16946967739775705757) + .with_ids_and_classes({ + const IDS_AND_CLASSES_3626404106673061698: &[IdOrClass] = + &[Class(AzString::from_const_str("inputs"))]; + IdOrClassVec::from_const_slice(IDS_AND_CLASSES_3626404106673061698) + }) + .with_children(DomVec::from_vec(vec![Dom::div() + .with_inline_css_props(CSS_MATCH_705881630351954657) + .with_ids_and_classes({ + const IDS_AND_CLASSES_12825690349660780627: &[IdOrClass] = + &[Class(AzString::from_const_str("node_input_wrapper"))]; + IdOrClassVec::from_const_slice( + IDS_AND_CLASSES_12825690349660780627, + ) + }) + .with_children(DomVec::from_vec( + inputs + .into_iter() + .enumerate() + .map(|(io_id, (input_label, input_color))| { + use self::InputOrOutput::*; + + Dom::div() + .with_inline_css_props(CSS_MATCH_9863994880298313101) + .with_ids_and_classes({ + const IDS_AND_CLASSES_5020681879750641508: + &[IdOrClass] = &[Class(AzString::from_const_str( + "node_input_container", + ))]; + IdOrClassVec::from_const_slice( + IDS_AND_CLASSES_5020681879750641508, + ) + }) + .with_children(DomVec::from_vec(vec![ + Dom::div() + .with_inline_css_props( + CSS_MATCH_4700400755767504372, + ) + .with_ids_and_classes({ + const IDS_AND_CLASSES_9154857442066749879: + &[IdOrClass] = + &[Class(AzString::from_const_str( + "node_input_connection_label_wrapper", + ))]; + IdOrClassVec::from_const_slice( + IDS_AND_CLASSES_9154857442066749879, + ) + }) + .with_children(DomVec::from_vec(vec![Dom::text( + input_label.clone(), + ) + .with_inline_css_props( + CSS_MATCH_11452431279102104133, + ) + .with_ids_and_classes({ + const IDS_AND_CLASSES_16291496011772407931: + &[IdOrClass] = + &[Class(AzString::from_const_str( + "node_input_connection_label", + ))]; + IdOrClassVec::from_const_slice( + IDS_AND_CLASSES_16291496011772407931, + ) + })])), + Dom::div() + .with_callbacks(vec![ + CallbackData { + event: EventFilter::Hover(HoverEventFilter::LeftMouseUp), + data: RefAny::new(NodeInputOutputLocalDataset { + io_id: Input(io_id), + backref: node_local_dataset.clone(), + }), + callback: Callback { cb: nodegraph_input_output_connect }, + }, + CallbackData { + event: EventFilter::Hover(HoverEventFilter::MiddleMouseUp), + data: RefAny::new(NodeInputOutputLocalDataset { + io_id: Input(io_id), + backref: node_local_dataset.clone(), + }), + callback: Callback { cb: nodegraph_input_output_disconnect }, + }, + ].into()) + .with_inline_css_props(NodeDataInlineCssPropertyVec::from_vec(vec![ + // .node_input + NodeDataInlineCssProperty::Normal(CssProperty::BackgroundContent( + StyleBackgroundContentVecValue::Exact(vec![StyleBackgroundContent::Color(input_color)].into()), + )), + NodeDataInlineCssProperty::Normal(CssProperty::Cursor(StyleCursorValue::Exact( + StyleCursor::Pointer, + ))), + NodeDataInlineCssProperty::Normal(CssProperty::Height(LayoutHeightValue::Exact( + LayoutHeight { + inner: PixelValue::const_px(15), + }, + ))), + NodeDataInlineCssProperty::Normal(CssProperty::Width(LayoutWidthValue::Exact( + LayoutWidth { + inner: PixelValue::const_px(15), + }, + ))), + ]) + ) + .with_ids_and_classes({ + const IDS_AND_CLASSES_2128818677168244823: + &[IdOrClass] = &[Class( + AzString::from_const_str("node_input"), + )]; + IdOrClassVec::from_const_slice( + IDS_AND_CLASSES_2128818677168244823, + ) + }), + ])) + }).collect() + )) + ])), + Dom::div() + .with_inline_css_props(CSS_MATCH_7432473243011547380) + .with_ids_and_classes({ + const IDS_AND_CLASSES_746059979773622802: &[IdOrClass] = + &[Class(AzString::from_const_str("node_content_wrapper"))]; + IdOrClassVec::from_const_slice(IDS_AND_CLASSES_746059979773622802) + }) + .with_children({ + + let mut fields = Vec::new(); + + for (field_idx, field) in node.fields.iter().enumerate() { + + let field_local_dataset = RefAny::new(NodeFieldLocalDataset { + field_idx, + backref: node_local_dataset.clone(), + }); + + let div = Dom::div() + .with_inline_css_props(CSS_MATCH_2639191696846875011) + .with_ids_and_classes({ + const IDS_AND_CLASSES_4413230059125905311: &[IdOrClass] = + &[Class(AzString::from_const_str( + "node_configuration_field_container", + ))]; + IdOrClassVec::from_const_slice( + IDS_AND_CLASSES_4413230059125905311, + ) + }) + .with_children(DomVec::from_vec(vec![ + Dom::text(field.key.clone()) + .with_inline_css_props(CSS_MATCH_1198521124955124418) + .with_ids_and_classes({ + const IDS_AND_CLASSES_12334207996395559585: + &[IdOrClass] = + &[Class(AzString::from_const_str( + "node_configuration_field_label", + ))]; + IdOrClassVec::from_const_slice( + IDS_AND_CLASSES_12334207996395559585, + ) + }), + + match &field.value { + NodeTypeFieldValue::TextInput(initial_text) => { + TextInput::new(initial_text.clone()) + .with_on_focus_lost(field_local_dataset, nodegraph_on_textinput_focus_lost) + .dom() + }, + NodeTypeFieldValue::NumberInput(initial_value) => { + NumberInput::new(*initial_value) + .with_on_focus_lost(field_local_dataset, nodegraph_on_numberinput_focus_lost) + .dom() + }, + NodeTypeFieldValue::CheckBox(initial_checked) => { + CheckBox::new(*initial_checked) + .with_on_toggle(field_local_dataset, nodegraph_on_checkbox_value_changed) + .dom() + }, + NodeTypeFieldValue::ColorInput(initial_color) => { + ColorInput::new(*initial_color) + .with_on_value_change(field_local_dataset, nodegraph_on_colorinput_value_changed) + .dom() + }, + NodeTypeFieldValue::FileInput(file_path) => { + FileInput::new(file_path.clone()) + .with_on_path_change(field_local_dataset, nodegraph_on_fileinput_button_clicked) + .dom() + }, + } + ])); + + fields.push(div); + } + + DomVec::from_vec(fields) + }), + Dom::div() + .with_inline_css_props(CSS_MATCH_14906563417280941890) + .with_ids_and_classes({ + const IDS_AND_CLASSES_4737474624251936466: &[IdOrClass] = + &[Class(AzString::from_const_str("outputs"))]; + IdOrClassVec::from_const_slice(IDS_AND_CLASSES_4737474624251936466) + }) + .with_children(DomVec::from_vec(vec![Dom::div() + .with_inline_css_props(CSS_MATCH_10339190304804100510) + .with_ids_and_classes({ + const IDS_AND_CLASSES_12883576328110161157: &[IdOrClass] = + &[Class(AzString::from_const_str("node_output_wrapper"))]; + IdOrClassVec::from_const_slice( + IDS_AND_CLASSES_12883576328110161157, + ) + }) + .with_children(DomVec::from_vec( + outputs + .into_iter() + .enumerate() + .map(|(io_id, (output_label, output_color))| { + use self::InputOrOutput::*; + Dom::div() + .with_inline_css_props(CSS_MATCH_12400244273289328300) + .with_ids_and_classes({ + const IDS_AND_CLASSES_10917819668096233812: + &[IdOrClass] = &[Class(AzString::from_const_str( + "node_output_container", + ))]; + IdOrClassVec::from_const_slice( + IDS_AND_CLASSES_10917819668096233812, + ) + }) + .with_children(DomVec::from_vec(vec![ + Dom::div() + .with_callbacks(vec![ + CallbackData { + event: EventFilter::Hover(HoverEventFilter::LeftMouseUp), + data: RefAny::new(NodeInputOutputLocalDataset { + io_id: Output(io_id), + backref: node_local_dataset.clone(), + }), + callback: Callback { cb: nodegraph_input_output_connect }, + }, + CallbackData { + event: EventFilter::Hover(HoverEventFilter::MiddleMouseUp), + data: RefAny::new(NodeInputOutputLocalDataset { + io_id: Output(io_id), + backref: node_local_dataset.clone(), + }), + callback: Callback { cb: nodegraph_input_output_disconnect }, + }, + ].into()) + .with_inline_css_props( + NodeDataInlineCssPropertyVec::from_vec(vec![ + // .node_output + NodeDataInlineCssProperty::Normal(CssProperty::BackgroundContent( + StyleBackgroundContentVecValue::Exact(vec![ + StyleBackgroundContent::Color(output_color) + ].into()), + )), + NodeDataInlineCssProperty::Normal(CssProperty::Cursor(StyleCursorValue::Exact( + StyleCursor::Pointer, + ))), + NodeDataInlineCssProperty::Normal(CssProperty::Height(LayoutHeightValue::Exact( + LayoutHeight { + inner: PixelValue::const_px(15), + }, + ))), + NodeDataInlineCssProperty::Normal(CssProperty::Width(LayoutWidthValue::Exact( + LayoutWidth { + inner: PixelValue::const_px(15), + }, + ))), + ]) + ) + .with_ids_and_classes({ + const IDS_AND_CLASSES_17632471664405317563: + &[IdOrClass] = &[Class( + AzString::from_const_str("node_output"), + )]; + IdOrClassVec::from_const_slice( + IDS_AND_CLASSES_17632471664405317563, + ) + }), + Dom::div() + .with_inline_css_props( + CSS_MATCH_12038890904436132038, + ) + .with_ids_and_classes({ + const IDS_AND_CLASSES_1667960214206134147: + &[IdOrClass] = + &[Class(AzString::from_const_str( + "node_output_connection_label_wrapper", + ))]; + IdOrClassVec::from_const_slice( + IDS_AND_CLASSES_1667960214206134147, + ) + }) + .with_children(DomVec::from_vec(vec![Dom::text( + output_label.clone(), + ) + .with_inline_css_props( + CSS_MATCH_2008162367868363199, + ) + .with_ids_and_classes({ + const IDS_AND_CLASSES_2974914452796301884: + &[IdOrClass] = + &[Class(AzString::from_const_str( + "node_output_connection_label", + ))]; + IdOrClassVec::from_const_slice( + IDS_AND_CLASSES_2974914452796301884, + ) + })])), + ])) + }).collect() + ))])), + ])), + ])) + .with_dataset(Some(node_local_dataset).into()) + ].into()) } fn render_connections(node_graph: &NodeGraph, root_marker_nodedata: RefAny) -> Dom { @@ -2783,7 +2790,12 @@ extern "C" fn nodegraph_drag_graph_or_nodes(data: &mut RefAny, info: &mut Callba loop { - let mut node_local_dataset = match info.get_dataset(node) { + let mut node_first_child = match info.get_first_child(node) { + Some(s) => s, + None => return Update::DoNothing, + }; + + let mut node_local_dataset = match info.get_dataset(node_first_child) { None => return Update::DoNothing, Some(s) => s, }; @@ -2807,7 +2819,7 @@ extern "C" fn nodegraph_drag_graph_or_nodes(data: &mut RefAny, info: &mut Callba }) ].into()); - info.set_css_property(node, node_transform); + info.set_css_property(node_first_child, node_transform); node = match info.get_next_sibling(node) { Some(s) => s, @@ -3011,18 +3023,19 @@ extern "C" fn nodegraph_input_output_disconnect(data: &mut RefAny, info: &mut Ca None => return Update::DoNothing, }; - let result = match io_id { + let mut result = Update::DoNothing; + match io_id { Input(i) => { - match backref.callbacks.on_node_input_disconnected.as_mut() { + result.max_self(match backref.callbacks.on_node_input_disconnected.as_mut() { Some(OnNodeInputDisconnected { callback, data }) => (callback.cb)(data, info, node_id, i), None => Update::DoNothing, - } + }); }, Output(o) => { - match backref.callbacks.on_node_output_disconnected.as_mut() { + result.max_self(match backref.callbacks.on_node_output_disconnected.as_mut() { Some(OnNodeOutputDisconnected { callback, data }) => (callback.cb)(data, info, node_id, o), None => Update::DoNothing, - } + }); } }; diff --git a/examples/rust/nodegraph.rs b/examples/rust/nodegraph.rs index a4d85aed6..56299e501 100644 --- a/examples/rust/nodegraph.rs +++ b/examples/rust/nodegraph.rs @@ -388,7 +388,16 @@ fn userfunc_on_node_input_disconnected( None => return Update::DoNothing, }; - nodegraph.nodes.get_mut(&input_node_id).unwrap().connect_in.remove(&input_index); + let outputs = nodegraph.nodes + .get_mut(&input_node_id) + .unwrap() + .connect_in + .remove(&input_index) + .unwrap_or_default(); + + for (output_node_id, output_index) in outputs { + nodegraph.nodes.get_mut(&output_node_id).unwrap().connect_out.remove(&output_index); + } Update::RefreshDom } @@ -400,12 +409,22 @@ fn userfunc_on_node_output_disconnected( output_node_id: NodeGraphNodeId, output_index: usize, ) -> Update { + let mut nodegraph = match data.downcast_mut::() { Some(s) => s, None => return Update::DoNothing, }; - nodegraph.nodes.get_mut(&output_node_id).unwrap().connect_out.remove(&output_index); + let inputs = nodegraph.nodes + .get_mut(&output_node_id) + .unwrap() + .connect_out + .remove(&output_index) + .unwrap_or_default(); + + for (input_node_id, input_index) in inputs { + nodegraph.nodes.get_mut(&input_node_id).unwrap().connect_in.remove(&input_index); + } Update::RefreshDom }