graphics/GraphicCommons.py
changeset 1258 441f31474b50
parent 1226 93e7a8abce5e
child 1377 cc8f9177d41c
equal deleted inserted replaced
1257:4b7ef7ea318f 1258:441f31474b50
   502     # Method called when a Motion event have been generated
   502     # Method called when a Motion event have been generated
   503     def OnMotion(self, event, dc, scaling):
   503     def OnMotion(self, event, dc, scaling):
   504         # If the cursor is dragging and the element have been clicked
   504         # If the cursor is dragging and the element have been clicked
   505         if event.Dragging() and self.oldPos:
   505         if event.Dragging() and self.oldPos:
   506             # Calculate the movement of cursor
   506             # Calculate the movement of cursor
   507             pos = event.GetLogicalPosition(dc)
   507             pos = GetScaledEventPosition(event, dc, scaling)
   508             movex = pos.x - self.oldPos.x
   508             movex = pos.x - self.oldPos.x
   509             movey = pos.y - self.oldPos.y
   509             movey = pos.y - self.oldPos.y
   510             # If movement is greater than MIN_MOVE then a dragging is initiated
   510             # If movement is greater than MIN_MOVE then a dragging is initiated
   511             if not self.Dragging and (abs(movex) > MIN_MOVE or abs(movey) > MIN_MOVE):
   511             if not self.Dragging and (abs(movex) > MIN_MOVE or abs(movey) > MIN_MOVE):
   512                 self.Dragging = True
   512                 self.Dragging = True