def OnMotion(self, evt):
        # Ignore mouse movement if we're not dragging.
        if not self.dragNode or not evt.Dragging() or not evt.LeftIsDown():
            return

        # if we have a node, but haven't started dragging yet
        if self.dragNode and not self.dragImage:
            # only start the drag after having moved a couple pixels
            tolerance = 2
            pt = evt.GetPosition()
            dx = abs(pt.x - self.dragStartPos.x)
            dy = abs(pt.y - self.dragStartPos.y)
            if dx <= tolerance and dy <= tolerance:
                return

            # Create a DragImage to draw this node while it is moving
            # (The drag image will update even as the bitmap is updating.  Magical!) 
            self.dragImage = wx.DragImage(self.dragNode.bmp,
                wx.StockCursor(wx.CURSOR_HAND))
            hotspot = self.dragStartPos - self.dragNode.model.pos + [self.dragNode.node_radius, self.dragNode.node_radius]
            self.dragImage.BeginDrag(hotspot, self, False)
            self.dragImage.Move(pt)

            # erase the node since it will be drawn by the DragImage now
            dc = wx.ClientDC(self)   
            for link in self.dragNode.model.incoming.itervalues():
                if link not in self.link_dict: continue
                l = self.link_dict[link]
                l.Erase(dc)
                l.src.Draw(dc)
            for link in self.dragNode.model.outgoing.itervalues():
                if link not in self.link_dict: continue
                l = self.link_dict[link]
                l.Erase(dc)
                l.dst.Draw(dc)
            self.dragNode.Erase(dc)
            self.dragNode.dragging = True
            self.dragImage.Show()

        # if we have node and image then move it
        elif self.dragNode and self.dragImage:
            self.dragImage.Move(evt.GetPosition())