MouseBehaviour
Many Behaviours are never interact with mouse presses, and if we checked every single Role when a mouse was pressed/released, this would be quite expensive (because to convert from screen coordinates to the Actor's local coordinates is non-trivial).
Therefore, when a mouse events, are only sent to Behaviours which also implement MouseBehaviour.
Properties
When set to false
onMouseClicked will NOT be called. In some cases, you may want to keep this value true
, even when the behaviour is inactive. For example, an inactive button may keep isMouseEnabled == true
, and inside onMouseClicked play a sound to indicate the click did nothing. In such cases, the return value from onMouseClicked should be true
, as the event has been handled.
Which implementation of Touching should be used for mouse events? The default is TouchingPixel.withinBoundsAndPixel.
Functions
A mouse-click has occurred. touchTest has already returned true
, so you can be sure that the click is near the Actor. Therefore, for a simple button, MouseEvent.local will be ignored. But for a slider
we want to know how far along the slider; in which case we will only be concerned with the x component for a horizontal slider.
Only ever called when MouseEvent.capture is called in a previous onMousePressed event.
Only ever called when MouseEvent.capture is called in a previous onMousePressed event.