MCPcopy Create free account
hub / github.com/Image-Py/imagepy / mouse_down

Method mouse_down

imagepy/tools/Measure/coordinate_tol.py:64–81  ·  view source on GitHub ↗
(self, ips, x, y, btn, **key)

Source from the content-addressed store, hash-verified

62 self.odx, self.ody = 0, 0
63
64 def mouse_down(self, ips, x, y, btn, **key):
65 if key['ctrl'] and key['alt']:
66 if isinstance(ips.mark, Coordinate):
67 ips.mark.report(ips.title)
68 return
69 lim = 5.0/key['canvas'].get_scale()
70 if btn==1:
71 if isinstance(ips.mark, Coordinate):
72 self.curobj = ips.mark.pick(x, y, lim)
73 if self.curobj!=None:return
74 if not isinstance(ips.mark, Coordinate):
75 ips.mark = Coordinate(unit=ips.unit)
76 elif not key['shift']:
77 ips.mark = Coordinate(unit=ips.unit)
78 ips.mark.add((x,y))
79 self.curobj = ips.mark.pick(x,y, lim)
80 ips.update()
81 self.odx, self.ody = x, y
82
83 def mouse_up(self, ips, x, y, btn, **key):
84 self.curobj = None

Callers

nothing calls this directly

Calls 6

CoordinateClass · 0.85
get_scaleMethod · 0.80
reportMethod · 0.45
pickMethod · 0.45
addMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected