Drag[en]gine Script Module DragonScript
1.23
|
Mouse listener scrolling widget using mouse dragging. More...
Classes | |
class | ScrollUpdater |
Frame updater to continue scrolling over time. More... | |
Public Member Functions | |
int | getAnchorHorizontal () |
Anchor horizontal model value for anchor position. More... | |
Point | getAnchorPosition () |
Anchor mouse position or null if not scrolling. More... | |
int | getAnchorVertical () |
Anchor vertical model value for anchor position. More... | |
float | getDeceleration () |
Velocity deceleration in pixels/second per second. More... | |
Point | getLastDisplacement () |
Last displacement in pixels. More... | |
Point | getLastPosition () |
Last position in pixels. More... | |
float | getVelocityHorizontal () |
Horizontal velocity in pixels per second. More... | |
float | getVelocityVertical () |
Vertical velocity in pixels per second. More... | |
Container | getWidget () |
Widget to scroll. More... | |
ScrollWidgetMouseListener | new (Container widget) |
Create mouse listener. More... | |
void | onButtonPress (MouseEvent event) |
Mouse button has been pressed. More... | |
void | onButtonRelease (MouseEvent event) |
Mouse button has been released. More... | |
void | onMouseMove (MouseEvent event) |
Mouse has moved. More... | |
void | setAnchorHorizontal (int value) |
Set anchor horizontal model value for anchor position. More... | |
void | setAnchorPosition (Point position) |
Set anchor mouse position or null if not scrolling. More... | |
void | setAnchorVertical (int value) |
Set anchor vertical model value for anchor position. More... | |
void | setDeceleration (float deceleration) |
Set velocity deceleration in pixels/second per second. More... | |
void | setLastDisplacement (Point displacement) |
Set last displacement in pixels. More... | |
void | setLastPosition (Point position) |
Set last position in pixels. More... | |
void | setVelocityHorizontal (float velocity) |
Set horizontal velocity in pixels per second. More... | |
void | setVelocityVertical (float velocity) |
Set vertical velocity in pixels per second. More... | |
void | updateScroll (float elapsed) |
Continue scrolling. More... | |
Public Member Functions inherited from Dragengine.Gui.Events.DefaultMouseListener | |
DefaultMouseListener | new () |
Create default mouse listener. More... | |
void | onMouseEnter (MouseEvent event) |
Mouse has entered widget. More... | |
void | onMouseLeave (MouseEvent event) |
Mouse has left widget. More... | |
void | onMouseWheel (MouseEvent event) |
Mouse wheel moved. More... | |
Protected Member Functions | |
void | startScrollUpdater () |
Start scroll updater. More... | |
void | stopScrollUpdater () |
Stop scroll updater. More... | |
Mouse listener scrolling widget using mouse dragging.
Supports continue scrolling with last drag velocity decelerating over time. This can be used to simplify larger scale scrolling by using fling type movement.
By default continue scrolling is disabled. To enabled continuous scrolling set the deceleration to a value larger than 0. Velocity is reduced by deceleration times elapsed time. Hence a value of 100 reduces velocity by 100 pixels/second every second. A good starting value for deceleration is 200.
int Dragengine.Gui.ScrollWidgetMouseListener.getAnchorHorizontal | ( | ) |
Anchor horizontal model value for anchor position.
Point Dragengine.Gui.ScrollWidgetMouseListener.getAnchorPosition | ( | ) |
Anchor mouse position or null if not scrolling.
int Dragengine.Gui.ScrollWidgetMouseListener.getAnchorVertical | ( | ) |
Anchor vertical model value for anchor position.
float Dragengine.Gui.ScrollWidgetMouseListener.getDeceleration | ( | ) |
Velocity deceleration in pixels/second per second.
Point Dragengine.Gui.ScrollWidgetMouseListener.getLastDisplacement | ( | ) |
Last displacement in pixels.
Point Dragengine.Gui.ScrollWidgetMouseListener.getLastPosition | ( | ) |
Last position in pixels.
float Dragengine.Gui.ScrollWidgetMouseListener.getVelocityHorizontal | ( | ) |
Horizontal velocity in pixels per second.
float Dragengine.Gui.ScrollWidgetMouseListener.getVelocityVertical | ( | ) |
Vertical velocity in pixels per second.
ScrollWidgetMouseListener Dragengine.Gui.ScrollWidgetMouseListener.new | ( | Container | widget | ) |
Create mouse listener.
void Dragengine.Gui.ScrollWidgetMouseListener.onButtonPress | ( | MouseEvent | event | ) |
Mouse button has been pressed.
Starts scrolling by moving the mouse.
Reimplemented from Dragengine.Gui.Events.DefaultMouseListener.
void Dragengine.Gui.ScrollWidgetMouseListener.onButtonRelease | ( | MouseEvent | event | ) |
Mouse button has been released.
Reimplemented from Dragengine.Gui.Events.DefaultMouseListener.
void Dragengine.Gui.ScrollWidgetMouseListener.onMouseMove | ( | MouseEvent | event | ) |
Mouse has moved.
Reimplemented from Dragengine.Gui.Events.DefaultMouseListener.
void Dragengine.Gui.ScrollWidgetMouseListener.setAnchorHorizontal | ( | int | value | ) |
Set anchor horizontal model value for anchor position.
void Dragengine.Gui.ScrollWidgetMouseListener.setAnchorPosition | ( | Point | position | ) |
Set anchor mouse position or null if not scrolling.
void Dragengine.Gui.ScrollWidgetMouseListener.setAnchorVertical | ( | int | value | ) |
Set anchor vertical model value for anchor position.
void Dragengine.Gui.ScrollWidgetMouseListener.setDeceleration | ( | float | deceleration | ) |
Set velocity deceleration in pixels/second per second.
A good starting value is 200. For weaker deceleration 100 is a good value.
void Dragengine.Gui.ScrollWidgetMouseListener.setLastDisplacement | ( | Point | displacement | ) |
Set last displacement in pixels.
void Dragengine.Gui.ScrollWidgetMouseListener.setLastPosition | ( | Point | position | ) |
Set last position in pixels.
void Dragengine.Gui.ScrollWidgetMouseListener.setVelocityHorizontal | ( | float | velocity | ) |
Set horizontal velocity in pixels per second.
void Dragengine.Gui.ScrollWidgetMouseListener.setVelocityVertical | ( | float | velocity | ) |
Set vertical velocity in pixels per second.
|
protected |
Start scroll updater.
|
protected |
Stop scroll updater.
void Dragengine.Gui.ScrollWidgetMouseListener.updateScroll | ( | float | elapsed | ) |
Continue scrolling.
Reduces velocity from 0 to pContinueScrollTime using quadratic regression of the elapsed time then scrolls accordingly. Once pContinueScrollTime elapsed continue scrolling is disabled.