mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 03:58:47 +02:00
Merge branch 'master' into docking
# Conflicts: # imgui.cpp
This commit is contained in:
@ -595,6 +595,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||
}
|
||||
}
|
||||
|
||||
// Process while held
|
||||
bool held = false;
|
||||
if (g.ActiveId == id)
|
||||
{
|
||||
@ -615,6 +616,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||
bool release_anywhere = (flags & ImGuiButtonFlags_PressedOnClickReleaseAnywhere) != 0;
|
||||
if ((release_in || release_anywhere) && !g.DragDropActive)
|
||||
{
|
||||
// Report as pressed when releasing the mouse (this is the most common path)
|
||||
bool is_double_click_release = (flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDownWasDoubleClick[mouse_button];
|
||||
bool is_repeating_already = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button] >= g.IO.KeyRepeatDelay; // Repeat mode trumps <on release>
|
||||
if (!is_double_click_release && !is_repeating_already)
|
||||
@ -627,6 +629,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||
}
|
||||
else if (g.ActiveIdSource == ImGuiInputSource_Nav)
|
||||
{
|
||||
// When activated using Nav, we hold on the ActiveID until activation button is released
|
||||
if (g.NavActivateDownId != id)
|
||||
ClearActiveID();
|
||||
}
|
||||
@ -682,7 +685,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
|
||||
|
||||
bool ImGui::Button(const char* label, const ImVec2& size_arg)
|
||||
{
|
||||
return ButtonEx(label, size_arg, 0);
|
||||
return ButtonEx(label, size_arg, ImGuiButtonFlags_None);
|
||||
}
|
||||
|
||||
// Small buttons fits within text without additional vertical spacing.
|
||||
@ -698,7 +701,7 @@ bool ImGui::SmallButton(const char* label)
|
||||
|
||||
// Tip: use ImGui::PushID()/PopID() to push indices or pointers in the ID stack.
|
||||
// Then you can keep 'str_id' empty or the same for all your buttons (instead of creating a string based on a non-string id)
|
||||
bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg)
|
||||
bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg, ImGuiButtonFlags flags)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
@ -715,7 +718,7 @@ bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg)
|
||||
return false;
|
||||
|
||||
bool hovered, held;
|
||||
bool pressed = ButtonBehavior(bb, id, &hovered, &held);
|
||||
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
Reference in New Issue
Block a user