createMouseDraggedEvent method

void createMouseDraggedEvent()

Creates a MouseDraggedEvent

  • when mouse pressed start dragging dragStartPosition is set to the cursor positon, isDragging is set to true and dragButton is set the current mouse button

  • when mouse released stop dragging isDragging is set to false

  • when mouse moved always set dragCurrentPosition to the current mouse position and only if isDragging is set to true, create and dispatch the event to onEvent

Implementation

void createMouseDraggedEvent() {
  var mousePos = dragCurrentPosition;
  var deltaPos = dragStartPosition - dragCurrentPosition;
  var button = mouseButton;

  onEvent(
    MouseDraggedEvent(
      button: button,
      mousePos: mousePos,
      deltaPos: deltaPos,
    ),
  );
}