ConnectMode creates Connect object and re-solves sketch!
This commit is contained in:
parent
702aa1eaf8
commit
e0491b7b1a
@ -376,6 +376,7 @@ class SketchWidget(object):
|
||||
if c in self.cursors and c != self.cursor:
|
||||
self.cursor = c
|
||||
self.widget.window.set_cursor(self.cursors[c])
|
||||
self.mode.start_mode(self)
|
||||
|
||||
def cancel_drawing_shape(self):
|
||||
if self.drawingShape is not None:
|
||||
@ -480,7 +481,7 @@ class Mode(object):
|
||||
pass
|
||||
def do_motion(self, sw, x, y):
|
||||
pass
|
||||
def begin_mode(self, sw):
|
||||
def start_mode(self, sw):
|
||||
pass
|
||||
def end_mode(self, sw):
|
||||
pass
|
||||
@ -608,8 +609,24 @@ class CircleMode(Mode):
|
||||
return 'crosshair'
|
||||
|
||||
class ConnectMode(Mode):
|
||||
def start_mode(self, sw):
|
||||
self.first_ptref = None
|
||||
|
||||
def get_cursor(self):
|
||||
return 'crosshair'
|
||||
|
||||
def do_motion(self, sw, x, y):
|
||||
sw.update_hover_snap_point(x, y)
|
||||
|
||||
def do_left_click(self, sw, x, y):
|
||||
if sw.hover_snap_ptref is not None:
|
||||
if self.first_ptref is None:
|
||||
self.first_ptref = sw.hover_snap_ptref
|
||||
else:
|
||||
c = Connect(self.first_ptref.shape, self.first_ptref.ptNum,
|
||||
sw.hover_snap_ptref.shape, sw.hover_snap_ptref.ptNum)
|
||||
sw.sketch.constraints.append(c)
|
||||
sw.invalidate()
|
||||
|
||||
def do_right_click(self, sw, x, y):
|
||||
sw.window.set_mode('')
|
||||
|
Loading…
x
Reference in New Issue
Block a user