center_x_ratio: 0.0f left of last item, 0.5f horizontal center of last item, 1.0f right of last item.
| 10096 | |
| 10097 | // center_x_ratio: 0.0f left of last item, 0.5f horizontal center of last item, 1.0f right of last item. |
| 10098 | void ImGui::SetScrollHereX(float center_x_ratio) |
| 10099 | { |
| 10100 | ImGuiContext& g = *GImGui; |
| 10101 | ImGuiWindow* window = g.CurrentWindow; |
| 10102 | float spacing_x = ImMax(window->WindowPadding.x, g.Style.ItemSpacing.x); |
| 10103 | float target_pos_x = ImLerp(g.LastItemData.Rect.Min.x - spacing_x, g.LastItemData.Rect.Max.x + spacing_x, center_x_ratio); |
| 10104 | SetScrollFromPosX(window, target_pos_x - window->Pos.x, center_x_ratio); // Convert from absolute to local pos |
| 10105 | |
| 10106 | // Tweak: snap on edges when aiming at an item very close to the edge |
| 10107 | window->ScrollTargetEdgeSnapDist.x = ImMax(0.0f, window->WindowPadding.x - spacing_x); |
| 10108 | } |
| 10109 | |
| 10110 | // center_y_ratio: 0.0f top of last item, 0.5f vertical center of last item, 1.0f bottom of last item. |
| 10111 | void ImGui::SetScrollHereY(float center_y_ratio) |