@@ -64,6 +64,7 @@ public class SceneViewer
6464 float DeltaX , DeltaY , DeltaZ ;
6565 UndoDataSet DeltaContext ;
6666 WorldLocation CursorLocation ;
67+ readonly List < ( int TileX , int TileZ ) > FlaggedTiles = new List < ( int , int ) > ( ) ;
6768
6869 public SceneViewer ( TrackViewer trackViewer , string [ ] args )
6970 {
@@ -87,7 +88,10 @@ public SceneViewer(TrackViewer trackViewer, string[] args)
8788 RenderTargetUsage . PlatformContents ,
8889 PresentInterval . Two ) ;
8990
90- SceneWindow = new SceneWindow ( new SceneViewerHwndHost ( Game . SwapChainWindow . Handle ) ) ;
91+ SceneWindow = new SceneWindow ( new SceneViewerHwndHost ( Game . SwapChainWindow . Handle ) )
92+ {
93+ DataContext = this ,
94+ } ;
9195
9296 // The primary window activation events should not affect RunActivity
9397 Game . Activated -= Game . ActivateRunActivity ;
@@ -99,8 +103,6 @@ public SceneViewer(TrackViewer trackViewer, string[] args)
99103 SceneWindow . Deactivated += Game . DeactivateRunActivity ;
100104 SceneWindow . Deactivated += new System . EventHandler ( ( sender , e ) => SetKeyboardInput ( false ) ) ;
101105
102- SceneWindow . DataContext = this ;
103-
104106 Game . ReplaceState ( new GameStateRunActivity ( new [ ] { "-start" , "-viewer" , Game . CurrentRoute . Path + "\\ dummy\\ .pat" , "" , "10:00" , "1" , "0" } ) ) ;
105107 }
106108
@@ -138,12 +140,10 @@ public void Update(GameTime gameTime)
138140 }
139141 if ( UserInput . IsPressed ( UserCommand . EditorUndo ) )
140142 {
141- SetDefaultMode ( ) ;
142143 UndoCommand ( ) ;
143144 }
144145 if ( UserInput . IsPressed ( UserCommand . EditorRedo ) )
145146 {
146- SetDefaultMode ( ) ;
147147 RedoCommand ( ) ;
148148 }
149149 }
@@ -436,15 +436,16 @@ void UpdateViewUndoState()
436436 }
437437 }
438438
439- void SetDefaultMode ( )
439+ public void SetDefaultMode ( )
440440 {
441441 SelectedObject = null ;
442442 SelectedObjectChanged ( ) ;
443443 EditorState = EditorState . Default ;
444444 }
445445
446- void UndoCommand ( )
446+ public void UndoCommand ( )
447447 {
448+ SetDefaultMode ( ) ;
448449 if ( UndoStack . Count > 1 )
449450 {
450451 var undoDataSet = UndoStack . Pop ( ) ;
@@ -453,8 +454,9 @@ void UndoCommand()
453454 }
454455 }
455456
456- void RedoCommand ( )
457+ public void RedoCommand ( )
457458 {
459+ SetDefaultMode ( ) ;
458460 if ( RedoStack . Count > 0 )
459461 {
460462 var undoDataSet = RedoStack . Pop ( ) ;
@@ -477,10 +479,13 @@ void UndoRedo(UndoDataSet undoDataSet, bool undo)
477479 var newPosition = new WorldPosition ( undoDataSet . ChangedStaticShape . Location ) ;
478480 undoDataSet . ChangedStaticShape . Location . CopyFrom ( undoDataSet . OldPosition ) ;
479481 undoDataSet . OldPosition . CopyFrom ( newPosition ) ;
482+ var flag = ( undoDataSet . ChangedStaticShape . Location . TileX , undoDataSet . ChangedStaticShape . Location . TileZ ) ;
483+ if ( ! FlaggedTiles . Contains ( flag ) )
484+ FlaggedTiles . Add ( flag ) ;
480485 }
481486 }
482487
483- void StartObjectMove ( )
488+ public void StartObjectMove ( )
484489 {
485490 MovedObject = SelectedObject ;
486491 MovedObjectOriginalPosition = new WorldPosition ( MovedObject . Location ) ;
@@ -516,7 +521,7 @@ void ApplyObjectMove()
516521 EditorState = EditorState . ObjectSelected ;
517522 }
518523
519- void StartHandleMove ( )
524+ public void StartHandleMove ( )
520525 {
521526 HandlePosition = new WorldPosition ( SelectedObject . Location ) ;
522527 HandleOriginalPosition = new WorldPosition ( HandlePosition ) ;
0 commit comments