X-Git-Url: https://svn.cri.ensmp.fr/git/minwii.git/blobdiff_plain/79aca379ed6dffa4d71d66f513a973d2e3470c5a..00c7d2ee288d92de01920b31c968ada18651d2a4:/src/minwii/widgets/cursors.py?ds=sidebyside diff --git a/src/minwii/widgets/cursors.py b/src/minwii/widgets/cursors.py index ad8f383..4edc2dc 100755 --- a/src/minwii/widgets/cursors.py +++ b/src/minwii/widgets/cursors.py @@ -48,6 +48,7 @@ class WarpingCursor(pygame.sprite.DirtySprite, EventHandlerMixin): self.duration = duration self.image = self.images[0] + self.pressed = False # workarround cursor alignement problem pygame.event.set_blocked(pygame.MOUSEMOTION) pygame.mouse.set_pos(pygame.mouse.get_pos()) @@ -91,6 +92,7 @@ class WarpingCursor(pygame.sprite.DirtySprite, EventHandlerMixin): self.dirty = 1 self._blinking = False self.image = self.flashImage + self.pressed = True @event_handler(pygame.MOUSEBUTTONUP) def flashOff(self, event) : @@ -99,11 +101,14 @@ class WarpingCursor(pygame.sprite.DirtySprite, EventHandlerMixin): self._blinking = True else : self.image = self.images[0] + self.pressed = False @event_handler(pygame.MOUSEMOTION) def move(self, event) : self.dirty = 1 - self.rect.move_ip(event.rel) + x, y = pygame.mouse.get_pos() + rel = (x - self.rect.centerx, y - self.rect.centery) + self.rect.move_ip(rel) def setPosition(self, pos) : self.dirty = 1 @@ -127,4 +132,4 @@ class ForeverTimer(Thread) : time.sleep(self.duration) def stop(self) : - self.running = False \ No newline at end of file + self.running = False