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.
This commit is contained in:
carlopav
2021-09-19 14:31:44 +02:00
parent 2fd71242ba
commit 31a8fc5c7d

View File

@@ -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'],