| 20 | else : self.plg.preview(ips, self.para) |
| 21 | |
| 22 | def mouse_move(self, ips, x, y, btn, **key): |
| 23 | lim = 5.0/key['canvas'].get_scale() |
| 24 | if btn==None: |
| 25 | self.cursor = wx.CURSOR_CROSS |
| 26 | if abs(x-self.para['ox'])<lim and abs(y-self.para['oy']<lim): |
| 27 | self.cursor = wx.CURSOR_HAND |
| 28 | elif self.moving: |
| 29 | self.para['ox'], self.para['oy'] = x, y |
| 30 | self.plg.dialog.reset() |
| 31 | ips.update() |
| 32 | else: |
| 33 | dx, dy = x-self.para['ox'], y-self.para['oy'] |
| 34 | ang = np.arccos(dx/np.sqrt(dx**2+dy**2)) |
| 35 | if dy<0: ang = np.pi*2-ang |
| 36 | ang = int(ang/np.pi*180) |
| 37 | self.para['ang'] = ang |
| 38 | self.plg.dialog.reset() |
| 39 | ips.update() |
| 40 | |
| 41 | class Plugin(Filter): |
| 42 | """RotateTool class plugin derived from imagepy.core.engine.Filter""" |