35 Vec2 offset{0.0f, 0.0f};
36 Vec2 maxScroll{0.0f, 0.0f};
37 Vec2 velocity{0.0f, 0.0f};
39 float dragStartMouseY{0.0f};
40 float dragStartOffsetY{0.0f};
41 float dragStartMouseX{0.0f};
42 float dragStartOffsetX{0.0f};
44 static constexpr float WHEEL_IMPULSE = 400.0f;
45 static constexpr float DECAY = 0.90f;
46 static constexpr float VELOCITY_MIN = 5.0f;
51 offset.x = std::clamp(offset.x, 0.0f, maxScroll.x);
52 offset.y = std::clamp(offset.y, 0.0f, maxScroll.y);
58 offset = {0.0f, 0.0f};
59 maxScroll = {0.0f, 0.0f};
60 velocity = {0.0f, 0.0f};
73 if (std::abs(velocity.x) > VELOCITY_MIN)
75 offset.x += velocity.x * dt;
76 velocity.x *= std::pow(DECAY, dt * 60.0f);
83 if (std::abs(velocity.y) > VELOCITY_MIN)
85 offset.y += velocity.y * dt;
86 velocity.y *= std::pow(DECAY, dt * 60.0f);
Small value types shared by the layout, rendering and input layers.
2D vector with component-wise arithmetic.
Definition CoreTypes.hpp:25