Browse Source

Extracted radius as a resource

Krzysztof Krysiński 1 year ago
parent
commit
3fd7766074

+ 1 - 0
src/PixiEditor.AvaloniaUI/Styles/PixiEditor.Handles.axaml

@@ -14,6 +14,7 @@
 
 
             <system:Double x:Key="HandleSize">20</system:Double>
             <system:Double x:Key="HandleSize">20</system:Double>
             <system:Double x:Key="AnchorHandleSize">10</system:Double>
             <system:Double x:Key="AnchorHandleSize">10</system:Double>
+            <system:Double x:Key="AnchorRadius">2.5</system:Double>
         </ResourceDictionary>
         </ResourceDictionary>
     </Styles.Resources>
     </Styles.Resources>
 
 

+ 3 - 2
src/PixiEditor.AvaloniaUI/Views/Overlays/Handles/RectangleHandle.cs

@@ -7,14 +7,15 @@ namespace PixiEditor.AvaloniaUI.Views.Overlays.Handles;
 
 
 public class RectangleHandle : Handle
 public class RectangleHandle : Handle
 {
 {
+    public double AnchorRadius { get; set; } = GetResource<double>("AnchorRadius");
     public RectangleHandle(Control owner, VecD position) : base(owner, position)
     public RectangleHandle(Control owner, VecD position) : base(owner, position)
     {
     {
     }
     }
 
 
     public override void Draw(DrawingContext context)
     public override void Draw(DrawingContext context)
     {
     {
-        float scaleMultiplier = (float)(1.0 / ZoomboxScale);
-        float radius = 2.5f * scaleMultiplier;
+        double scaleMultiplier = (1.0 / ZoomboxScale);
+        double radius = AnchorRadius * scaleMultiplier;
         context.DrawRectangle(HandleBrush, HandlePen, TransformHelper.ToHandleRect(Position, Size, ZoomboxScale), radius, radius);
         context.DrawRectangle(HandleBrush, HandlePen, TransformHelper.ToHandleRect(Position, Size, ZoomboxScale), radius, radius);
     }
     }
 }
 }