mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-23 23:31:08 +01:00
InvisibleButton: disable navigation properly + added ImGuiButtonFlags_EnableNav to enable navigation. (#8057)
This commit is contained in:
parent
971d243a87
commit
67e5f3505d
@ -73,7 +73,10 @@ Other changes:
|
||||
- Nav: fixed Ctrl+Tab so when starting with no focused window it starts from the top-most
|
||||
window. (#3200)
|
||||
- Nav: rectangle highlight not rendered for items with ImGuiItemFlags_NoNav. Can be relevant
|
||||
when e.g activating the item with mouse, then ctrl+tabbing back and forth.
|
||||
when e.g activating the item with mouse, then Ctrl+Tabbing back and forth.
|
||||
- InvisibleButton, Nav: fixed an issue when InvisibleButton() would be navigable into but
|
||||
not display navigation highlight. Properly navigation on it by default. (#8057)
|
||||
- InvisibleButton: added ImGuiButtonFlags_EnableNav to enable navigation. (#8057)
|
||||
- Tooltips: fixed incorrect tooltip positioning when using keyboard/gamepad navigation
|
||||
(1.91.3 regression). (#8036)
|
||||
- DrawList: AddCallback() added an optional size parameter allowing to copy and
|
||||
|
2
imgui.h
2
imgui.h
@ -1744,7 +1744,7 @@ enum ImGuiButtonFlags_
|
||||
ImGuiButtonFlags_MouseButtonRight = 1 << 1, // React on right mouse button
|
||||
ImGuiButtonFlags_MouseButtonMiddle = 1 << 2, // React on center mouse button
|
||||
ImGuiButtonFlags_MouseButtonMask_ = ImGuiButtonFlags_MouseButtonLeft | ImGuiButtonFlags_MouseButtonRight | ImGuiButtonFlags_MouseButtonMiddle, // [Internal]
|
||||
//ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft,
|
||||
ImGuiButtonFlags_EnableNav = 1 << 3, // InvisibleButton(): do not disable navigation/tabbing. Otherwise disabled by default.
|
||||
};
|
||||
|
||||
// Flags for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton()
|
||||
|
@ -947,7 +947,7 @@ enum ImGuiSelectableFlagsPrivate_
|
||||
enum ImGuiTreeNodeFlagsPrivate_
|
||||
{
|
||||
ImGuiTreeNodeFlags_ClipLabelForTrailingButton = 1 << 28,// FIXME-WIP: Hard-coded for CollapsingHeader()
|
||||
ImGuiTreeNodeFlags_UpsideDownArrow = 1 << 29,// FIXME-WIP: Turn Down arrow into an Up arrow, but reversed trees (#6517)
|
||||
ImGuiTreeNodeFlags_UpsideDownArrow = 1 << 29,// FIXME-WIP: Turn Down arrow into an Up arrow, for reversed trees (#6517)
|
||||
ImGuiTreeNodeFlags_OpenOnMask_ = ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_OpenOnArrow,
|
||||
};
|
||||
|
||||
|
@ -785,11 +785,12 @@ bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg, ImGuiBut
|
||||
ImVec2 size = CalcItemSize(size_arg, 0.0f, 0.0f);
|
||||
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
|
||||
ItemSize(size);
|
||||
if (!ItemAdd(bb, id))
|
||||
if (!ItemAdd(bb, id, NULL, (flags & ImGuiButtonFlags_EnableNav) ? ImGuiItemFlags_None : ImGuiItemFlags_NoNav))
|
||||
return false;
|
||||
|
||||
bool hovered, held;
|
||||
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
|
||||
RenderNavHighlight(bb, id);
|
||||
|
||||
IMGUI_TEST_ENGINE_ITEM_INFO(id, str_id, g.LastItemData.StatusFlags);
|
||||
return pressed;
|
||||
|
Loading…
Reference in New Issue
Block a user