Browse Source

Disabled snapping for members that are invisible

Krzysztof Krysiński 4 months ago
parent
commit
d93c6a4b75

+ 8 - 0
src/PixiEditor/Models/DocumentModels/DocumentUpdater.cs

@@ -446,6 +446,14 @@ internal class DocumentUpdater
     {
         IStructureMemberHandler? memberVM = doc.StructureHelper.FindOrThrow(info.Id);
         memberVM.SetIsVisible(info.IsVisible);
+        if (info.IsVisible)
+        {
+            doc.SnappingHandler.AddFromBounds(memberVM.Id.ToString(), () => memberVM.TightBounds ?? RectD.Empty);
+        }
+        else
+        {
+            doc.SnappingHandler.Remove(memberVM.Id.ToString());
+        }
     }
 
     private void ProcessUpdateStructureMemberName(StructureMemberName_ChangeInfo info)

+ 5 - 1
src/PixiEditor/Models/DocumentModels/UpdateableChangeExecutors/VectorPathToolExecutor.cs

@@ -182,7 +182,11 @@ internal class VectorPathToolExecutor : UpdateableChangeExecutor, IPathExecutorF
     public override void ForceStop()
     {
         document.PathOverlayHandler.Hide();
-        document.SnappingHandler.AddFromBounds(member.Id.ToString(), () => member.TightBounds ?? RectD.Empty);
+        if (member.IsVisibleBindable)
+        {
+            document.SnappingHandler.AddFromBounds(member.Id.ToString(), () => member.TightBounds ?? RectD.Empty);
+        }
+
         HighlightSnapping(null, null);
         internals.ActionAccumulator.AddFinishedActions(new EndSetShapeGeometry_Action());
     }