mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Comments
This commit is contained in:
parent
0e775807b4
commit
d46772b429
@ -1860,7 +1860,7 @@ ImGuiID ImGuiWindow::GetIDNoKeepAlive(const char* str, const char* str_end)
|
|||||||
return ImHash(str, str_end ? (int)(str_end - str) : 0, seed);
|
return ImHash(str, str_end ? (int)(str_end - str) : 0, seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is particularly dodgy and used in extremely rare situation.
|
// This is only used in rare/specific situations to manufacture an ID out of nowhere.
|
||||||
ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)
|
ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)
|
||||||
{
|
{
|
||||||
ImGuiID seed = IDStack.back();
|
ImGuiID seed = IDStack.back();
|
||||||
@ -10628,10 +10628,9 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags, int mouse_button)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Magic fallback (=somehow reprehensible) to handle items with no assigned ID, e.g. Text(), Image().
|
// Magic fallback (=somehow reprehensible) to handle items with no assigned ID, e.g. Text(), Image()
|
||||||
// We build a throwaway ID based on current ID stack + relative AABB of items in window.
|
// We build a throwaway ID based on current ID stack + relative AABB of items in window.
|
||||||
// THE IDENTIFIER WON'T SURVIVE ANY REPOSITIONING OF THE WIDGET, so if your widget moves your dragging operation will be canceled.
|
// THE IDENTIFIER WON'T SURVIVE ANY REPOSITIONING OF THE WIDGET, so if your widget moves your dragging operation will be canceled.
|
||||||
// If you want fail-proof dragging,
|
|
||||||
// We don't need to maintain/call ClearActiveID() as releasing the button will early out this function and trigger !ActiveIdIsAlive.
|
// We don't need to maintain/call ClearActiveID() as releasing the button will early out this function and trigger !ActiveIdIsAlive.
|
||||||
bool is_hovered = window->DC.LastItemRectHoveredRect;
|
bool is_hovered = window->DC.LastItemRectHoveredRect;
|
||||||
if (!is_hovered && (g.ActiveId == 0 || g.ActiveIdWindow != window))
|
if (!is_hovered && (g.ActiveId == 0 || g.ActiveIdWindow != window))
|
||||||
|
Loading…
Reference in New Issue
Block a user