MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / SetScrollHereX

Method SetScrollHereX

extern/imgui/imgui.cpp:10377–10387  ·  view source on GitHub ↗

center_x_ratio: 0.0f left of last item, 0.5f horizontal center of last item, 1.0f right of last item.

Source from the content-addressed store, hash-verified

10375
10376// center_x_ratio: 0.0f left of last item, 0.5f horizontal center of last item, 1.0f right of last item.
10377void ImGui::SetScrollHereX(float center_x_ratio)
10378{
10379 ImGuiContext& g = *GImGui;
10380 ImGuiWindow* window = g.CurrentWindow;
10381 float spacing_x = ImMax(window->WindowPadding.x, g.Style.ItemSpacing.x);
10382 float target_pos_x = ImLerp(g.LastItemData.Rect.Min.x - spacing_x, g.LastItemData.Rect.Max.x + spacing_x, center_x_ratio);
10383 SetScrollFromPosX(window, target_pos_x - window->Pos.x, center_x_ratio); // Convert from absolute to local pos
10384
10385 // Tweak: snap on edges when aiming at an item very close to the edge
10386 window->ScrollTargetEdgeSnapDist.x = ImMax(0.0f, window->WindowPadding.x - spacing_x);
10387}
10388
10389// center_y_ratio: 0.0f top of last item, 0.5f vertical center of last item, 1.0f bottom of last item.
10390void ImGui::SetScrollHereY(float center_y_ratio)

Callers

nothing calls this directly

Calls 2

ImMaxFunction · 0.85
ImLerpFunction · 0.85

Tested by

no test coverage detected