JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::AnimatedPositionBehaviours::SnapToPageBoundaries Struct Reference

A behaviour that gravitates an AnimatedPosition object towards the nearest integer position when released. More...

#include <juce_AnimatedPositionBehaviours.h>

Collaboration diagram for juce::AnimatedPositionBehaviours::SnapToPageBoundaries:

Public Member Functions

 SnapToPageBoundaries ()=default
 
double getNextPosition (double oldPos, double elapsedSeconds) const noexcept
 Called by the AnimatedPosition class to get the new position, after the given time has elapsed. More...
 
bool isStopped (double position) const noexcept
 Called by the AnimatedPosition class to check whether the object is now stationary. More...
 
void releasedWithVelocity (double position, double releaseVelocity) noexcept
 Called by the AnimatedPosition class. More...
 

Private Attributes

double targetSnapPosition = 0.0
 

Detailed Description

A behaviour that gravitates an AnimatedPosition object towards the nearest integer position when released.

This class is intended to be used as a template parameter to the AnimatedPosition class. It's handy when using an AnimatedPosition to show a series of pages, because it allows the pages can be scrolled smoothly, but when released, snaps back to show a whole page.

See also
AnimatedPosition

@tags{GUI}

Constructor & Destructor Documentation

◆ SnapToPageBoundaries()

juce::AnimatedPositionBehaviours::SnapToPageBoundaries::SnapToPageBoundaries ( )
default

Member Function Documentation

◆ getNextPosition()

double juce::AnimatedPositionBehaviours::SnapToPageBoundaries::getNextPosition ( double  oldPos,
double  elapsedSeconds 
) const
inlinenoexcept

Called by the AnimatedPosition class to get the new position, after the given time has elapsed.

References isStopped(), and targetSnapPosition.

◆ isStopped()

bool juce::AnimatedPositionBehaviours::SnapToPageBoundaries::isStopped ( double  position) const
inlinenoexcept

Called by the AnimatedPosition class to check whether the object is now stationary.

References targetSnapPosition.

Referenced by getNextPosition().

◆ releasedWithVelocity()

void juce::AnimatedPositionBehaviours::SnapToPageBoundaries::releasedWithVelocity ( double  position,
double  releaseVelocity 
)
inlinenoexcept

Called by the AnimatedPosition class.

This tells us the position and velocity at which the user is about to release the object. The velocity is measured in units/second.

References targetSnapPosition.

Member Data Documentation

◆ targetSnapPosition

double juce::AnimatedPositionBehaviours::SnapToPageBoundaries::targetSnapPosition = 0.0
private

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