mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 07:40:22 +01:00
TreeNode: Made clicking on arrow toggle toggle the open state on the Mouse Down event. Amend 05420ea2c
.
This commit is contained in:
parent
97dad66516
commit
9b50e691ed
@ -45,6 +45,10 @@ Other Changes:
|
||||
where v_min == v_max. (#3361)
|
||||
- BeginMenuBar: Fixed minor bug where CursorPosMax gets pushed to CursorPos prior to calling BeginMenuBar(),
|
||||
so e.g. calling the function at the end of a window would often add +ItemSpacing.y to scrolling range.
|
||||
- TreeNode, CollapsingHeader: Made clicking on arrow toggle toggle the open state on the Mouse Down event
|
||||
rather than the Mouse Down+Up sequence, even if the _OpenOnArrow flag isn't set. This is standard behavior
|
||||
and amends the change done in 1.76 which only affected cases were _OpenOnArrow flag was set.
|
||||
(This is also necessary to support full multi/range-select/drag and drop operations.)
|
||||
- Metrics: Various tweaks, listing windows front-to-back, greying inactive items when possible.
|
||||
- Demo: Add simple InputText() callbacks demo (aside from the more elaborate ones in 'Examples->Console').
|
||||
|
||||
|
2
imgui.h
2
imgui.h
@ -60,7 +60,7 @@ Index of this file:
|
||||
// Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||
#define IMGUI_VERSION "1.79 WIP"
|
||||
#define IMGUI_VERSION_NUM 17802
|
||||
#define IMGUI_VERSION_NUM 17803
|
||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||
|
||||
// Define attributes of all API symbols declarations (e.g. for DLL under Windows)
|
||||
|
@ -5644,17 +5644,14 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
||||
|
||||
// Open behaviors can be altered with the _OpenOnArrow and _OnOnDoubleClick flags.
|
||||
// Some alteration have subtle effects (e.g. toggle on MouseUp vs MouseDown events) due to requirements for multi-selection and drag and drop support.
|
||||
// - Single-click on label = Toggle on MouseUp (default)
|
||||
// - Single-click on arrow = Toggle on MouseUp (when _OpenOnArrow=0)
|
||||
// - Single-click on label = Toggle on MouseUp (default, when _OpenOnArrow=0)
|
||||
// - Single-click on arrow = Toggle on MouseDown (when _OpenOnArrow=0)
|
||||
// - Single-click on arrow = Toggle on MouseDown (when _OpenOnArrow=1)
|
||||
// - Double-click on label = Toggle on MouseDoubleClick (when _OpenOnDoubleClick=1)
|
||||
// - Double-click on arrow = Toggle on MouseDoubleClick (when _OpenOnDoubleClick=1 and _OpenOnArrow=0)
|
||||
// This makes _OpenOnArrow have a subtle effect on _OpenOnDoubleClick: arrow click reacts on Down rather than Up.
|
||||
// It is rather standard that arrow click react on Down rather than Up and we'd be tempted to make it the default
|
||||
// (by removing the _OpenOnArrow test below), however this would have a perhaps surprising effect on CollapsingHeader()?
|
||||
// So right now we are making this optional. May evolve later.
|
||||
// It is rather standard that arrow click react on Down rather than Up.
|
||||
// We set ImGuiButtonFlags_PressedOnClickRelease on OpenOnDoubleClick because we want the item to be active on the initial MouseDown in order for drag and drop to work.
|
||||
if (is_mouse_x_over_arrow && (flags & ImGuiTreeNodeFlags_OpenOnArrow))
|
||||
if (is_mouse_x_over_arrow)
|
||||
button_flags |= ImGuiButtonFlags_PressedOnClick;
|
||||
else if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
|
||||
button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick;
|
||||
|
Loading…
Reference in New Issue
Block a user