add snap points for just-drawn shapes
This commit is contained in:
parent
aebf7df80f
commit
f6b2b30910
@ -385,6 +385,8 @@ class SketchWidget:
|
|||||||
start_pt_ref = self.hover_snap_ptref
|
start_pt_ref = self.hover_snap_ptref
|
||||||
if self.drawingShape is not None:
|
if self.drawingShape is not None:
|
||||||
# end a currently drawing line
|
# end a currently drawing line
|
||||||
|
# add snap points for newly drawn line
|
||||||
|
self.add_snap_ptrefs_from_shape(self.drawingShape)
|
||||||
start = self.drawingShape.getPt(1) # start at last snap point
|
start = self.drawingShape.getPt(1) # start at last snap point
|
||||||
prev_line = self.drawingShape
|
prev_line = self.drawingShape
|
||||||
if self.hover_snap_ptref is not None:
|
if self.hover_snap_ptref is not None:
|
||||||
@ -449,6 +451,7 @@ class SketchWidget:
|
|||||||
if self.drawingShape is None:
|
if self.drawingShape is None:
|
||||||
self.drawingShape = Circle(pt[0], pt[1], 0)
|
self.drawingShape = Circle(pt[0], pt[1], 0)
|
||||||
else:
|
else:
|
||||||
|
self.add_snap_ptrefs_from_shape(self.drawingShape)
|
||||||
self.merge_in_drawing_shape()
|
self.merge_in_drawing_shape()
|
||||||
self.queue_redraw()
|
self.queue_redraw()
|
||||||
|
|
||||||
@ -493,9 +496,9 @@ class SketchWidget:
|
|||||||
def update_snap_ptrefs(self):
|
def update_snap_ptrefs(self):
|
||||||
self.snap_ptrefs = {}
|
self.snap_ptrefs = {}
|
||||||
for s in self.sketch.shapes:
|
for s in self.sketch.shapes:
|
||||||
self.add_snap_ptref(s)
|
self.add_snap_ptrefs_from_shape(s)
|
||||||
|
|
||||||
def add_snap_ptref(self, shape):
|
def add_snap_ptrefs_from_shape(self, shape):
|
||||||
for i in range(shape.nPts()):
|
for i in range(shape.nPts()):
|
||||||
pt = self.ptToScreenPt(shape.getPt(i))
|
pt = self.ptToScreenPt(shape.getPt(i))
|
||||||
self.snap_ptrefs[PointRef(shape, i)] = pt
|
self.snap_ptrefs[PointRef(shape, i)] = pt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user