Drag[en]gine Script Module DragonScript  1.21
Dragengine.Gui.ScrollWidgetMouseListener Class Reference

Mouse listener scrolling widget using mouse dragging. More...

Inheritance diagram for Dragengine.Gui.ScrollWidgetMouseListener:
Dragengine.Gui.Events.DefaultMouseListener Dragengine.Gui.Events.MouseListener

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...
 

Detailed Description

Mouse listener scrolling widget using mouse dragging.

Deceleration (1.16)

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.

Member Function Documentation

◆ getAnchorHorizontal()

int Dragengine.Gui.ScrollWidgetMouseListener.getAnchorHorizontal ( )

Anchor horizontal model value for anchor position.

◆ getAnchorPosition()

Point Dragengine.Gui.ScrollWidgetMouseListener.getAnchorPosition ( )

Anchor mouse position or null if not scrolling.

◆ getAnchorVertical()

int Dragengine.Gui.ScrollWidgetMouseListener.getAnchorVertical ( )

Anchor vertical model value for anchor position.

◆ getDeceleration()

float Dragengine.Gui.ScrollWidgetMouseListener.getDeceleration ( )

Velocity deceleration in pixels/second per second.

Version
1.16

◆ getLastDisplacement()

Point Dragengine.Gui.ScrollWidgetMouseListener.getLastDisplacement ( )

Last displacement in pixels.

Version
1.16

◆ getLastPosition()

Point Dragengine.Gui.ScrollWidgetMouseListener.getLastPosition ( )

Last position in pixels.

Version
1.16

◆ getVelocityHorizontal()

float Dragengine.Gui.ScrollWidgetMouseListener.getVelocityHorizontal ( )

Horizontal velocity in pixels per second.

Version
1.16

◆ getVelocityVertical()

float Dragengine.Gui.ScrollWidgetMouseListener.getVelocityVertical ( )

Vertical velocity in pixels per second.

Version
1.16

◆ getWidget()

Container Dragengine.Gui.ScrollWidgetMouseListener.getWidget ( )

Widget to scroll.

◆ new()

ScrollWidgetMouseListener Dragengine.Gui.ScrollWidgetMouseListener.new ( Container  widget)

Create mouse listener.

◆ onButtonPress()

void Dragengine.Gui.ScrollWidgetMouseListener.onButtonPress ( MouseEvent  event)

Mouse button has been pressed.

Starts scrolling by moving the mouse.

Reimplemented from Dragengine.Gui.Events.DefaultMouseListener.

◆ onButtonRelease()

void Dragengine.Gui.ScrollWidgetMouseListener.onButtonRelease ( MouseEvent  event)

Mouse button has been released.

Reimplemented from Dragengine.Gui.Events.DefaultMouseListener.

◆ onMouseMove()

void Dragengine.Gui.ScrollWidgetMouseListener.onMouseMove ( MouseEvent  event)

Mouse has moved.

Reimplemented from Dragengine.Gui.Events.DefaultMouseListener.

◆ setAnchorHorizontal()

void Dragengine.Gui.ScrollWidgetMouseListener.setAnchorHorizontal ( int  value)

Set anchor horizontal model value for anchor position.

◆ setAnchorPosition()

void Dragengine.Gui.ScrollWidgetMouseListener.setAnchorPosition ( Point  position)

Set anchor mouse position or null if not scrolling.

◆ setAnchorVertical()

void Dragengine.Gui.ScrollWidgetMouseListener.setAnchorVertical ( int  value)

Set anchor vertical model value for anchor position.

◆ setDeceleration()

void Dragengine.Gui.ScrollWidgetMouseListener.setDeceleration ( float  deceleration)

Set velocity deceleration in pixels/second per second.

Version
1.16

A good starting value is 200. For weaker deceleration 100 is a good value.

◆ setLastDisplacement()

void Dragengine.Gui.ScrollWidgetMouseListener.setLastDisplacement ( Point  displacement)

Set last displacement in pixels.

Version
1.16

◆ setLastPosition()

void Dragengine.Gui.ScrollWidgetMouseListener.setLastPosition ( Point  position)

Set last position in pixels.

Version
1.16

◆ setVelocityHorizontal()

void Dragengine.Gui.ScrollWidgetMouseListener.setVelocityHorizontal ( float  velocity)

Set horizontal velocity in pixels per second.

Version
1.16

◆ setVelocityVertical()

void Dragengine.Gui.ScrollWidgetMouseListener.setVelocityVertical ( float  velocity)

Set vertical velocity in pixels per second.

Version
1.16

◆ startScrollUpdater()

void Dragengine.Gui.ScrollWidgetMouseListener.startScrollUpdater ( )
protected

Start scroll updater.

Version
1.16

◆ stopScrollUpdater()

void Dragengine.Gui.ScrollWidgetMouseListener.stopScrollUpdater ( )
protected

Stop scroll updater.

Version
1.16

◆ updateScroll()

void Dragengine.Gui.ScrollWidgetMouseListener.updateScroll ( float  elapsed)

Continue scrolling.

Version
1.16

Reduces velocity from 0 to pContinueScrollTime using quadratic regression of the elapsed time then scrolls accordingly. Once pContinueScrollTime elapsed continue scrolling is disabled.


The documentation for this class was generated from the following file: