draw in-progress lines to snap point
This commit is contained in:
parent
84f1e6585b
commit
f489d11a57
@ -416,8 +416,14 @@ class SketchWidget:
|
||||
self.queue_redraw()
|
||||
|
||||
def do_line_motion(self, x, y):
|
||||
snap_ptref = self.get_closest_snap_ptref(x, y)
|
||||
self.update_hover_snap_point(snap_ptref)
|
||||
if self.drawingShape is not None:
|
||||
this_pt = self.screenPtToPt((x, self.size[1] - y))
|
||||
if snap_ptref is not None:
|
||||
this_pt = snap_ptref.getPt()
|
||||
self.drawingConstraints['hv'] = None
|
||||
else:
|
||||
start = self.drawingShape.getPt(0)
|
||||
angle = math.atan2(this_pt[1] - start[1], this_pt[0] - start[0])
|
||||
angle *= 180.0 / math.pi
|
||||
@ -430,7 +436,8 @@ class SketchWidget:
|
||||
if not ('hv' in self.drawingConstraints
|
||||
and isinstance(self.drawingConstraints['hv'],
|
||||
Horizontal)):
|
||||
c = Horizontal(self.drawingShape, 0, self.drawingShape, 1)
|
||||
c = Horizontal(
|
||||
self.drawingShape, 0, self.drawingShape, 1)
|
||||
self.drawingConstraints['hv'] = c
|
||||
elif ((snaps_to(-90) or snaps_to(90))
|
||||
and within(start[0], this_pt[0], hv_snap_dist)):
|
||||
@ -441,12 +448,9 @@ class SketchWidget:
|
||||
c = Vertical(self.drawingShape, 0, self.drawingShape, 1)
|
||||
self.drawingConstraints['hv'] = c
|
||||
else:
|
||||
if 'hv' in self.drawingConstraints:
|
||||
del self.drawingConstraints['hv']
|
||||
self.drawingConstraints['hv'] = None
|
||||
self.drawingShape.setPt(1, this_pt)
|
||||
self.queue_redraw()
|
||||
sp = self.get_closest_snap_ptref(x, y)
|
||||
self.update_hover_snap_point(sp)
|
||||
|
||||
def do_circle_left_click(self, x, y):
|
||||
pt = self.screenPtToPt((x, self.size[1] - y))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user