@@ -205,6 +205,10 @@ void Start()
205
205
currentColor = palette [ currentColorIndex ] ;
206
206
SetCurrentColorPreviewBox ( rectCurrentColor , currentColor ) ;
207
207
ResetCurrentBrightnessPreview ( currentColor ) ;
208
+
209
+ lineSymmetryXpositionA . Visibility = Visibility . Hidden ;
210
+ lineSymmetryXpositionB . Visibility = Visibility . Hidden ;
211
+
208
212
}
209
213
210
214
@@ -461,6 +465,8 @@ void PaletteLeftButtonDown(object sender, MouseButtonEventArgs e)
461
465
462
466
void DrawingRightButtonDown ( object sender , MouseButtonEventArgs e )
463
467
{
468
+ RegisterUndo ( ) ;
469
+
464
470
int x = ( int ) ( e . GetPosition ( drawingImage ) . X / canvasScaleX ) ;
465
471
int y = ( int ) ( e . GetPosition ( drawingImage ) . Y / canvasScaleX ) ;
466
472
@@ -489,8 +495,7 @@ void DrawingMiddleButtonDown(object sender, MouseButtonEventArgs e)
489
495
void DrawingLeftButtonDown ( object sender , MouseButtonEventArgs e )
490
496
{
491
497
// take current bitmap as currentimage
492
- currentItem = canvasBitmap . Clone ( ) ;
493
- undoStack . Push ( currentItem ) ;
498
+ RegisterUndo ( ) ;
494
499
495
500
int x = ( int ) ( e . GetPosition ( drawingImage ) . X / canvasScaleX ) ;
496
501
int y = ( int ) ( e . GetPosition ( drawingImage ) . Y / canvasScaleX ) ;
@@ -522,6 +527,13 @@ void DrawingLeftButtonDown(object sender, MouseButtonEventArgs e)
522
527
}
523
528
} // DrawingLeftButtonDown
524
529
530
+ // save undo state
531
+ void RegisterUndo ( )
532
+ {
533
+ currentItem = canvasBitmap . Clone ( ) ;
534
+ undoStack . Push ( currentItem ) ;
535
+ redoStack . Clear ( ) ;
536
+ }
525
537
526
538
void DrawingMouseUp ( object sender , MouseButtonEventArgs e )
527
539
{
@@ -640,7 +652,7 @@ void DrawingMouseWheel(object sender, MouseWheelEventArgs e)
640
652
641
653
private void OnClearButton ( object sender , RoutedEventArgs e )
642
654
{
643
- //undoRedoWrapper.AddItem(canvasBitmap.Clone() );
655
+ RegisterUndo ( ) ;
644
656
ClearImage ( canvasBitmap , emptyRect , emptyPixels , emptyStride ) ;
645
657
UpdateOutline ( ) ;
646
658
}
@@ -1210,6 +1222,17 @@ private void OnGetTransparentColorButton(object sender, MouseButtonEventArgs e)
1210
1222
ResetCurrentBrightnessPreview ( currentColor ) ;
1211
1223
}
1212
1224
1225
+ private void chkMirrorX_Unchecked ( object sender , RoutedEventArgs e )
1226
+ {
1227
+ lineSymmetryXpositionA . Visibility = Visibility . Hidden ;
1228
+ lineSymmetryXpositionB . Visibility = Visibility . Hidden ;
1229
+ }
1230
+
1231
+ private void chkMirrorX_Checked ( object sender , RoutedEventArgs e )
1232
+ {
1233
+ lineSymmetryXpositionA . Visibility = Visibility . Visible ;
1234
+ lineSymmetryXpositionB . Visibility = Visibility . Visible ;
1235
+ }
1213
1236
1214
1237
1215
1238
} // class
0 commit comments