Inputs: SetItemKeyOwner(): does not set ownership is key is already taken.
(#456, #2637, #2620, #2891, #3370, #3724, #4828, #5108, #5242, #5641)
This commit is contained in:
@@ -156,6 +156,10 @@ Other Changes:
|
|||||||
- SetItemKeyOwner(): return true if ownership has been requested, which typically
|
- SetItemKeyOwner(): return true if ownership has been requested, which typically
|
||||||
needs to to checked for gating further tests. This is important as the function
|
needs to to checked for gating further tests. This is important as the function
|
||||||
may fail. (#456, #2637, #2620, #2891, #3370, #3724, #4828, #5108, #5242, #5641)
|
may fail. (#456, #2637, #2620, #2891, #3370, #3724, #4828, #5108, #5242, #5641)
|
||||||
|
- SetItemKeyOwner(): does not set ownership is key is already taken. Effectively
|
||||||
|
this makes using `SetItemKeyOwner(ImGuiKey_MouseWheelY)` over an item work as
|
||||||
|
expected while not having item react if a scroll wheel is actively in progress.
|
||||||
|
May be subject to further redesign, e.g. conditional flags. Feedback welcome!
|
||||||
- Style:
|
- Style:
|
||||||
- Fixed vertical scrollbar top coordinates when using thick borders on windows
|
- Fixed vertical scrollbar top coordinates when using thick borders on windows
|
||||||
with no title bar and no menu bar. (#9366)
|
with no title bar and no menu bar. (#9366)
|
||||||
|
|||||||
@@ -10726,6 +10726,8 @@ bool ImGui::SetItemKeyOwner(ImGuiKey key, ImGuiInputFlags flags)
|
|||||||
if ((g.HoveredId == id && (flags & ImGuiInputFlags_CondHovered)) || (g.ActiveId == id && (flags & ImGuiInputFlags_CondActive)))
|
if ((g.HoveredId == id && (flags & ImGuiInputFlags_CondHovered)) || (g.ActiveId == id && (flags & ImGuiInputFlags_CondActive)))
|
||||||
{
|
{
|
||||||
IM_ASSERT((flags & ~ImGuiInputFlags_SupportedBySetItemKeyOwner) == 0); // Passing flags not supported by this function!
|
IM_ASSERT((flags & ~ImGuiInputFlags_SupportedBySetItemKeyOwner) == 0); // Passing flags not supported by this function!
|
||||||
|
if (!TestKeyOwner(key, id))
|
||||||
|
return false;
|
||||||
SetKeyOwner(key, id, flags & ~ImGuiInputFlags_CondMask_);
|
SetKeyOwner(key, id, flags & ~ImGuiInputFlags_CondMask_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -875,7 +875,7 @@ static void ExampleImageViewer_DrawCanvas(ExampleImageViewerData* data, ImVec2 c
|
|||||||
data->ViewReset = false;
|
data->ViewReset = false;
|
||||||
|
|
||||||
// Handle inputs
|
// Handle inputs
|
||||||
if (ImGui::SetItemKeyOwner(ImGuiKey_MouseWheelY)) // FIXME: Not while scrolling?
|
if (ImGui::SetItemKeyOwner(ImGuiKey_MouseWheelY))
|
||||||
if (io.MouseWheel != 0.0f)
|
if (io.MouseWheel != 0.0f)
|
||||||
data->Zoom = IM_CLAMP(data->Zoom * (1.0f + io.MouseWheel * 0.10f), data->ZoomMin, data->ZoomMax);
|
data->Zoom = IM_CLAMP(data->Zoom * (1.0f + io.MouseWheel * 0.10f), data->ZoomMin, data->ZoomMax);
|
||||||
float zoom = data->Zoom; // (float)(int)ViewZoom;
|
float zoom = data->Zoom; // (float)(int)ViewZoom;
|
||||||
|
|||||||
Reference in New Issue
Block a user