@@ -180,19 +180,42 @@ impl InstanceLayout for VectorData {
180
180
format ! ( "Vector Data (points={}, segments={})" , self . point_domain. ids( ) . len( ) , self . segment_domain. ids( ) . len( ) )
181
181
}
182
182
fn compute_layout ( & self , data : & mut LayoutData ) -> Vec < LayoutGroup > {
183
- let mut rows = Vec :: new ( ) ;
183
+ let colinear = self . colinear_manipulators . iter ( ) . map ( |[ a, b] | format ! ( "[{a} / {b}]" ) ) . collect :: < Vec < _ > > ( ) . join ( ", " ) ;
184
+ let colinear = if colinear. is_empty ( ) { "None" } else { & colinear } ;
185
+ let style = vec ! [
186
+ TextLabel :: new( format!(
187
+ "{}\n \n Colinear Handle IDs: {}\n \n Upstream Graphic Group Table: {}" ,
188
+ self . style,
189
+ colinear,
190
+ if self . upstream_graphic_group. is_some( ) { "Yes" } else { "No" }
191
+ ) )
192
+ . multiline( true )
193
+ . widget_holder( ) ,
194
+ ] ;
195
+
196
+ let domain_entries = [ VectorDataDomain :: Points , VectorDataDomain :: Segments , VectorDataDomain :: Regions ]
197
+ . into_iter ( )
198
+ . map ( |domain| {
199
+ RadioEntryData :: new ( format ! ( "{domain:?}" ) )
200
+ . label ( format ! ( "{domain:?}" ) )
201
+ . on_update ( move |_| SpreadsheetMessage :: ViewVectorDataDomain { domain } . into ( ) )
202
+ } )
203
+ . collect ( ) ;
204
+ let domain = vec ! [ RadioInput :: new( domain_entries) . selected_index( Some ( data. vector_data_domain as u32 ) ) . widget_holder( ) ] ;
205
+
206
+ let mut table_rows = Vec :: new ( ) ;
184
207
match data. vector_data_domain {
185
208
VectorDataDomain :: Points => {
186
- rows . push ( column_headings ( & [ "" , "position" ] ) ) ;
187
- rows . extend (
209
+ table_rows . push ( column_headings ( & [ "" , "position" ] ) ) ;
210
+ table_rows . extend (
188
211
self . point_domain
189
212
. iter ( )
190
213
. map ( |( id, position) | vec ! [ TextLabel :: new( format!( "{}" , id. inner( ) ) ) . widget_holder( ) , TextLabel :: new( format!( "{}" , position) ) . widget_holder( ) ] ) ,
191
214
) ;
192
215
}
193
216
VectorDataDomain :: Segments => {
194
- rows . push ( column_headings ( & [ "" , "start_index" , "end_index" , "handles" ] ) ) ;
195
- rows . extend ( self . segment_domain . iter ( ) . map ( |( id, start, end, handles) | {
217
+ table_rows . push ( column_headings ( & [ "" , "start_index" , "end_index" , "handles" ] ) ) ;
218
+ table_rows . extend ( self . segment_domain . iter ( ) . map ( |( id, start, end, handles) | {
196
219
vec ! [
197
220
TextLabel :: new( format!( "{}" , id. inner( ) ) ) . widget_holder( ) ,
198
221
TextLabel :: new( format!( "{}" , start) ) . widget_holder( ) ,
@@ -202,8 +225,8 @@ impl InstanceLayout for VectorData {
202
225
} ) ) ;
203
226
}
204
227
VectorDataDomain :: Regions => {
205
- rows . push ( column_headings ( & [ "" , "segment_range" , "fill" ] ) ) ;
206
- rows . extend ( self . region_domain . iter ( ) . map ( |( id, segment_range, fill) | {
228
+ table_rows . push ( column_headings ( & [ "" , "segment_range" , "fill" ] ) ) ;
229
+ table_rows . extend ( self . region_domain . iter ( ) . map ( |( id, segment_range, fill) | {
207
230
vec ! [
208
231
TextLabel :: new( format!( "{}" , id. inner( ) ) ) . widget_holder( ) ,
209
232
TextLabel :: new( format!( "{:?}" , segment_range) ) . widget_holder( ) ,
@@ -213,17 +236,7 @@ impl InstanceLayout for VectorData {
213
236
}
214
237
}
215
238
216
- let entries = [ VectorDataDomain :: Points , VectorDataDomain :: Segments , VectorDataDomain :: Regions ]
217
- . into_iter ( )
218
- . map ( |domain| {
219
- RadioEntryData :: new ( format ! ( "{domain:?}" ) )
220
- . label ( format ! ( "{domain:?}" ) )
221
- . on_update ( move |_| SpreadsheetMessage :: ViewVectorDataDomain { domain } . into ( ) )
222
- } )
223
- . collect ( ) ;
224
-
225
- let domain = vec ! [ RadioInput :: new( entries) . selected_index( Some ( data. vector_data_domain as u32 ) ) . widget_holder( ) ] ;
226
- vec ! [ LayoutGroup :: Row { widgets: domain } , LayoutGroup :: Table { rows } ]
239
+ vec ! [ LayoutGroup :: Row { widgets: style } , LayoutGroup :: Row { widgets: domain } , LayoutGroup :: Table { rows: table_rows } ]
227
240
}
228
241
}
229
242
@@ -276,13 +289,23 @@ impl<T: InstanceLayout> InstanceLayout for Instances<T> {
276
289
. instance_ref_iter ( )
277
290
. enumerate ( )
278
291
. map ( |( index, instance) | {
292
+ let ( scale, angle, translation) = instance. transform . to_scale_angle_translation ( ) ;
293
+ let rotation = if angle == -0. { 0. } else { angle. to_degrees ( ) } ;
294
+ let round = |x : f64 | ( x * 1e3 ) . round ( ) / 1e3 ;
279
295
vec ! [
280
296
TextLabel :: new( format!( "{}" , index) ) . widget_holder( ) ,
281
297
TextButton :: new( instance. instance. identifier( ) )
282
298
. on_update( move |_| SpreadsheetMessage :: PushToInstancePath { index } . into( ) )
283
299
. widget_holder( ) ,
284
- TextLabel :: new( format!( "{}" , instance. transform) ) . widget_holder( ) ,
285
- TextLabel :: new( format!( "{:?}" , instance. alpha_blending) ) . widget_holder( ) ,
300
+ TextLabel :: new( format!(
301
+ "Location: ({} px, {} px) — Rotation: {rotation:2}° — Scale: ({}x, {}x)" ,
302
+ round( translation. x) ,
303
+ round( translation. y) ,
304
+ round( scale. x) ,
305
+ round( scale. y)
306
+ ) )
307
+ . widget_holder( ) ,
308
+ TextLabel :: new( format!( "{}" , instance. alpha_blending) ) . widget_holder( ) ,
286
309
TextLabel :: new( instance. source_node_id. map_or_else( || "-" . to_string( ) , |id| format!( "{}" , id. 0 ) ) ) . widget_holder( ) ,
287
310
]
288
311
} )
0 commit comments