mirror of
https://github.com/ocornut/imgui.git
synced 2026-02-01 17:44:33 +00:00
Nav: fixed speed scale for resizing/moving with keyboard/gamepad. (#323)
Fix 04157da29.
This commit is contained in:
@@ -172,6 +172,10 @@ Other Changes:
|
||||
- Fixed remote/shortcut InputText() not teleporting mouse cursor when
|
||||
nav cursor is visible and `io.ConfigNavMoveSetMousePos` is enabled.
|
||||
- Fixed a looping/wrapping issue when done in menu layer. (#9178)
|
||||
- Fixed speed scale for resizing/moving with keyboard/gamepad. We incorrectly
|
||||
used io.DisplayFramebufferScale (very old code), effectively making those
|
||||
actions faster on macOS/iOS retina screens.
|
||||
(changed this to use a style scale factor that's not fully formalized yet)
|
||||
- Scrollbar: fixed a codepath leading to a divide-by-zero (which would not be
|
||||
noticeable by user but detected by sanitizers). (#9089) [@judicaelclair]
|
||||
- InvisibleButton: allow calling with size (0,0) to fit to available content
|
||||
|
||||
@@ -7006,7 +7006,7 @@ static int ImGui::UpdateWindowManualResize(ImGuiWindow* window, int* border_hove
|
||||
if (nav_resize_dir.x != 0.0f || nav_resize_dir.y != 0.0f)
|
||||
{
|
||||
const float NAV_RESIZE_SPEED = 600.0f;
|
||||
const float resize_step = NAV_RESIZE_SPEED * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y);
|
||||
const float resize_step = NAV_RESIZE_SPEED * g.IO.DeltaTime * GetScale();
|
||||
g.NavWindowingAccumDeltaSize += nav_resize_dir * resize_step;
|
||||
g.NavWindowingAccumDeltaSize = ImMax(g.NavWindowingAccumDeltaSize, clamp_rect.Min - window->Pos - window->Size); // We need Pos+Size >= clmap_rect.Min, so Size >= clmap_rect.Min - Pos, so size_delta >= clmap_rect.Min - window->Pos - window->Size
|
||||
g.NavWindowingToggleLayer = false;
|
||||
@@ -14521,7 +14521,7 @@ static void ImGui::NavUpdateWindowing()
|
||||
if (nav_move_dir.x != 0.0f || nav_move_dir.y != 0.0f)
|
||||
{
|
||||
const float NAV_MOVE_SPEED = 800.0f;
|
||||
const float move_step = NAV_MOVE_SPEED * io.DeltaTime * ImMin(io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y);
|
||||
const float move_step = NAV_MOVE_SPEED * io.DeltaTime * GetScale();
|
||||
g.NavWindowingAccumDeltaPos += nav_move_dir * move_step;
|
||||
g.NavHighlightItemUnderNav = true;
|
||||
ImVec2 accum_floored = ImTrunc(g.NavWindowingAccumDeltaPos);
|
||||
|
||||
@@ -3150,6 +3150,7 @@ namespace ImGui
|
||||
// - You are calling ImGui functions after ImGui::EndFrame()/ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal.
|
||||
IMGUI_API ImGuiIO& GetIO(ImGuiContext* ctx);
|
||||
IMGUI_API ImGuiPlatformIO& GetPlatformIO(ImGuiContext* ctx);
|
||||
inline float GetScale() { ImGuiContext& g = *GImGui; return g.Style._MainScale; } // FIXME-DPI: I don't want to formalize this just yet. Because reasons. Please don't use.
|
||||
inline ImGuiWindow* GetCurrentWindowRead() { ImGuiContext& g = *GImGui; return g.CurrentWindow; }
|
||||
inline ImGuiWindow* GetCurrentWindow() { ImGuiContext& g = *GImGui; g.CurrentWindow->WriteAccessed = true; return g.CurrentWindow; }
|
||||
IMGUI_API ImGuiWindow* FindWindowByID(ImGuiID id);
|
||||
|
||||
Reference in New Issue
Block a user