Hey all,

I've created a dragging method but somehow the actor to be dragged moves
faster than the mouse coordinates received from the event. So basically the
following code executes fine but the actor moves faster than the mouse.
Anyone a suggestion? What am i doing wrong? I'm using pyclutter-1.0 on
ubuntu 9.10

    def do_drag (self, actor, event):

        if self._is_pressed == True:

            if (self._start_dragging == False):
                self._orig_mouse_x = event.x
                self._orig_mouse_y = event.y
                self._last_x = event.x
                self._last_y = event.y

            self._start_dragging = True
            self.emit('start_dragging')

            clutter.grab_pointer(self)

            new_x = event.x - self._last_x
            new_y = event.y - self._last_y

            if (event.x > self._last_x):
                print ("dragging right")
            if (event.y > self._last_y):
                print ("dragging down")
            if (event.x < self._last_x):
                print ("dragging left")
            if (event.y < self._last_y):
                print ("dragging up")

            actor.move_by(new_x, new_y)

            self._last_x = event.x
            self._last_y = event.y

            return True
        else:
            return False


Thanks, Thijs Thiessens

-- 
To unsubscribe send a mail to [email protected]

Reply via email to