| 10796 | } |
| 10797 | |
| 10798 | static ImVec2 ImGui::NavCalcPreferredRefPos() |
| 10799 | { |
| 10800 | ImGuiContext& g = *GImGui; |
| 10801 | ImGuiWindow* window = g.NavWindow; |
| 10802 | if (g.NavDisableHighlight || !g.NavDisableMouseHover || !window) |
| 10803 | { |
| 10804 | // Mouse (we need a fallback in case the mouse becomes invalid after being used) |
| 10805 | // The +1.0f offset when stored by OpenPopupEx() allows reopening this or another popup (same or another mouse button) while not moving the mouse, it is pretty standard. |
| 10806 | // In theory we could move that +1.0f offset in OpenPopupEx() |
| 10807 | ImVec2 p = IsMousePosValid(&g.IO.MousePos) ? g.IO.MousePos : g.MouseLastValidPos; |
| 10808 | return ImVec2(p.x + 1.0f, p.y); |
| 10809 | } |
| 10810 | else |
| 10811 | { |
| 10812 | // When navigation is active and mouse is disabled, pick a position around the bottom left of the currently navigated item |
| 10813 | // Take account of upcoming scrolling (maybe set mouse pos should be done in EndFrame?) |
| 10814 | ImRect rect_rel = WindowRectRelToAbs(window, window->NavRectRel[g.NavLayer]); |
| 10815 | if (window->LastFrameActive != g.FrameCount && (window->ScrollTarget.x != FLT_MAX || window->ScrollTarget.y != FLT_MAX)) |
| 10816 | { |
| 10817 | ImVec2 next_scroll = CalcNextScrollFromScrollTargetAndClamp(window); |
| 10818 | rect_rel.Translate(window->Scroll - next_scroll); |
| 10819 | } |
| 10820 | ImVec2 pos = ImVec2(rect_rel.Min.x + ImMin(g.Style.FramePadding.x * 4, rect_rel.GetWidth()), rect_rel.Max.y - ImMin(g.Style.FramePadding.y, rect_rel.GetHeight())); |
| 10821 | ImGuiViewport* viewport = GetMainViewport(); |
| 10822 | return ImFloor(ImClamp(pos, viewport->Pos, viewport->Pos + viewport->Size)); // ImFloor() is important because non-integer mouse position application in backend might be lossy and result in undesirable non-zero delta. |
| 10823 | } |
| 10824 | } |
| 10825 | |
| 10826 | float ImGui::GetNavTweakPressedAmount(ImGuiAxis axis) |
| 10827 | { |
nothing calls this directly
no test coverage detected