예제 #1
0
    def mouse_down(self, ips, x, y, btn, **key):
        lim = 5.0 / key['canvas'].get_scale()
        ips.mark = self.helper
        if btn == 1:
            if not self.doing:
                print(ips.roi)
                print(self.curobj)
                if ips.roi != None:
                    self.curobj = ips.roi.pick(x, y, lim)
                if self.curobj != None: return

                if ips.roi == None:
                    print(1)
                    ips.roi = lineroi.LineRoi()
                    self.doing = True
                elif ips.roi.dtype == 'line' and key['shift']:
                    print(2)
                    self.doing = True
                else:
                    ips.roi = None
            if self.doing:
                self.helper.addpoint((x, y))
                self.curobj = (self.helper.buf, -1)
                self.odx, self.ody = x, y

        elif btn == 3:
            if self.doing:
                self.helper.addpoint((x, y))
                self.doing = False
                ips.roi.addline(self.helper.pop())
        ips.update = True
예제 #2
0
 def mouse_down(self, ips, x, y, btn, **key):
     lim = 5.0/key['canvas'].get_scale()
     ips.mark = self.helper
     if btn==1:
         if not self.doing:
             if ips.roi!= None:
                 self.curobj = ips.roi.pick(x, y, lim)
             if self.curobj!=None:return
                 
             if ips.roi == None:
                 ips.roi = lineroi.LineRoi()
                 self.doing = True
             elif ips.roi.dtype=='line' and key['shift']:
                 self.doing = True
             else: ips.roi = None
         if self.doing:
             self.helper.addpoint((x,y))
             self.odx, self.ody = x,y