Mouse Module

User experience

Mouse module supports following gestures:

  • dragging with left button pressed: rotates object around axis that is perpendicular to the mouse move direction and lays on screen place,
  • dragging with left and right buttons pressed: rotates object around axis perpendicular to the screen plane,
  • dragging with right mouse button: translates object over the screen plane.

Implementation

Mouse module is responsible for parsing and interpreting mouse events.

There are currently 4 event types:

  • Mouse::MoveEvent
  • Mouse::ActionEvent
  • Mouse::ToggleEvent
  • Mouse::WheelEvent

Each of them extends Mouse::Event abstract event.

Below is a complete grammar for all mouse events:

move-event = "move" state ;
action-event = action button state ;
toggle-event = toggle button state ;
wheel-event = "wheel" delta state ;

state = position buttons hover;

button = "left" | "right" | "middle" ;
buttons = button buttons ;
buttons = ;

delta = integer ;
action = "click" | "double-click" | "hover";
toggle = "up" | "down"
position = integer integer ;

The state nonterminal represents the current state of the mouse as after the event has occured, so if only left mouse button was pressed and then user has pressed right button, then following event is generated:

down right 50 200 left right

If the user clicks, then only click event should be sent:

click left 300 400