From 31a8fc5c7d127d485f9fb09616d81e6049dd22d6 Mon Sep 17 00:00:00 2001 From: carlopav Date: Sun, 19 Sep 2021 14:31:44 +0200 Subject: [PATCH] Draft: fix Snapper GridSnap not working over a face ref. https://forum.freecadweb.org/viewtopic.php?f=23&t=62274&sid=4c9d07255e4f0db219b661c345768319 If the cursor is over a Face and no SnapCenter is active, the snapToObject method returns the current cursor point instead of None. Doing so the snap() method does not check for extension and grid snaps. It seems this is a bug since the snap() already contains the deleted code. One note: the no snaps case was moved before the lastObj setting, since if no snap point was found, it's not right to set it to a non snapped object. --- src/Mod/Draft/draftguitools/gui_snapper.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Mod/Draft/draftguitools/gui_snapper.py b/src/Mod/Draft/draftguitools/gui_snapper.py index 93ac7f3b3c..b396e7fdb1 100644 --- a/src/Mod/Draft/draftguitools/gui_snapper.py +++ b/src/Mod/Draft/draftguitools/gui_snapper.py @@ -475,6 +475,9 @@ class Snapper: # snap to corners of section planes snaps.extend(self.snapToEndpoints(obj.Shape)) + if not snaps: + return None + # updating last objects list if not self.lastObj[1]: self.lastObj[1] = obj.Name @@ -482,15 +485,6 @@ class Snapper: self.lastObj[0] = self.lastObj[1] self.lastObj[1] = obj.Name - if not snaps: - self.spoint = self.cstr(lastpoint, constrain, point) - self.running = False - if self.trackLine and lastpoint: - self.trackLine.p2(self.spoint) - self.trackLine.color.rgb = Gui.draftToolBar.getDefaultColor("line") - self.trackLine.on() - return self.spoint - # calculating the nearest snap point shortest = 1000000000000000000 origin = App.Vector(self.snapInfo['x'],