Browse Source

Fixed once again line overlay

flabbet 8 months ago
parent
commit
492a6695ca

+ 4 - 1
src/PixiEditor/Views/Main/ViewportControls/ViewportOverlays.cs

@@ -236,7 +236,7 @@ internal class ViewportOverlays
         {
             Source = Viewport, Path = "Document.LineToolOverlayViewModel.IsSizeBoxEnabled", Mode = BindingMode.TwoWay
         };
-
+        
         lineToolOverlay.Bind(Visual.IsVisibleProperty, isVisibleBinding);
         lineToolOverlay.Bind(LineToolOverlay.SnappingControllerProperty, snappingBinding);
         lineToolOverlay.Bind(LineToolOverlay.ActionCompletedProperty, actionCompletedBinding);
@@ -244,6 +244,9 @@ internal class ViewportOverlays
         lineToolOverlay.Bind(LineToolOverlay.LineEndProperty, lineEndBinding);
         lineToolOverlay.Bind(LineToolOverlay.ShowHandlesProperty, showHandlesBinding);
         lineToolOverlay.Bind(LineToolOverlay.IsSizeBoxEnabledProperty, isSizeBoxEnabledBinding);
+        lineToolOverlay.Bind(LineToolOverlay.ShowHandlesProperty, showHandlesBinding);
+        lineToolOverlay.Bind(LineToolOverlay.IsSizeBoxEnabledProperty, isSizeBoxEnabledBinding);
+        lineToolOverlay.Bind(Visual.IsVisibleProperty, isVisibleBinding);
     }
 
     private void BindTransformOverlay()

+ 7 - 3
src/PixiEditor/Views/Rendering/Scene.cs

@@ -373,11 +373,13 @@ internal class Scene : Zoombox.Zoombox, ICustomHitTest
             }
             else
             {
-                for (var i = 0; i < mouseOverOverlays.Count; i++)
+                foreach (var overlay in AllOverlays)
                 {
-                    var overlay = mouseOverOverlays[i];
                     if (args.Handled) break;
                     if (!overlay.IsVisible) continue;
+                    
+                    if(!overlay.IsHitTestVisible || !overlay.TestHit(args.Point)) continue;
+                    
                     overlay.PressPointer(args);
                 }
             }
@@ -421,11 +423,13 @@ internal class Scene : Zoombox.Zoombox, ICustomHitTest
             }
             else
             {
-                foreach (Overlay overlay in mouseOverOverlays)
+                foreach (Overlay overlay in AllOverlays)
                 {
                     if (args.Handled) break;
                     if (!overlay.IsVisible) continue;
 
+                    if(!overlay.IsHitTestVisible || !overlay.TestHit(args.Point)) continue;
+                    
                     overlay.ReleasePointer(args);
                 }
             }