rename snap_dist to hv_snap_dist
This commit is contained in:
parent
409783d01f
commit
ea43216f16
@ -30,7 +30,7 @@ class SketchWidget:
|
||||
self.axis_color = (1.0, 0.0, 0.0, 1.0)
|
||||
self.constraint_color = (0.8, 1.0, 0.0, 1.0)
|
||||
self.snap_angle = 10
|
||||
self.snap_dist = 10
|
||||
self.hv_snap_dist = 10
|
||||
|
||||
try:
|
||||
# try double-buffered
|
||||
@ -373,16 +373,16 @@ class SketchWidget:
|
||||
angle *= 180.0 / math.pi
|
||||
def within(a, b, d): return abs(a - b) < d
|
||||
def snaps_to(q): return within(angle, q, self.snap_angle)
|
||||
snap_dist = self.screenDistToDist(self.snap_dist)
|
||||
hv_snap_dist = self.screenDistToDist(self.hv_snap_dist)
|
||||
if ((snaps_to(-180) or snaps_to(180) or snaps_to(0))
|
||||
and within(start[1], this_pt[1], snap_dist)):
|
||||
and within(start[1], this_pt[1], hv_snap_dist)):
|
||||
this_pt = (this_pt[0], start[1])
|
||||
if not (len(self.drawingConstraints) > 0
|
||||
and isinstance(self.drawingConstraints[0], Horizontal)):
|
||||
c = Horizontal(self.drawingShape, 0, self.drawingShape, 1)
|
||||
self.drawingConstraints = [c]
|
||||
elif ((snaps_to(-90) or snaps_to(90))
|
||||
and within(start[0], this_pt[0], snap_dist)):
|
||||
and within(start[0], this_pt[0], hv_snap_dist)):
|
||||
this_pt = (start[0], this_pt[1])
|
||||
if not (len(self.drawingConstraints) > 0
|
||||
and isinstance(self.drawingConstraints[0], Vertical)):
|
||||
|
Loading…
x
Reference in New Issue
Block a user