blob: 318a20e51de8d4c7b719ae2cb697ca76e5c13cc1 [file] [log] [blame]
#include "rive/constraints/scrolling/clamped_scroll_physics.hpp"
#include "math.h"
using namespace rive;
Vec2D ClampedScrollPhysics::advance(float elapsedSeconds)
{
stop();
return m_value;
}
void ClampedScrollPhysics::run(Vec2D range,
Vec2D value,
std::vector<Vec2D> snappingPoints)
{
ScrollPhysics::run(range, value, snappingPoints);
m_value = clamp(range, value);
}
Vec2D ClampedScrollPhysics::clamp(Vec2D range, Vec2D value)
{
return Vec2D(math::clamp(value.x, range.x, 0),
math::clamp(value.y, range.y, 0));
}