center_y_ratio: 0.0f top of last item, 0.5f vertical center of last item, 1.0f bottom of last item.
| 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) |
| 10112 | { |
| 10113 | ImGuiContext& g = *GImGui; |
| 10114 | ImGuiWindow* window = g.CurrentWindow; |
| 10115 | float spacing_y = ImMax(window->WindowPadding.y, g.Style.ItemSpacing.y); |
| 10116 | float target_pos_y = ImLerp(window->DC.CursorPosPrevLine.y - spacing_y, window->DC.CursorPosPrevLine.y + window->DC.PrevLineSize.y + spacing_y, center_y_ratio); |
| 10117 | SetScrollFromPosY(window, target_pos_y - window->Pos.y, center_y_ratio); // Convert from absolute to local pos |
| 10118 | |
| 10119 | // Tweak: snap on edges when aiming at an item very close to the edge |
| 10120 | window->ScrollTargetEdgeSnapDist.y = ImMax(0.0f, window->WindowPadding.y - spacing_y); |
| 10121 | } |
| 10122 | |
| 10123 | //----------------------------------------------------------------------------- |
| 10124 | // [SECTION] TOOLTIPS |