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

Method mouse_down

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

Source from the content-addressed store, hash-verified

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