@@ -64,6 +64,7 @@ public class SceneViewer
64
64
float DeltaX , DeltaY , DeltaZ ;
65
65
UndoDataSet DeltaContext ;
66
66
WorldLocation CursorLocation ;
67
+ readonly List < ( int TileX , int TileZ ) > FlaggedTiles = new List < ( int , int ) > ( ) ;
67
68
68
69
public SceneViewer ( TrackViewer trackViewer , string [ ] args )
69
70
{
@@ -87,7 +88,10 @@ public SceneViewer(TrackViewer trackViewer, string[] args)
87
88
RenderTargetUsage . PlatformContents ,
88
89
PresentInterval . Two ) ;
89
90
90
- SceneWindow = new SceneWindow ( new SceneViewerHwndHost ( Game . SwapChainWindow . Handle ) ) ;
91
+ SceneWindow = new SceneWindow ( new SceneViewerHwndHost ( Game . SwapChainWindow . Handle ) )
92
+ {
93
+ DataContext = this ,
94
+ } ;
91
95
92
96
// The primary window activation events should not affect RunActivity
93
97
Game . Activated -= Game . ActivateRunActivity ;
@@ -99,8 +103,6 @@ public SceneViewer(TrackViewer trackViewer, string[] args)
99
103
SceneWindow . Deactivated += Game . DeactivateRunActivity ;
100
104
SceneWindow . Deactivated += new System . EventHandler ( ( sender , e ) => SetKeyboardInput ( false ) ) ;
101
105
102
- SceneWindow . DataContext = this ;
103
-
104
106
Game . ReplaceState ( new GameStateRunActivity ( new [ ] { "-start" , "-viewer" , Game . CurrentRoute . Path + "\\ dummy\\ .pat" , "" , "10:00" , "1" , "0" } ) ) ;
105
107
}
106
108
@@ -138,12 +140,10 @@ public void Update(GameTime gameTime)
138
140
}
139
141
if ( UserInput . IsPressed ( UserCommand . EditorUndo ) )
140
142
{
141
- SetDefaultMode ( ) ;
142
143
UndoCommand ( ) ;
143
144
}
144
145
if ( UserInput . IsPressed ( UserCommand . EditorRedo ) )
145
146
{
146
- SetDefaultMode ( ) ;
147
147
RedoCommand ( ) ;
148
148
}
149
149
}
@@ -436,15 +436,16 @@ void UpdateViewUndoState()
436
436
}
437
437
}
438
438
439
- void SetDefaultMode ( )
439
+ public void SetDefaultMode ( )
440
440
{
441
441
SelectedObject = null ;
442
442
SelectedObjectChanged ( ) ;
443
443
EditorState = EditorState . Default ;
444
444
}
445
445
446
- void UndoCommand ( )
446
+ public void UndoCommand ( )
447
447
{
448
+ SetDefaultMode ( ) ;
448
449
if ( UndoStack . Count > 1 )
449
450
{
450
451
var undoDataSet = UndoStack . Pop ( ) ;
@@ -453,8 +454,9 @@ void UndoCommand()
453
454
}
454
455
}
455
456
456
- void RedoCommand ( )
457
+ public void RedoCommand ( )
457
458
{
459
+ SetDefaultMode ( ) ;
458
460
if ( RedoStack . Count > 0 )
459
461
{
460
462
var undoDataSet = RedoStack . Pop ( ) ;
@@ -477,10 +479,13 @@ void UndoRedo(UndoDataSet undoDataSet, bool undo)
477
479
var newPosition = new WorldPosition ( undoDataSet . ChangedStaticShape . Location ) ;
478
480
undoDataSet . ChangedStaticShape . Location . CopyFrom ( undoDataSet . OldPosition ) ;
479
481
undoDataSet . OldPosition . CopyFrom ( newPosition ) ;
482
+ var flag = ( undoDataSet . ChangedStaticShape . Location . TileX , undoDataSet . ChangedStaticShape . Location . TileZ ) ;
483
+ if ( ! FlaggedTiles . Contains ( flag ) )
484
+ FlaggedTiles . Add ( flag ) ;
480
485
}
481
486
}
482
487
483
- void StartObjectMove ( )
488
+ public void StartObjectMove ( )
484
489
{
485
490
MovedObject = SelectedObject ;
486
491
MovedObjectOriginalPosition = new WorldPosition ( MovedObject . Location ) ;
@@ -516,7 +521,7 @@ void ApplyObjectMove()
516
521
EditorState = EditorState . ObjectSelected ;
517
522
}
518
523
519
- void StartHandleMove ( )
524
+ public void StartHandleMove ( )
520
525
{
521
526
HandlePosition = new WorldPosition ( SelectedObject . Location ) ;
522
527
HandleOriginalPosition = new WorldPosition ( HandlePosition ) ;
0 commit comments