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()
|
self.queue_redraw()
|
||||||
|
|
||||||
def do_line_motion(self, x, y):
|
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:
|
if self.drawingShape is not None:
|
||||||
this_pt = self.screenPtToPt((x, self.size[1] - y))
|
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)
|
start = self.drawingShape.getPt(0)
|
||||||
angle = math.atan2(this_pt[1] - start[1], this_pt[0] - start[0])
|
angle = math.atan2(this_pt[1] - start[1], this_pt[0] - start[0])
|
||||||
angle *= 180.0 / math.pi
|
angle *= 180.0 / math.pi
|
||||||
@ -430,7 +436,8 @@ class SketchWidget:
|
|||||||
if not ('hv' in self.drawingConstraints
|
if not ('hv' in self.drawingConstraints
|
||||||
and isinstance(self.drawingConstraints['hv'],
|
and isinstance(self.drawingConstraints['hv'],
|
||||||
Horizontal)):
|
Horizontal)):
|
||||||
c = Horizontal(self.drawingShape, 0, self.drawingShape, 1)
|
c = Horizontal(
|
||||||
|
self.drawingShape, 0, self.drawingShape, 1)
|
||||||
self.drawingConstraints['hv'] = c
|
self.drawingConstraints['hv'] = c
|
||||||
elif ((snaps_to(-90) or snaps_to(90))
|
elif ((snaps_to(-90) or snaps_to(90))
|
||||||
and within(start[0], this_pt[0], hv_snap_dist)):
|
and within(start[0], this_pt[0], hv_snap_dist)):
|
||||||
@ -441,12 +448,9 @@ class SketchWidget:
|
|||||||
c = Vertical(self.drawingShape, 0, self.drawingShape, 1)
|
c = Vertical(self.drawingShape, 0, self.drawingShape, 1)
|
||||||
self.drawingConstraints['hv'] = c
|
self.drawingConstraints['hv'] = c
|
||||||
else:
|
else:
|
||||||
if 'hv' in self.drawingConstraints:
|
self.drawingConstraints['hv'] = None
|
||||||
del self.drawingConstraints['hv']
|
|
||||||
self.drawingShape.setPt(1, this_pt)
|
self.drawingShape.setPt(1, this_pt)
|
||||||
self.queue_redraw()
|
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):
|
def do_circle_left_click(self, x, y):
|
||||||
pt = self.screenPtToPt((x, self.size[1] - y))
|
pt = self.screenPtToPt((x, self.size[1] - y))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user