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.
| 9441 | // When we refactor the scrolling API this may be configurable with a flag? |
| 9442 | // Note that the effect for this won't be visible on X axis with default Style settings as WindowPadding.x == ItemSpacing.x by default. |
| 9443 | static float CalcScrollEdgeSnap(float target, float snap_min, float snap_max, float snap_threshold, float center_ratio) |
| 9444 | { |
| 9445 | if (target <= snap_min + snap_threshold) |
| 9446 | return ImLerp(snap_min, target, center_ratio); |
| 9447 | if (target >= snap_max - snap_threshold) |
| 9448 | return ImLerp(target, snap_max, center_ratio); |
| 9449 | return target; |
| 9450 | } |
| 9451 | |
| 9452 | static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window) |
| 9453 | { |
no test coverage detected