Draft: Fix grid update issue

If the grid spacing was updated in this sequence: 1 -> 0 -> 1 (or any sequence where the first and last value are equal), the grid would not be redrawn.
This commit is contained in:
Roy-043
2022-05-18 22:49:05 +02:00
committed by GitHub
parent 354c4e9635
commit 0b12cba3b5

View File

@@ -1062,15 +1062,18 @@ class gridTracker(Tracker):
if self.space == 0:
self.lines1.numVertices.deleteValues(0)
self.lines2.numVertices.deleteValues(0)
self.pts = []
FreeCAD.Console.PrintWarning("Draft Grid: Spacing value is zero\n")
return
if self.mainlines == 0:
self.lines1.numVertices.deleteValues(0)
self.lines2.numVertices.deleteValues(0)
self.pts = []
return
if self.numlines == 0:
self.lines1.numVertices.deleteValues(0)
self.lines2.numVertices.deleteValues(0)
self.pts = []
return
numlines = self.numlines // self.mainlines // 2 * 2 * self.mainlines
bound = (numlines // 2) * self.space