Selaa lähdekoodia

Max Canvas size set to 9999 on resize

tomaszkot 3 vuotta sitten
vanhempi
commit
60774796da

+ 6 - 3
PixiEditor/Models/Constants.cs

@@ -2,8 +2,11 @@
 {
     internal class Constants
     {
-        public const int DefaultSize = 64;
-        public const int MaxWidth = 2048;
-        public const int MaxHeight = 2048;
+        public const int DefaultCanvasSize = 64;
+        public const int MaxPreviewWidth = 2048;
+        public const int MaxPreviewHeight = 2048;
+
+        public const int MaxCanvasWidth = 9999;
+        public const int MaxCanvasHeight = 9999;
     }
 }

+ 2 - 2
PixiEditor/Models/Dialogs/NewFileDialog.cs

@@ -5,9 +5,9 @@ namespace PixiEditor.Models.Dialogs
 {
     public class NewFileDialog : CustomDialog
     {
-        private int height = IPreferences.Current.GetPreference("DefaultNewFileHeight", Constants.DefaultSize);
+        private int height = IPreferences.Current.GetPreference("DefaultNewFileHeight", Constants.DefaultCanvasSize);
 
-        private int width = IPreferences.Current.GetPreference("DefaultNewFileWidth", Constants.DefaultSize);
+        private int width = IPreferences.Current.GetPreference("DefaultNewFileWidth", Constants.DefaultCanvasSize);
 
         public int Width
         {

+ 2 - 2
PixiEditor/Models/IO/ImageFileMaxSizeChecker.cs

@@ -4,8 +4,8 @@ namespace PixiEditor.Models.IO
 {
     internal class ImageFileMaxSizeChecker
     {
-        public int MaxAllowedWidthInPixels { get; init; } = 2048;
-        public int MaxAllowedHeightInPixels { get; init; } = 2048;
+        public int MaxAllowedWidthInPixels { get; init; } = Constants.MaxPreviewWidth;
+        public int MaxAllowedHeightInPixels { get; init; } = Constants.MaxPreviewHeight;
 
         public ImageFileMaxSizeChecker()
         {

+ 2 - 2
PixiEditor/ViewModels/SubViewModels/UserPreferences/Settings/FileSettings.cs

@@ -13,7 +13,7 @@ namespace PixiEditor.ViewModels.SubViewModels.UserPreferences.Settings
             set => RaiseAndUpdatePreference(ref showStartupWindow, value);
         }
 
-        private int defaultNewFileWidth = GetPreference("DefaultNewFileWidth", Constants.DefaultSize);
+        private int defaultNewFileWidth = GetPreference("DefaultNewFileWidth", Constants.DefaultCanvasSize);
 
         public int DefaultNewFileWidth
         {
@@ -26,7 +26,7 @@ namespace PixiEditor.ViewModels.SubViewModels.UserPreferences.Settings
             }
         }
 
-        private int defaultNewFileHeight = GetPreference("DefaultNewFileHeight", Constants.DefaultSize);
+        private int defaultNewFileHeight = GetPreference("DefaultNewFileHeight", Constants.DefaultCanvasSize);
 
         public int DefaultNewFileHeight
         {

+ 2 - 2
PixiEditor/Views/UserControls/SizePicker.xaml.cs

@@ -44,9 +44,9 @@ namespace PixiEditor.Views
 
             var newValue = (int)e.NewValue;
             var newSize = SizeCalculator.CalcAbsoluteFromPercentage(newValue, sizePicker.initSize.Value);
-            if (newSize.Width > Constants.MaxWidth || newSize.Width > Constants.MaxHeight)
+            if (newSize.Width > Constants.MaxCanvasWidth || newSize.Height > Constants.MaxCanvasHeight)
             {
-                newSize = new System.Drawing.Size(Constants.MaxWidth, Constants.MaxHeight);
+                newSize = new System.Drawing.Size(Constants.MaxCanvasWidth, Constants.MaxCanvasHeight);
                 d.SetValue(ChosenPercentageSizeProperty, SizeCalculator.CalcPercentageFromAbsolute(sizePicker.initSize.Value.Width, newSize.Width));
             }