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

Method mouse_down

imagepy/tools/Standard/rectangle_tol.py:20–56  ·  view source on GitHub ↗
(self, ips, x, y, btn, **key)

Source from the content-addressed store, hash-verified

18 self.helper = Polygonbuf()
19
20 def mouse_down(self, ips, x, y, btn, **key):
21 lim = 5.0/key['canvas'].get_scale()
22 ips.mark = self.helper
23 if btn==1:
24 if not self.doing:
25 if ips.roi!= None:
26 self.curobj = ips.roi.pick(x, y, ips.cur, lim)
27 ips.roi.info(ips, self.curobj)
28 if not self.curobj in (None,True):return
29 self.oper = '+'
30 if ips.roi==None or not hasattr(ips.roi, 'topolygon'):
31 ips.roi = rectangleroi.RectangleRoi()
32 self.doing = True
33 ips.roi.lt, ips.roi.tp = x, y
34 ips.roi.rt, ips.roi.bm = x, y
35 self.curobj = 'rb'
36 self.odx, self.ody = x,y
37 elif hasattr(ips.roi, 'topolygon'):
38 self.odx, self.ody = x, y
39 self.ox, self.oy = x, y
40 if key['shift']:
41 ips.roi = ips.roi.topolygon()
42 self.oper,self.doing,self.curobj = '+',True,None
43 elif key['ctrl']:
44 ips.roi = ips.roi.topolygon()
45 self.oper,self.doing,self.curobj = '-',True,None
46 elif self.curobj: return
47 else:
48 ips.roi = rectangleroi.RectangleRoi()
49 self.doing = True
50 ips.roi.lt, ips.roi.tp = x, y
51 ips.roi.rt, ips.roi.bm = x, y
52 self.curobj = 'rb'
53 self.odx, self.ody = x,y
54 else: ips.roi = None
55
56 ips.update()
57
58 def mouse_up(self, ips, x, y, btn, **key):
59 if self.doing:

Callers

nothing calls this directly

Calls 5

get_scaleMethod · 0.80
pickMethod · 0.45
infoMethod · 0.45
topolygonMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected