mirror of
https://github.com/ocornut/imgui.git
synced 2026-09-08 15:07:53 +00:00
Drags, Sliders: ongoing drags may be cancelled using Right-Mouse mouse button, reverting to the initial value. (#8564, #9534)
This commit is contained in:
@@ -55,8 +55,8 @@ Other Changes:
|
||||
- Drags, Sliders:
|
||||
- Fixed an overflow using `ImGuiSliderFlags_Logarithmic` with S32/S64 types which
|
||||
leads to clamped interactions. (#9526, #3361, #1823, #1316, #642) [@lailoken]
|
||||
- Ongoing drags may be cancelled using Escape or Gamepad Triangle, reverting
|
||||
to the initial value. (#8564, #9534)
|
||||
- Ongoing drags may be cancelled using right-mouse button, Escape, Gamepad Triangle.
|
||||
Cancelling reverts to the initial value. (#8564, #9534)
|
||||
- TreeNode:
|
||||
- Fixed issues/asserts with 32+ deep trees when using ImGuiTreeNodeFlags_DrawLinesXXX
|
||||
features or other features requiring stack storage. (#9509) [@lasrod]
|
||||
|
||||
@@ -12792,7 +12792,7 @@ bool ImGui::IsPopupOpenRequestForItem(ImGuiPopupFlags popup_flags, ImGuiID id)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiMouseButton mouse_button = GetMouseButtonFromPopupFlags(popup_flags);
|
||||
if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
||||
if (IsMouseReleased(mouse_button, id) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
||||
return true;
|
||||
if (g.NavOpenContextMenuItemId == id && (IsItemFocused() || id == g.CurrentWindow->MoveId))
|
||||
return true;
|
||||
@@ -12803,7 +12803,7 @@ bool ImGui::IsPopupOpenRequestForWindow(ImGuiPopupFlags popup_flags)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiMouseButton mouse_button = GetMouseButtonFromPopupFlags(popup_flags);
|
||||
if (IsMouseReleased(mouse_button) && IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
||||
if (IsMouseReleased(mouse_button, ImGuiKeyOwner_NoOwner) && IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
||||
if (!(popup_flags & ImGuiPopupFlags_NoOpenOverItems) || !IsAnyItemHovered())
|
||||
return true;
|
||||
if (g.NavOpenContextMenuWindowId && g.CurrentWindow->ID)
|
||||
@@ -12874,9 +12874,9 @@ bool ImGui::BeginPopupContextVoid(const char* str_id, ImGuiPopupFlags popup_flag
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
if (!str_id)
|
||||
str_id = "void_context";
|
||||
ImGuiID id = window->GetID(str_id);
|
||||
ImGuiID id = window->GetID(str_id); // FIXME: Use a global ID?
|
||||
ImGuiMouseButton mouse_button = GetMouseButtonFromPopupFlags(popup_flags);
|
||||
if (IsMouseReleased(mouse_button) && !IsWindowHovered(ImGuiHoveredFlags_AnyWindow))
|
||||
if (IsMouseReleased(mouse_button, id) && !IsWindowHovered(ImGuiHoveredFlags_AnyWindow))
|
||||
if (GetTopMostPopupModal() == NULL)
|
||||
OpenPopupEx(id, popup_flags);
|
||||
return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings);
|
||||
|
||||
@@ -2665,10 +2665,10 @@ static bool ShortcutsForCancel(ImGuiID id)
|
||||
ImGuiContext& g = *GImGui;
|
||||
bool is_cancel_with_keyboard = ImGui::Shortcut(ImGuiKey_Escape, ImGuiInputFlags_None, id);
|
||||
bool is_cancel_with_gamepad = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (g.IO.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0 && ImGui::Shortcut(ImGuiKey_NavGamepadCancel, ImGuiInputFlags_None, id);
|
||||
//bool is_cancel_with_mouse = ImGui::IsMouseClicked(ImGuiMouseButton_Right, ImGuiInputFlags_None, id);
|
||||
//if (is_cancel_with_mouse)
|
||||
// ImGui::SetKeyOwner(ImGuiKey_MouseRight, id);
|
||||
return is_cancel_with_keyboard || is_cancel_with_gamepad; //|| is_cancel_with_mouse
|
||||
bool is_cancel_with_mouse = ImGui::IsMouseReleased(ImGuiMouseButton_Right, id);
|
||||
if (is_cancel_with_mouse)
|
||||
ImGui::SetKeyOwner(ImGuiKey_MouseRight, id);
|
||||
return is_cancel_with_keyboard || is_cancel_with_gamepad || is_cancel_with_mouse;
|
||||
}
|
||||
|
||||
bool ImGui::DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags)
|
||||
|
||||
Reference in New Issue
Block a user