mirror of https://github.com/ocornut/imgui
Drag and Drop: moved "drag souce doesn't report as hovered" from ButtonBehavior() to ItemHoverable().
Ensure DragXXX, SliderXXXX, InputText, PlotXXX follow same logic. Amend251f178a6
,a33f0d1f7
This commit is contained in:
parent
a2f6581171
commit
d5d4d709c7
|
@ -75,6 +75,9 @@ Other changes:
|
|||
- Clipper: Rework inner logic to allow functioning with a zero-clear constructor.
|
||||
This is order to facilitate usage for language bindings (e.g cimgui or dear_binding)
|
||||
where user may not be callinga constructor manually. (#5856)
|
||||
- Drag and Drop: Apply default behavior of drag source not reporting itself as hovered
|
||||
at lower-level, so DragXXX, SliderXXX, InputXXX, Plot widgets are fullfilling it.
|
||||
(Behavior doesn't apply when ImGuiDragDropFlags_SourceNoDisableHover is set).
|
||||
- Modals: In the case of nested modal, made sure that focused or appearing windows are
|
||||
moved below the lowest blocking modal (rather than the highest one). (#4317)
|
||||
- GetKeyName(): Fixed assert with ImGuiMod_XXX values when IMGUI_DISABLE_OBSOLETE_KEYIO is set.
|
||||
|
|
|
@ -4050,6 +4050,10 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Drag source doesn't report as hovered
|
||||
if (g.DragDropActive && g.DragDropPayload.SourceId == id && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoDisableHover))
|
||||
return false;
|
||||
|
||||
// We exceptionally allow this function to be called with id==0 to allow using it for easy high-level
|
||||
// hover test in widgets code. We could also decide to split this function is two.
|
||||
if (id != 0)
|
||||
|
|
|
@ -506,10 +506,6 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||
bool pressed = false;
|
||||
bool hovered = ItemHoverable(bb, id);
|
||||
|
||||
// Drag source doesn't report as hovered
|
||||
if (hovered && g.DragDropActive && g.DragDropPayload.SourceId == id && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoDisableHover))
|
||||
hovered = false;
|
||||
|
||||
// Special mode for Drag and Drop where holding button pressed for a long time while dragging another item triggers the button
|
||||
if (g.DragDropActive && (flags & ImGuiButtonFlags_PressedOnDragDropHold) && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoHoldToOpenOthers))
|
||||
if (IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))
|
||||
|
|
Loading…
Reference in New Issue