@@ -205,6 +205,10 @@ void Start()
205205 currentColor = palette [ currentColorIndex ] ;
206206 SetCurrentColorPreviewBox ( rectCurrentColor , currentColor ) ;
207207 ResetCurrentBrightnessPreview ( currentColor ) ;
208+
209+ lineSymmetryXpositionA . Visibility = Visibility . Hidden ;
210+ lineSymmetryXpositionB . Visibility = Visibility . Hidden ;
211+
208212 }
209213
210214
@@ -461,6 +465,8 @@ void PaletteLeftButtonDown(object sender, MouseButtonEventArgs e)
461465
462466 void DrawingRightButtonDown ( object sender , MouseButtonEventArgs e )
463467 {
468+ RegisterUndo ( ) ;
469+
464470 int x = ( int ) ( e . GetPosition ( drawingImage ) . X / canvasScaleX ) ;
465471 int y = ( int ) ( e . GetPosition ( drawingImage ) . Y / canvasScaleX ) ;
466472
@@ -489,8 +495,7 @@ void DrawingMiddleButtonDown(object sender, MouseButtonEventArgs e)
489495 void DrawingLeftButtonDown ( object sender , MouseButtonEventArgs e )
490496 {
491497 // take current bitmap as currentimage
492- currentItem = canvasBitmap . Clone ( ) ;
493- undoStack . Push ( currentItem ) ;
498+ RegisterUndo ( ) ;
494499
495500 int x = ( int ) ( e . GetPosition ( drawingImage ) . X / canvasScaleX ) ;
496501 int y = ( int ) ( e . GetPosition ( drawingImage ) . Y / canvasScaleX ) ;
@@ -522,6 +527,13 @@ void DrawingLeftButtonDown(object sender, MouseButtonEventArgs e)
522527 }
523528 } // DrawingLeftButtonDown
524529
530+ // save undo state
531+ void RegisterUndo ( )
532+ {
533+ currentItem = canvasBitmap . Clone ( ) ;
534+ undoStack . Push ( currentItem ) ;
535+ redoStack . Clear ( ) ;
536+ }
525537
526538 void DrawingMouseUp ( object sender , MouseButtonEventArgs e )
527539 {
@@ -640,7 +652,7 @@ void DrawingMouseWheel(object sender, MouseWheelEventArgs e)
640652
641653 private void OnClearButton ( object sender , RoutedEventArgs e )
642654 {
643- //undoRedoWrapper.AddItem(canvasBitmap.Clone() );
655+ RegisterUndo ( ) ;
644656 ClearImage ( canvasBitmap , emptyRect , emptyPixels , emptyStride ) ;
645657 UpdateOutline ( ) ;
646658 }
@@ -1210,6 +1222,17 @@ private void OnGetTransparentColorButton(object sender, MouseButtonEventArgs e)
12101222 ResetCurrentBrightnessPreview ( currentColor ) ;
12111223 }
12121224
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+ }
12131236
12141237
12151238 } // class
0 commit comments