Browse Source

Added HitSizeMargin to handles

Krzysztof Krysiński 4 months ago
parent
commit
a27dce1174

+ 1 - 0
src/PixiEditor/Views/Overlays/Handles/AnchorHandle.cs

@@ -14,6 +14,7 @@ public class AnchorHandle : RectangleHandle
     private Paint selectedPaint;
     
     public bool IsSelected { get; set; } = false;
+    public override VecD HitSizeMargin { get; set; } = new VecD(5, 5);
 
     public AnchorHandle(Overlay owner) : base(owner)
     {

+ 3 - 1
src/PixiEditor/Views/Overlays/Handles/Handle.cs

@@ -33,6 +33,8 @@ public abstract class Handle : IHandle
     public bool HitTestVisible { get; set; } = true;
     public bool IsHovered => isHovered;
 
+    public virtual VecD HitSizeMargin { get; set; } = VecD.Zero;
+
     public event HandleEvent OnPress;
     public event HandleEvent OnDrag;
     public event HandleEvent OnRelease;
@@ -60,7 +62,7 @@ public abstract class Handle : IHandle
 
     public virtual bool IsWithinHandle(VecD handlePos, VecD pos, double zoomboxScale)
     {
-        return TransformHelper.IsWithinHandle(handlePos, pos, zoomboxScale, Size);
+        return TransformHelper.IsWithinHandle(handlePos, pos, zoomboxScale, Size + HitSizeMargin);
     }
 
     public static T? GetResource<T>(string key)

+ 1 - 1
src/PixiParser

@@ -1 +1 @@
-Subproject commit bb5706ab9492d85c10abc24283f00dcba8d29aba
+Subproject commit 1c7d1a546ef948a825137eb3b147f05076cce843