MCPcopy Create free account
hub / github.com/cinder/Cinder / CalcScrollEdgeSnap

Function CalcScrollEdgeSnap

src/imgui/imgui.cpp:11577–11584  ·  view source on GitHub ↗

Helper to snap on edges when aiming at an item very close to the edge, So the difference between WindowPadding and ItemSpacing will be in the visible area after scrolling. When we refactor the scrolling API this may be configurable with a flag? Note that the effect for this won't be visible on X axis with default Style settings as WindowPadding.x == ItemSpacing.x by default.

Source from the content-addressed store, hash-verified

11575// When we refactor the scrolling API this may be configurable with a flag?
11576// Note that the effect for this won't be visible on X axis with default Style settings as WindowPadding.x == ItemSpacing.x by default.
11577static float CalcScrollEdgeSnap(float target, float snap_min, float snap_max, float snap_threshold, float center_ratio)
11578{
11579 if (target <= snap_min + snap_threshold)
11580 return ImLerp(snap_min, target, center_ratio);
11581 if (target >= snap_max - snap_threshold)
11582 return ImLerp(target, snap_max, center_ratio);
11583 return target;
11584}
11585
11586static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window)
11587{

Calls 1

ImLerpFunction · 0.85

Tested by

no test coverage detected