@@ -180,19 +180,42 @@ impl InstanceLayout for VectorData {
180180 format ! ( "Vector Data (points={}, segments={})" , self . point_domain. ids( ) . len( ) , self . segment_domain. ids( ) . len( ) )
181181 }
182182 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 ( ) ;
184207 match data. vector_data_domain {
185208 VectorDataDomain :: Points => {
186- rows . push ( column_headings ( & [ "" , "position" ] ) ) ;
187- rows . extend (
209+ table_rows . push ( column_headings ( & [ "" , "position" ] ) ) ;
210+ table_rows . extend (
188211 self . point_domain
189212 . iter ( )
190213 . map ( |( id, position) | vec ! [ TextLabel :: new( format!( "{}" , id. inner( ) ) ) . widget_holder( ) , TextLabel :: new( format!( "{}" , position) ) . widget_holder( ) ] ) ,
191214 ) ;
192215 }
193216 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) | {
196219 vec ! [
197220 TextLabel :: new( format!( "{}" , id. inner( ) ) ) . widget_holder( ) ,
198221 TextLabel :: new( format!( "{}" , start) ) . widget_holder( ) ,
@@ -202,8 +225,8 @@ impl InstanceLayout for VectorData {
202225 } ) ) ;
203226 }
204227 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) | {
207230 vec ! [
208231 TextLabel :: new( format!( "{}" , id. inner( ) ) ) . widget_holder( ) ,
209232 TextLabel :: new( format!( "{:?}" , segment_range) ) . widget_holder( ) ,
@@ -213,17 +236,7 @@ impl InstanceLayout for VectorData {
213236 }
214237 }
215238
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 } ]
227240 }
228241}
229242
@@ -276,13 +289,23 @@ impl<T: InstanceLayout> InstanceLayout for Instances<T> {
276289 . instance_ref_iter ( )
277290 . enumerate ( )
278291 . 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 ;
279295 vec ! [
280296 TextLabel :: new( format!( "{}" , index) ) . widget_holder( ) ,
281297 TextButton :: new( instance. instance. identifier( ) )
282298 . on_update( move |_| SpreadsheetMessage :: PushToInstancePath { index } . into( ) )
283299 . 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( ) ,
286309 TextLabel :: new( instance. source_node_id. map_or_else( || "-" . to_string( ) , |id| format!( "{}" , id. 0 ) ) ) . widget_holder( ) ,
287310 ]
288311 } )
0 commit comments