center_y_ratio: 0.0f top of last item, 0.5f vertical center of last item, 1.0f bottom of last item.
| 10388 | |
| 10389 | // center_y_ratio: 0.0f top of last item, 0.5f vertical center of last item, 1.0f bottom of last item. |
| 10390 | void ImGui::SetScrollHereY(float center_y_ratio) |
| 10391 | { |
| 10392 | ImGuiContext& g = *GImGui; |
| 10393 | ImGuiWindow* window = g.CurrentWindow; |
| 10394 | float spacing_y = ImMax(window->WindowPadding.y, g.Style.ItemSpacing.y); |
| 10395 | float target_pos_y = ImLerp(window->DC.CursorPosPrevLine.y - spacing_y, window->DC.CursorPosPrevLine.y + window->DC.PrevLineSize.y + spacing_y, center_y_ratio); |
| 10396 | SetScrollFromPosY(window, target_pos_y - window->Pos.y, center_y_ratio); // Convert from absolute to local pos |
| 10397 | |
| 10398 | // Tweak: snap on edges when aiming at an item very close to the edge |
| 10399 | window->ScrollTargetEdgeSnapDist.y = ImMax(0.0f, window->WindowPadding.y - spacing_y); |
| 10400 | } |
| 10401 | |
| 10402 | //----------------------------------------------------------------------------- |
| 10403 | // [SECTION] TOOLTIPS |