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

Method mouse_down

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

Source from the content-addressed store, hash-verified

96 self.doing = False
97
98 def mouse_down(self, ips, x, y, btn, **key):
99 if key['ctrl'] and key['alt']:
100 if isinstance(ips.mark, Area):
101 ips.mark.report(ips.title)
102 return
103
104 lim = 5.0/key['canvas'].get_scale()
105 if btn==1:
106 if not self.doing:
107 if isinstance(ips.mark, Area):
108 self.curobj = ips.mark.pick(x, y, lim)
109 if not self.curobj in (None,True):return
110 if not isinstance(ips.mark, Area):
111 ips.mark = Area(unit=ips.unit)
112 self.doing = True
113 elif isinstance(ips.mark, Area):
114 if key['shift']: self.oper,self.doing = '+',True
115 elif self.curobj: return
116 else: ips.mark=None
117 if self.doing:
118 ips.mark.addpoint((x,y))
119 self.curobj = (ips.mark.buf, -1)
120 self.odx, self.ody = x, y
121
122 elif btn==3:
123 if self.doing:
124 ips.mark.addpoint((x,y))
125 self.doing = False
126 ips.mark.commit()
127 ips.update()
128
129 def mouse_move(self, ips, x, y, btn, **key):
130 if not isinstance(ips.mark, Area):return

Callers

nothing calls this directly

Calls 7

get_scaleMethod · 0.80
AreaClass · 0.70
reportMethod · 0.45
pickMethod · 0.45
addpointMethod · 0.45
commitMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected