@@ -154,6 +154,15 @@ pub(crate) fn property_from_type(
154154 number_max = Some ( range_end) ;
155155 number_input = number_input. mode_range ( ) . min ( range_start) . max ( range_end) ;
156156 }
157+ if let Some ( unit) = unit {
158+ number_input = number_input. unit ( unit) ;
159+ }
160+ if let Some ( display_decimal_places) = display_decimal_places {
161+ number_input = number_input. display_decimal_places ( display_decimal_places) ;
162+ }
163+ if let Some ( step) = step {
164+ number_input = number_input. step ( step) ;
165+ }
157166
158167 let min = |x : f64 | number_min. unwrap_or ( x) ;
159168 let max = |x : f64 | number_max. unwrap_or ( x) ;
@@ -167,15 +176,15 @@ pub(crate) fn property_from_type(
167176 // Aliased types (ambiguous values)
168177 Some ( "Percentage" ) => number_widget ( default_info, number_input. percentage ( ) . min ( min ( 0. ) ) . max ( max ( 100. ) ) ) . into ( ) ,
169178 Some ( "SignedPercentage" ) => number_widget ( default_info, number_input. percentage ( ) . min ( min ( -100. ) ) . max ( max ( 100. ) ) ) . into ( ) ,
170- Some ( "Angle" ) => number_widget ( default_info, number_input. mode_range ( ) . min ( min ( -180. ) ) . max ( max ( 180. ) ) . unit ( "°" ) ) . into ( ) ,
171- Some ( "Multiplier" ) => number_widget ( default_info, number_input. unit ( "x" ) ) . into ( ) ,
172- Some ( "PixelLength" ) => number_widget ( default_info, number_input. min ( min ( 0. ) ) . unit ( " px" ) ) . into ( ) ,
179+ Some ( "Angle" ) => number_widget ( default_info, number_input. mode_range ( ) . min ( min ( -180. ) ) . max ( max ( 180. ) ) . unit ( unit . unwrap_or ( "°" ) ) ) . into ( ) ,
180+ Some ( "Multiplier" ) => number_widget ( default_info, number_input. unit ( unit . unwrap_or ( "x" ) ) ) . into ( ) ,
181+ Some ( "PixelLength" ) => number_widget ( default_info, number_input. min ( min ( 0. ) ) . unit ( unit . unwrap_or ( " px" ) ) ) . into ( ) ,
173182 Some ( "Length" ) => number_widget ( default_info, number_input. min ( min ( 0. ) ) ) . into ( ) ,
174183 Some ( "Fraction" ) => number_widget ( default_info, number_input. mode_range ( ) . min ( min ( 0. ) ) . max ( max ( 1. ) ) ) . into ( ) ,
175184 Some ( "IntegerCount" ) => number_widget ( default_info, number_input. int ( ) . min ( min ( 1. ) ) ) . into ( ) ,
176185 Some ( "SeedValue" ) => number_widget ( default_info, number_input. int ( ) . min ( min ( 0. ) ) ) . into ( ) ,
177- Some ( "Resolution" ) => vector2_widget ( default_info, "W" , "H" , " px" , Some ( 64. ) ) ,
178- Some ( "PixelSize" ) => vector2_widget ( default_info, "X" , "Y" , " px" , None ) ,
186+ Some ( "Resolution" ) => coordinate_widget ( default_info, "W" , "H" , unit . unwrap_or ( " px" ) , Some ( 64. ) ) ,
187+ Some ( "PixelSize" ) => coordinate_widget ( default_info, "X" , "Y" , unit . unwrap_or ( " px" ) , None ) ,
179188
180189 // For all other types, use TypeId-based matching
181190 _ => {
@@ -189,14 +198,14 @@ pub(crate) fn property_from_type(
189198 Some ( x) if x == TypeId :: of :: < u64 > ( ) => number_widget ( default_info, number_input. int ( ) . min ( min ( 0. ) ) ) . into ( ) ,
190199 Some ( x) if x == TypeId :: of :: < bool > ( ) => bool_widget ( default_info, CheckboxInput :: default ( ) ) . into ( ) ,
191200 Some ( x) if x == TypeId :: of :: < String > ( ) => text_widget ( default_info) . into ( ) ,
192- Some ( x) if x == TypeId :: of :: < DVec2 > ( ) => vector2_widget ( default_info, "X" , "Y" , "" , None ) ,
193- Some ( x) if x == TypeId :: of :: < UVec2 > ( ) => vector2_widget ( default_info, "X" , "Y" , "" , Some ( 0. ) ) ,
194- Some ( x) if x == TypeId :: of :: < IVec2 > ( ) => vector2_widget ( default_info, "X" , "Y" , "" , None ) ,
201+ Some ( x) if x == TypeId :: of :: < DVec2 > ( ) => coordinate_widget ( default_info, "X" , "Y" , "" , None ) ,
202+ Some ( x) if x == TypeId :: of :: < UVec2 > ( ) => coordinate_widget ( default_info, "X" , "Y" , "" , Some ( 0. ) ) ,
203+ Some ( x) if x == TypeId :: of :: < IVec2 > ( ) => coordinate_widget ( default_info, "X" , "Y" , "" , None ) ,
195204 // ==========================
196205 // PRIMITIVE COLLECTION TYPES
197206 // ==========================
198207 Some ( x) if x == TypeId :: of :: < Vec < f64 > > ( ) => array_of_number_widget ( default_info, TextInput :: default ( ) ) . into ( ) ,
199- Some ( x) if x == TypeId :: of :: < Vec < DVec2 > > ( ) => array_of_vector2_widget ( default_info, TextInput :: default ( ) ) . into ( ) ,
208+ Some ( x) if x == TypeId :: of :: < Vec < DVec2 > > ( ) => array_of_coordinates_widget ( default_info, TextInput :: default ( ) ) . into ( ) ,
200209 // ====================
201210 // GRAPHICAL DATA TYPES
202211 // ====================
@@ -512,7 +521,7 @@ pub fn footprint_widget(parameter_widgets_info: ParameterWidgetsInfo, extra_widg
512521 last. clone ( )
513522}
514523
515- pub fn vector2_widget ( parameter_widgets_info : ParameterWidgetsInfo , x : & str , y : & str , unit : & str , min : Option < f64 > ) -> LayoutGroup {
524+ pub fn coordinate_widget ( parameter_widgets_info : ParameterWidgetsInfo , x : & str , y : & str , unit : & str , min : Option < f64 > ) -> LayoutGroup {
516525 let ParameterWidgetsInfo { document_node, node_id, index, .. } = parameter_widgets_info;
517526
518527 let mut widgets = start_widgets ( parameter_widgets_info, FrontendGraphDataType :: Number ) ;
@@ -655,7 +664,7 @@ pub fn array_of_number_widget(parameter_widgets_info: ParameterWidgetsInfo, text
655664 widgets
656665}
657666
658- pub fn array_of_vector2_widget ( parameter_widgets_info : ParameterWidgetsInfo , text_props : TextInput ) -> Vec < WidgetHolder > {
667+ pub fn array_of_coordinates_widget ( parameter_widgets_info : ParameterWidgetsInfo , text_props : TextInput ) -> Vec < WidgetHolder > {
659668 let ParameterWidgetsInfo { document_node, node_id, index, .. } = parameter_widgets_info;
660669
661670 let mut widgets = start_widgets ( parameter_widgets_info, FrontendGraphDataType :: Number ) ;
@@ -1195,7 +1204,7 @@ pub(crate) fn grid_properties(node_id: NodeId, context: &mut NodePropertiesConte
11951204 if let Some ( & TaggedValue :: GridType ( grid_type) ) = grid_type_input. as_non_exposed_value ( ) {
11961205 match grid_type {
11971206 GridType :: Rectangular => {
1198- let spacing = vector2_widget ( ParameterWidgetsInfo :: from_index ( document_node, node_id, spacing_index, true , context) , "W" , "H" , " px" , Some ( 0. ) ) ;
1207+ let spacing = coordinate_widget ( ParameterWidgetsInfo :: from_index ( document_node, node_id, spacing_index, true , context) , "W" , "H" , " px" , Some ( 0. ) ) ;
11991208 widgets. push ( spacing) ;
12001209 }
12011210 GridType :: Isometric => {
@@ -1205,7 +1214,7 @@ pub(crate) fn grid_properties(node_id: NodeId, context: &mut NodePropertiesConte
12051214 NumberInput :: default ( ) . label ( "H" ) . min ( 0. ) . unit ( " px" ) ,
12061215 ) ,
12071216 } ;
1208- let angles = vector2_widget ( ParameterWidgetsInfo :: from_index ( document_node, node_id, angles_index, true , context) , "" , "" , "°" , None ) ;
1217+ let angles = coordinate_widget ( ParameterWidgetsInfo :: from_index ( document_node, node_id, angles_index, true , context) , "" , "" , "°" , None ) ;
12091218 widgets. extend ( [ spacing, angles] ) ;
12101219 }
12111220 }
@@ -1424,6 +1433,9 @@ pub(crate) fn generate_node_properties(node_id: NodeId, context: &mut NodeProper
14241433 unit_suffix = field. unit ;
14251434 step = field. number_step ;
14261435 number_options = ( field. number_min , field. number_max , field. number_mode_range ) ;
1436+ display_decimal_places = field. number_display_decimal_places ;
1437+ unit_suffix = field. unit ;
1438+ step = field. number_step ;
14271439 if let Some ( ref default) = field. default_type {
14281440 break ' early_return default. clone ( ) ;
14291441 }
0 commit comments