@@ -688,24 +688,155 @@ public void ShowUI()
688688 ImGui . Text ( "Animation" ) ;
689689 ImGui . Spacing ( ) ;
690690
691-
692- if ( _timeline . Count > 0 && _timeline . ContainsKey ( _ioTimeline ) )
691+ int numberColumns = _timeline . Count ;
692+ if ( numberColumns > 0 )
693693 {
694- foreach ( Shape shape in _timeline [ _ioTimeline ] )
694+ foreach ( Shape shape in _shapes )
695695 {
696- // TODO: Only show the edited fields
697- ImGui . Text ( shape . GetType ( ) . Name ) ;
698- ImGui . Indent ( ) ;
699- ImGui . Text ( string . Format ( "X: {0}" , shape . X ) ) ;
700- ImGui . Text ( string . Format ( "Y: {0}" , shape . Y ) ) ;
701- ImGui . Text ( string . Format ( "Width: {0}" , shape . Width ) ) ;
702- ImGui . Text ( string . Format ( "Height: {0}" , shape . Height ) ) ;
703- ImGui . Text ( string . Format ( "Color: {0}" , shape . Color . ToString ( ) ) ) ;
704- ImGui . Unindent ( ) ;
696+ if ( ImGui . BeginTable ( "shape" , 2 , ImGuiTableFlags . Resizable ) )
697+ {
698+ ImGui . TableNextRow ( ) ;
699+ ImGui . TableSetColumnIndex ( 0 ) ;
700+ ImGui . Text ( shape . GetType ( ) . Name ) ;
701+ ImGui . TableSetColumnIndex ( 1 ) ;
702+ if ( ImGui . BeginTable ( String . Format ( "elements##{0}" , shape . Id ) , numberColumns + 1 , ImGuiTableFlags . Borders ) )
703+ {
704+ ImGui . TableSetupColumn ( "Properties" ) ;
705+ foreach ( KeyValuePair < int , List < Shape > > shapes in _timeline )
706+ ImGui . TableSetupColumn ( shapes . Key . ToString ( ) ) ;
707+ ImGui . TableHeadersRow ( ) ;
708+
709+
710+ int i = 0 ;
711+
712+ if ( shape . IsMoveable )
713+ {
714+ i = 0 ;
715+ ImGui . TableNextRow ( ) ;
716+ ImGui . TableSetColumnIndex ( i ) ;
717+ ImGui . Text ( "X" ) ;
718+ foreach ( KeyValuePair < int , List < Shape > > timeline in _timeline )
719+ {
720+ i ++ ;
721+ Shape ? sibling = timeline . Value . Find ( x => x . Id == shape . Id ) ;
722+ if ( sibling != null )
723+ {
724+ ImGui . TableSetColumnIndex ( i ) ;
725+ ImGui . Text ( sibling . X . ToString ( ) ) ;
726+ }
727+ }
728+
729+ i = 0 ;
730+ ImGui . TableNextRow ( ) ;
731+ ImGui . TableSetColumnIndex ( i ) ;
732+ ImGui . Text ( "Y" ) ;
733+ foreach ( KeyValuePair < int , List < Shape > > timeline in _timeline )
734+ {
735+ i ++ ;
736+ Shape ? sibling = timeline . Value . Find ( x => x . Id == shape . Id ) ;
737+ if ( sibling != null )
738+ {
739+ ImGui . TableSetColumnIndex ( i ) ;
740+ ImGui . Text ( sibling . Y . ToString ( ) ) ;
741+ }
742+ }
743+ }
744+
745+ if ( shape . IsResizeable )
746+ {
747+ i = 0 ;
748+ ImGui . TableNextRow ( ) ;
749+ ImGui . TableSetColumnIndex ( i ) ;
750+ ImGui . Text ( "Width" ) ;
751+ foreach ( KeyValuePair < int , List < Shape > > timeline in _timeline )
752+ {
753+ i ++ ;
754+ Shape ? sibling = timeline . Value . Find ( x => x . Id == shape . Id ) ;
755+ if ( sibling != null )
756+ {
757+ ImGui . TableSetColumnIndex ( i ) ;
758+ ImGui . Text ( sibling . Width . ToString ( ) ) ;
759+ }
760+ }
761+
762+ i = 0 ;
763+ ImGui . TableNextRow ( ) ;
764+ ImGui . TableSetColumnIndex ( i ) ;
765+ ImGui . Text ( "Height" ) ;
766+ foreach ( KeyValuePair < int , List < Shape > > timeline in _timeline )
767+ {
768+ i ++ ;
769+ Shape ? sibling = timeline . Value . Find ( x => x . Id == shape . Id ) ;
770+ if ( sibling != null )
771+ {
772+ ImGui . TableSetColumnIndex ( i ) ;
773+ ImGui . Text ( sibling . Height . ToString ( ) ) ;
774+ }
775+ }
776+ }
777+
778+
779+
780+ i = 0 ;
781+ ImGui . TableNextRow ( ) ;
782+ ImGui . TableSetColumnIndex ( i ) ;
783+ ImGui . Text ( "Color" ) ;
784+ foreach ( KeyValuePair < int , List < Shape > > timeline in _timeline )
785+ {
786+ i ++ ;
787+ Shape ? sibling = timeline . Value . Find ( x => x . Id == shape . Id ) ;
788+ if ( sibling != null )
789+ {
790+ ImGui . TableSetColumnIndex ( i ) ;
791+ ImGui . Text ( String . Format ( "RGBA({0}, {1}, {2}, {3})" , sibling . Color . R , sibling . Color . G , sibling . Color . B , sibling . Color . A ) ) ;
792+ }
793+ }
794+
795+ if ( shape . IsAngleChangeable )
796+ {
797+ i = 0 ;
798+ ImGui . TableNextRow ( ) ;
799+ ImGui . TableSetColumnIndex ( i ) ;
800+ ImGui . Text ( "Angle" ) ;
801+ foreach ( KeyValuePair < int , List < Shape > > timeline in _timeline )
802+ {
803+ i ++ ;
804+ Shape ? sibling = timeline . Value . Find ( x => x . Id == shape . Id ) ;
805+ if ( sibling != null )
806+ {
807+ ImGui . TableSetColumnIndex ( i ) ;
808+ ImGui . Text ( String . Format ( "{0}°" , sibling . Angle ) ) ;
809+ }
810+ }
811+ }
812+
813+ if ( shape . IsCornerRadiusChangeable )
814+ {
815+ i = 0 ;
816+ ImGui . TableNextRow ( ) ;
817+ ImGui . TableSetColumnIndex ( i ) ;
818+ ImGui . Text ( "Corner Radius" ) ;
819+ foreach ( KeyValuePair < int , List < Shape > > timeline in _timeline )
820+ {
821+ i ++ ;
822+ Shape ? sibling = timeline . Value . Find ( x => x . Id == shape . Id ) ;
823+ if ( sibling != null )
824+ {
825+ ImGui . TableSetColumnIndex ( i ) ;
826+ ImGui . Text ( sibling . CornerRadius . ToString ( ) ) ;
827+ }
828+ }
829+ }
830+
831+
832+ ImGui . EndTable ( ) ;
833+ }
834+ ImGui . EndTable ( ) ;
835+ ImGui . Spacing ( ) ;
836+ }
705837 }
706838 }
707839
708-
709840 ImGui . End ( ) ;
710841
711842
0 commit comments