Browse Source

Upgraded avalonia version

flabbet 1 year ago
parent
commit
2083a22808

+ 1 - 1
src/Directory.Build.props

@@ -1,7 +1,7 @@
 <Project>
     <PropertyGroup>
         <CodeAnalysisRuleSet>../Custom.ruleset</CodeAnalysisRuleSet>
-		    <AvaloniaVersion>11.0.11</AvaloniaVersion>
+		    <AvaloniaVersion>11.1.0</AvaloniaVersion>
     </PropertyGroup>
     <ItemGroup>
         <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />

+ 1 - 1
src/PixiEditor.AvaloniaUI/PixiEditor.AvaloniaUI.csproj

@@ -60,7 +60,7 @@
     <PackageReference Include="Avalonia.Labs.Lottie" Version="11.0.10.1"/>
     <PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)"/>
     <PackageReference Include="Avalonia.Skia" Version="$(AvaloniaVersion)"/>
-    <PackageReference Include="Avalonia.Svg.Skia" Version="11.0.0.18"/>
+    <PackageReference Include="Avalonia.Svg.Skia" Version="$(AvaloniaVersion)"/>
     <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
     <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)"/>
     <PackageReference Include="ByteSize" Version="2.1.1"/>

+ 20 - 3
src/PixiEditor.AvaloniaUI/Views/Input/SizeInput.axaml.cs

@@ -11,7 +11,7 @@ namespace PixiEditor.AvaloniaUI.Views.Input;
 internal partial class SizeInput : UserControl
 {
     public static readonly StyledProperty<int> SizeProperty =
-        AvaloniaProperty.Register<SizeInput, int>(nameof(Size), defaultValue: 1);
+        AvaloniaProperty.Register<SizeInput, int>(nameof(Size), defaultValue: 1, coerce: Coerce);
 
     public static readonly StyledProperty<int> MaxSizeProperty =
         AvaloniaProperty.Register<SizeInput, int>(nameof(MaxSize), defaultValue: int.MaxValue);
@@ -30,6 +30,7 @@ internal partial class SizeInput : UserControl
         get => GetValue(FocusNextProperty);
         set => SetValue(FocusNextProperty, value);
     }
+
     public Action OnScrollAction
     {
         get { return GetValue(OnScrollActionProperty); }
@@ -102,6 +103,24 @@ internal partial class SizeInput : UserControl
         set => SetValue(UnitProperty, value);
     }
 
+
+    private static int Coerce(AvaloniaObject sender, int value)
+    {
+        if (value <= 0)
+        {
+            return 1;
+        }
+
+        int maxSize = sender.GetValue(MaxSizeProperty);
+        
+        if (value > maxSize)
+        {
+            return maxSize;
+        }
+        
+        return value;
+    }
+
     private static void InputSizeChanged(AvaloniaPropertyChangedEventArgs<int> e)
     {
         int newValue = e.NewValue.Value;
@@ -116,8 +135,6 @@ internal partial class SizeInput : UserControl
         else if (newValue <= 0)
         {
             e.Sender.SetValue(SizeProperty, 1);
-
-            return;
         }
     }
 

+ 1 - 0
src/PixiEditor.Extensions/UI/Translator.cs

@@ -163,6 +163,7 @@ public class Translator : Control
 
     private static void UpdateKey(AvaloniaObject d, string key)
     {
+        if(key == null) return;
         var parameters = GetLocalizedString(d).Parameters;
         LocalizedString localizedString = new(key, parameters);