Murl::Logic::IScrollProcessor Interface Referenceabstract

The IScrollProcessor interface. More...

#include "murl_logic_i_scroll_processor.h"

Inherited by Murl::Logic::ScrollProcessor.

Public Member Functions

virtual IProcessorPtr GetProcessor ()=0
 Get the processor interface from a IScrollProcessor object. More...
 
Setup button

Methods to setup the button to track.

virtual void SetButtonId (const String &buttonId)=0
 Set the path and identifier of the button node to track. More...
 
virtual const StringGetButtonId () const =0
 Get the identifier of the button node to track. More...
 
virtual Bool SetButtonNode (Graph::INode *buttonNode)=0
 Set the button node to track. More...
 
virtual Graph::IButtonGetButtonNode () const =0
 Get the button node to track. More...
 
virtual Bool SetButtonEnabled (Bool isEnabled)=0
 Set enable or disable the button. More...
 
virtual Bool IsButtonEnabled () const =0
 Check if the button is enabled. More...
 
Setup input

Methods for controlling relative inputs.

virtual void SetDeadZode (const Vector &distances)=0
 Set the dead zone distances. More...
 
virtual const VectorGetDeadZone () const =0
 Get the minimum dead zone distances. More...
 
virtual void SetAccelerationFactor (Real accelerationFactor)=0
 Set the acceleration factor. More...
 
virtual Real GetAccelerationFactor () const =0
 Get the acceleration factor. More...
 
virtual void SetAccelerationTimeout (Real timeout)=0
 Set the acceleration timeout. More...
 
virtual Real GetAccelerationTimeout () const =0
 Get the acceleration timeout. More...
 
virtual Bool SetDecelerationFactor (Real decelerationFactor)=0
 Set the deceleration factor. More...
 
virtual Real GetDecelerationFactor () const =0
 Get the deceleration factor. More...
 
virtual void SetDecelerationTimeout (Real timeout)=0
 Set the deceleration timeout. More...
 
virtual Real GetDecelerationTimeout () const =0
 Get the deceleration timeout. More...
 
virtual void SetStopVelocity (Real stopVelocity)=0
 Set the deceleration stop velocity. More...
 
virtual Real GetStopVelocity () const =0
 Get the deceleration stop velocity. More...
 
virtual void SetMaxVelocity (Real maxVelocity)=0
 Set the maximum velocity. More...
 
virtual Real GetMaxVelocity () const =0
 Get the maximum velocity. More...
 
Current states

Methods for getting the current states.

virtual Bool IsActive () const =0
 Check if the ScrollProcessor is active. More...
 
virtual Bool IsOutsideDeadZone () const =0
 Check if the current movement is outside the dead zone. More...
 
virtual Bool IsButtonPressed () const =0
 Check if the graph button is tracked and pressed. More...
 
virtual Bool WasButtonReleased () const =0
 Check if the graph button was released. More...
 
virtual Bool WasButtonReleasedInsideDeadZone () const =0
 Check if the graph button was released inside the dead zone. More...
 
Movement controlling

Methods for controlling the current movement.

virtual const VectorGetMovement () const =0
 Get the recent movement. More...
 
virtual Bool BeginMovement (const IState *state)=0
 Begin setting the next movement. More...
 
virtual Bool EndMovement (const IState *state)=0
 End setting the next movement. More...
 
virtual Bool SetMovement (const Vector &delta)=0
 Set the next movement. More...
 
virtual void ResetMovement ()=0
 Reset the current movement including all current states.
 
Position tracking

Methods for position tracking.

Consider that the position tracking operates on vector data, which means that all 3 axis (x/y/z) are evaluated and should be setup correctly.

virtual void SetPositionEnabled (Bool isEnabled)=0
 Set enable or disable the position tracking. More...
 
virtual Bool IsPositionEnabled () const =0
 Check if the position tracking is enabled. More...
 
virtual void SetMinPosition (const Vector &position)=0
 Set the minimum position. More...
 
virtual const VectorGetMinPosition () const =0
 Get the minimum position. More...
 
virtual void SetMaxPosition (const Vector &position)=0
 Set the maximum position. More...
 
virtual const VectorGetMaxPosition () const =0
 Get the maximum position. More...
 
virtual void SetMinDampDistance (const Vector &distance)=0
 Set the damping distance for the minimum position. More...
 
virtual const VectorGetMinDampDistance () const =0
 Get the damping distance for the minimum position. More...
 
virtual void SetMaxDampDistance (const Vector &distance)=0
 Set the damping distance for the maximum position. More...
 
virtual const VectorGetMaxDampDistance () const =0
 Get the damping distance for the maximum position. More...
 
virtual void SetDampFactor (Real dampFactor)=0
 Set the damping factor. More...
 
virtual Real GetDampFactor () const =0
 Get the damping factor. More...
 
virtual void SetBounceTime (Real bounceTime)=0
 Set the bounce time. More...
 
virtual Real GetBounceTime () const =0
 Get the bounce time. More...
 
virtual void SetBounceInterpolation (IEnums::Interpolation interpolation)=0
 Set the bounce interpolation. More...
 
virtual IEnums::Interpolation GetBounceInterpolation () const =0
 Get the bounce interpolation. More...
 
virtual const VectorGetPosition () const =0
 Get the current position. More...
 
virtual void SetPosition (const Vector &position)=0
 Set the current position. More...
 
virtual Bool MoveToPosition (Real duration, const Vector &position, IEnums::Interpolation interpolation=IEnums::INTERPOLATION_EASE_IN_OUT)=0
 Start a position animation. More...
 
virtual Bool IsMoveToPositionRunning () const =0
 Check if the position animation is running. More...
 
virtual Bool WasMoveToPositionRunning () const =0
 Check if the position animation has stopped running. More...
 

Detailed Description

The IScrollProcessor interface.

The ScrollProcessor is used for tracking the inputs of a Graph::IButton node and/or any input provided by the user's logic code.
The ScrollProcessor is used for scroll areas and swipe gestures:

  • Tracking the relative movement of the input.
  • Performing a deceleration when the input is released.
  • Performing an acceleration when the input is repeated.

Additional a position tracking can be used for:

  • Tracking an absolute position.
  • Specifying minimum and maximum bounds.
  • Damping on the bounds.
  • Position animation.
    The ScrollProcessor operates in units of 1, which means the button size is 1 in x and y direction independent of the button's scalefactor.

All values used by the ScrollProcessor simply operates in units of 1. Scaling the results to adequate values applies to the user's logic code.

The ScrollProcessor implements an IProcessor which is typically attached as a child of an user defined logic processor.

Member Function Documentation

◆ GetProcessor()

virtual IProcessorPtr Murl::Logic::IScrollProcessor::GetProcessor ( )
pure virtual

Get the processor interface from a IScrollProcessor object.

The ScrollProcessor implements an IProcessor which is typically attached as a child of an user defined logic processor.

Returns
The processor interface shared pointer.

◆ SetButtonId()

virtual void Murl::Logic::IScrollProcessor::SetButtonId ( const String buttonId)
pure virtual

Set the path and identifier of the button node to track.

The button node can be set alternatively by using SetButtonNode().

Parameters
buttonIdThe full path and identifier to a button node.

◆ GetButtonId()

virtual const String& Murl::Logic::IScrollProcessor::GetButtonId ( ) const
pure virtual

Get the identifier of the button node to track.

The identifier contains the path and identifier set by SetButtonId(). If the button node is specified by SetButtonNode() the identifier contains the node identifer only without path.

Returns
The identifier of the button node.

◆ SetButtonNode()

virtual Bool Murl::Logic::IScrollProcessor::SetButtonNode ( Graph::INode buttonNode)
pure virtual

Set the button node to track.

The button node can be set alternatively by using SetButtonId().

Parameters
buttonNodeThe button node object.
Returns
true if successful, false if the node is invalid.

◆ GetButtonNode()

virtual Graph::IButton* Murl::Logic::IScrollProcessor::GetButtonNode ( ) const
pure virtual

Get the button node to track.

If the button node is specified by SetButtonId() the node is valid after Init() or at least one tick has been processed. If using SetButtonNode() the button node is available immediately.

Returns
The button node object.

◆ SetButtonEnabled()

virtual Bool Murl::Logic::IScrollProcessor::SetButtonEnabled ( Bool  isEnabled)
pure virtual

Set enable or disable the button.

Parameters
isEnabledtrue for enable, false for disable.
Returns
true if successful.

◆ IsButtonEnabled()

virtual Bool Murl::Logic::IScrollProcessor::IsButtonEnabled ( ) const
pure virtual

Check if the button is enabled.

Returns
true if the button is enabled.

◆ SetDeadZode()

virtual void Murl::Logic::IScrollProcessor::SetDeadZode ( const Vector distances)
pure virtual

Set the dead zone distances.

The dead zone distance specifies the minimum length of the input movement on the corresponding axis. This is useful to filter "short" movements when tapping on the button, use WasButtonReleasedInsideDeadZone(). The dead zone state is available by IsOutsideDeadZone() which is set to true if the input movement exceeds any of the dead zone minimum distances. If the minimum distance is <= 0.0 the corresponding axis is ignored. The deceleration/acceleration is applied only if the input movement is outside the dead zone.
The default value is Vector(0.01, 0.01, 0.01, 0.0) in units.

Parameters
distancesThe minimum input move distances in units.

◆ GetDeadZone()

virtual const Vector& Murl::Logic::IScrollProcessor::GetDeadZone ( ) const
pure virtual

Get the minimum dead zone distances.

Returns
The minimum dead zone distances in units.

◆ SetAccelerationFactor()

virtual void Murl::Logic::IScrollProcessor::SetAccelerationFactor ( Real  accelerationFactor)
pure virtual

Set the acceleration factor.

If an input is repeated within the acceleration timeout, the recent velocity of the previous input is multiplied by the acceleration factor and added to the current velocity.
The default value is 16.0.

Parameters
accelerationFactorThe acceleration factor.

◆ GetAccelerationFactor()

virtual Real Murl::Logic::IScrollProcessor::GetAccelerationFactor ( ) const
pure virtual

Get the acceleration factor.

Returns
The acceleration factor.

◆ SetAccelerationTimeout()

virtual void Murl::Logic::IScrollProcessor::SetAccelerationTimeout ( Real  timeout)
pure virtual

Set the acceleration timeout.

The acceleration is applied only if an input is repeated within the acceleration timeout.
The default value is 0.5 seconds.

Parameters
timeoutThe acceleration timeout in seconds.

◆ GetAccelerationTimeout()

virtual Real Murl::Logic::IScrollProcessor::GetAccelerationTimeout ( ) const
pure virtual

Get the acceleration timeout.

Returns
The acceleration timeout in seconds.

◆ SetDecelerationFactor()

virtual Bool Murl::Logic::IScrollProcessor::SetDecelerationFactor ( Real  decelerationFactor)
pure virtual

Set the deceleration factor.

The deceleration factor is multiplied to the recent movement when the input ends. The deceleration stops if the recent velocity underflows the stop velocity value.
The default value is 0.01.

Parameters
decelerationFactorThe deceleration factor per second must be < 1.
Returns
true if successful, false if decelerationFactor is >= 1.

◆ GetDecelerationFactor()

virtual Real Murl::Logic::IScrollProcessor::GetDecelerationFactor ( ) const
pure virtual

Get the deceleration factor.

Returns
The deceleration factor per second.

◆ SetDecelerationTimeout()

virtual void Murl::Logic::IScrollProcessor::SetDecelerationTimeout ( Real  timeout)
pure virtual

Set the deceleration timeout.

Inhibit deceleration if the time between the last and the recent movement exceeds the deceleration timeout.
The default value is 0.1 seconds.

Parameters
timeoutThe deceleration timeout in seconds.

◆ GetDecelerationTimeout()

virtual Real Murl::Logic::IScrollProcessor::GetDecelerationTimeout ( ) const
pure virtual

Get the deceleration timeout.

Returns
The deceleration timeout in seconds.

◆ SetStopVelocity()

virtual void Murl::Logic::IScrollProcessor::SetStopVelocity ( Real  stopVelocity)
pure virtual

Set the deceleration stop velocity.

The deceleration stops if the recent velocity underflows the stop velocity value.
The default value is 0.01 units/second.

Parameters
stopVelocityThe deceleration stop velocity value.

◆ GetStopVelocity()

virtual Real Murl::Logic::IScrollProcessor::GetStopVelocity ( ) const
pure virtual

Get the deceleration stop velocity.

Returns
The deceleration stop velocity in units/seconds.

◆ SetMaxVelocity()

virtual void Murl::Logic::IScrollProcessor::SetMaxVelocity ( Real  maxVelocity)
pure virtual

Set the maximum velocity.

The maximum velocity is the highest allowed velocity, which means the current velocity is clamped to the maximum velocity. The velocity is not clamped if the maximum velocity is 0.
The default value is 32.0 units/second.

Parameters
maxVelocityThe the maximum velocity in units/second.

◆ GetMaxVelocity()

virtual Real Murl::Logic::IScrollProcessor::GetMaxVelocity ( ) const
pure virtual

Get the maximum velocity.

Returns
The maximum velocity in units/second.

◆ IsActive()

virtual Bool Murl::Logic::IScrollProcessor::IsActive ( ) const
pure virtual

Check if the ScrollProcessor is active.

The ScrollProcessor is active if the graph button is pressed or the accleration/deceleration is active or the move animation is running.

Returns
true if the ScrollProcessor is active.

◆ IsOutsideDeadZone()

virtual Bool Murl::Logic::IScrollProcessor::IsOutsideDeadZone ( ) const
pure virtual

Check if the current movement is outside the dead zone.

This state reports also true if the deceleration is stopped by a tap, even if the tap's input is probably inside the dead zone. See also SetDeadZode().

Returns
true if the current movement is outside the dead zone.

◆ IsButtonPressed()

virtual Bool Murl::Logic::IScrollProcessor::IsButtonPressed ( ) const
pure virtual

Check if the graph button is tracked and pressed.

Returns
true if the graph button is pressed.

◆ WasButtonReleased()

virtual Bool Murl::Logic::IScrollProcessor::WasButtonReleased ( ) const
pure virtual

Check if the graph button was released.

Returns
true if the graph button was released.

◆ WasButtonReleasedInsideDeadZone()

virtual Bool Murl::Logic::IScrollProcessor::WasButtonReleasedInsideDeadZone ( ) const
pure virtual

Check if the graph button was released inside the dead zone.

Returns
true if the graph button was released inside the dead zone.

◆ GetMovement()

virtual const Vector& Murl::Logic::IScrollProcessor::GetMovement ( ) const
pure virtual

Get the recent movement.

The movement is set by the button input or the acceleration/deceleration or the move animation.

Returns
The movement vector in units of the recent tick.

◆ BeginMovement()

virtual Bool Murl::Logic::IScrollProcessor::BeginMovement ( const IState state)
pure virtual

Begin setting the next movement.

This method can be called optionally before applying custom movements using SetMovement(). This enables the deceleration/acceleration behaviour. The movement can be set only if the button is not pressed.

Parameters
stateThe IState object.
Returns
true if successful, false if the button is pressed.

◆ EndMovement()

virtual Bool Murl::Logic::IScrollProcessor::EndMovement ( const IState state)
pure virtual

End setting the next movement.

This method can be called optionally after applying custom movements using SetMovement(). This applies the deceleration/acceleration behaviour. The movement can be set only if the button is not pressed.

Parameters
stateThe IState object.
Returns
true if successful, false if the button is pressed.

◆ SetMovement()

virtual Bool Murl::Logic::IScrollProcessor::SetMovement ( const Vector delta)
pure virtual

Set the next movement.

Setting the movement sets the IsActive() state to true in the next tick. The movement can be set only if the button is not pressed. If the button is pressed during the next tick, the next movement is ignored. See also BeginMovement() and EndMovement().

Parameters
deltaThe movement vector in units for the next tick.
Returns
true if successful, false if the button is pressed.

◆ SetPositionEnabled()

virtual void Murl::Logic::IScrollProcessor::SetPositionEnabled ( Bool  isEnabled)
pure virtual

Set enable or disable the position tracking.

The position tracking can be disabled for implementing endless scrolling by using the relative movement methods only, typically GetMovement().
The default value is true.

Parameters
isEnabledtrue for enable, false for disable.

◆ IsPositionEnabled()

virtual Bool Murl::Logic::IScrollProcessor::IsPositionEnabled ( ) const
pure virtual

Check if the position tracking is enabled.

Returns
true if the position tracking is enabled.

◆ SetMinPosition()

virtual void Murl::Logic::IScrollProcessor::SetMinPosition ( const Vector position)
pure virtual

Set the minimum position.

The default value is Vector(0.0, 0.0, 0.0, 1.0).

Parameters
positionThe minimum position in units.

◆ GetMinPosition()

virtual const Vector& Murl::Logic::IScrollProcessor::GetMinPosition ( ) const
pure virtual

Get the minimum position.

Returns
The minimum position in units.

◆ SetMaxPosition()

virtual void Murl::Logic::IScrollProcessor::SetMaxPosition ( const Vector position)
pure virtual

Set the maximum position.

The default value is Vector(1.0, 1.0, 1.0, 1.0).

Parameters
positionThe maximum position in units.

◆ GetMaxPosition()

virtual const Vector& Murl::Logic::IScrollProcessor::GetMaxPosition ( ) const
pure virtual

Get the maximum position.

Returns
The maximum position in units.

◆ SetMinDampDistance()

virtual void Murl::Logic::IScrollProcessor::SetMinDampDistance ( const Vector distance)
pure virtual

Set the damping distance for the minimum position.

The damping distance specifies an extra minimum to converge to. The position range is (minimum position - minimum damping distance, minimum position].
The default value is Vector(0.5, 0.5, 0.5, 0.0).

Parameters
distanceThe damping distance for the minimum position in units.

◆ GetMinDampDistance()

virtual const Vector& Murl::Logic::IScrollProcessor::GetMinDampDistance ( ) const
pure virtual

Get the damping distance for the minimum position.

Returns
The damping distance for the minimum position in units.

◆ SetMaxDampDistance()

virtual void Murl::Logic::IScrollProcessor::SetMaxDampDistance ( const Vector distance)
pure virtual

Set the damping distance for the maximum position.

The damping distance specifies an extra maximum to converge to. The position range is [maximum position, maximum position + maximum damping distance).
The default value is Vector(0.5, 0.5, 0.5, 0.0).

Parameters
distanceThe damping distance for the maximum position in units.

◆ GetMaxDampDistance()

virtual const Vector& Murl::Logic::IScrollProcessor::GetMaxDampDistance ( ) const
pure virtual

Get the damping distance for the maximum position.

Returns
The damping distance for the maximum position in units.

◆ SetDampFactor()

virtual void Murl::Logic::IScrollProcessor::SetDampFactor ( Real  dampFactor)
pure virtual

Set the damping factor.

The higher the factor, the stronger is the damping (1 + 1 / (-x / f - 1)).
The default value is 1.0.

Parameters
dampFactorThe damping factor should be >= 1.0.

◆ GetDampFactor()

virtual Real Murl::Logic::IScrollProcessor::GetDampFactor ( ) const
pure virtual

Get the damping factor.

Returns
The damping factor.

◆ SetBounceTime()

virtual void Murl::Logic::IScrollProcessor::SetBounceTime ( Real  bounceTime)
pure virtual

Set the bounce time.

The bounce time is the duration to move back from the damping area to the minimum / maximum position.

Parameters
bounceTimeThe bounce time in seconds.

◆ GetBounceTime()

virtual Real Murl::Logic::IScrollProcessor::GetBounceTime ( ) const
pure virtual

Get the bounce time.

Returns
The bounce time in seconds.

◆ SetBounceInterpolation()

virtual void Murl::Logic::IScrollProcessor::SetBounceInterpolation ( IEnums::Interpolation  interpolation)
pure virtual

Set the bounce interpolation.

The bounce interpolation is applied when moving back from the damping area to the minimum / maximum position.

Parameters
interpolationThe bounce interpolation.

◆ GetBounceInterpolation()

virtual IEnums::Interpolation Murl::Logic::IScrollProcessor::GetBounceInterpolation ( ) const
pure virtual

Get the bounce interpolation.

Returns
The bounce interpolation.

◆ GetPosition()

virtual const Vector& Murl::Logic::IScrollProcessor::GetPosition ( ) const
pure virtual

Get the current position.

Returns
The current position in units.

◆ SetPosition()

virtual void Murl::Logic::IScrollProcessor::SetPosition ( const Vector position)
pure virtual

Set the current position.

If setting the position simply set the "real" position from input, this method calculates immediately the resulting damped position if necessary, use GetPosition() to get the resulting position.

Parameters
positionThe current position in units.

◆ MoveToPosition()

virtual Bool Murl::Logic::IScrollProcessor::MoveToPosition ( Real  duration,
const Vector position,
IEnums::Interpolation  interpolation = IEnums::INTERPOLATION_EASE_IN_OUT 
)
pure virtual

Start a position animation.

The position animation starts at the current position and and can be triggered only if the ScrollProcessor is not active.

Parameters
durationThe animation duration in seconds.
positionThe destination position in units.
interpolationThe interpolation type.
Returns
true if the animation was started successfully, false if the ScrollProcessor is already active.

◆ IsMoveToPositionRunning()

virtual Bool Murl::Logic::IScrollProcessor::IsMoveToPositionRunning ( ) const
pure virtual

Check if the position animation is running.

Returns
true if running.

◆ WasMoveToPositionRunning()

virtual Bool Murl::Logic::IScrollProcessor::WasMoveToPositionRunning ( ) const
pure virtual

Check if the position animation has stopped running.

If the animation is stopped, this state is true within the current logic tick only and will be cleared at the next logic tick.

Returns
true if stopped.

The documentation for this interface was generated from the following file:
  • murl_logic_i_scroll_processor.h


Copyright © 2011-2024 Spraylight GmbH.