Skip to content

Commit d3124f1

Browse files
committed
fix new image dialog canvas size reset
1 parent 5da2851 commit d3124f1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

PixelArtTool/MainWindow.xaml.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public MainWindow()
128128
Start();
129129
}
130130

131-
void Start()
131+
void Start(bool loadSettings = true)
132132
{
133133
w = (MainWindow)Application.Current.MainWindow;
134134
windowTitle = w.Title;
@@ -148,7 +148,7 @@ void Start()
148148
darkColor.Alpha = gridAlpha;
149149

150150
// get values from settings
151-
LoadSettings();
151+
if (loadSettings==true) LoadSettings();
152152

153153
// setup background grid
154154
gridBitmap = new WriteableBitmap(canvasResolutionX, canvasResolutionY, dpiX, dpiY, PixelFormats.Bgra32, null);
@@ -1388,7 +1388,7 @@ private void drawingImage_MouseEnter(object sender, MouseEventArgs e)
13881388
private void OnClearButton(object sender, MouseButtonEventArgs e)
13891389
{
13901390
// shiftdown or right button, just clear without dialog
1391-
if (leftShiftDown == true || e.RightButton == MouseButtonState.Pressed)
1391+
if (leftShiftDown == true || (e!=null && e.RightButton == MouseButtonState.Pressed))
13921392
{
13931393
ClearImage(canvasBitmap, emptyRect, emptyPixels, emptyStride);
13941394
UpdateOutline();
@@ -1417,8 +1417,8 @@ private void OnClearButton(object sender, MouseButtonEventArgs e)
14171417
canvasResolutionX = (int)dlg.sliderResolution.Value;
14181418
canvasResolutionY = (int)dlg.sliderResolution.Value;
14191419

1420-
// TODO no need to do full start
1421-
Start();
1420+
// TODO no need to do full start?
1421+
Start(false);
14221422

14231423
break;
14241424
case false: // cancelled

PixelArtTool/NewImageDialog.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Windows;
2+
using System.Windows.Input;
23

34
namespace PixelArtTool
45
{

0 commit comments

Comments
 (0)