mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
83ecc84was too not supporting widgets using ItemHoverable() directly + too complex. Revert83ecc84in ButtonBehavior(), reimplement in UpdateMouseMovingWindowEndFrame()>
This commit is contained in:
parent
04d9a04557
commit
706438a43c
2 changed files with 8 additions and 18 deletions
|
|
@ -542,8 +542,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||
|
||||
// Mouse handling
|
||||
const ImGuiID test_owner_id = (flags & ImGuiButtonFlags_NoTestKeyOwner) ? ImGuiKeyOwner_Any : id;
|
||||
const bool hovered_disabled = (g.HoveredId == id && g.HoveredIdIsDisabled);
|
||||
if (hovered || hovered_disabled)
|
||||
if (hovered)
|
||||
{
|
||||
IM_ASSERT(id != 0); // Lazily check inside rare path.
|
||||
|
||||
|
|
@ -561,7 +560,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||
|
||||
// Process initial action
|
||||
const bool mods_ok = !(flags & ImGuiButtonFlags_NoKeyModsAllowed) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt);
|
||||
if (mods_ok && !hovered_disabled)
|
||||
if (mods_ok)
|
||||
{
|
||||
if (mouse_button_clicked != -1 && g.ActiveId != id)
|
||||
{
|
||||
|
|
@ -619,17 +618,6 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||
if (g.IO.MouseDownDuration[g.ActiveIdMouseButton] > 0.0f && IsMouseClicked(g.ActiveIdMouseButton, ImGuiInputFlags_Repeat, test_owner_id))
|
||||
pressed = true;
|
||||
}
|
||||
else if (mods_ok && hovered_disabled)
|
||||
{
|
||||
if (mouse_button_clicked != -1 && g.ActiveId != id)
|
||||
{
|
||||
// Disabled path still focus
|
||||
// FIXME-NAV: Could somehow call SetNavID() with a null ID but mouse pos as NavRectRel so nav may be resumed?
|
||||
// Will do it once we do it for regular click on window-void.
|
||||
if (flags & (ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick))
|
||||
FocusWindow(window, ImGuiFocusRequestFlags_RestoreFocusedChild);
|
||||
}
|
||||
}
|
||||
|
||||
if (pressed)
|
||||
g.NavDisableHighlight = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue