mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
Tab Bar: Keep tab item close button visible while dragging a tab (independent of hovering state).
Improve 08108cf
This commit is contained in:
parent
021c28ae39
commit
5919a6fa89
@ -49,7 +49,7 @@ Other Changes:
|
|||||||
rather than the Mouse Down+Up sequence, even if the _OpenOnArrow flag isn't set. This is standard behavior
|
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.
|
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.)
|
(This is also necessary to support full multi/range-select/drag and drop operations.)
|
||||||
- Tab Bar: Hide tab item close button while dragging a tab.
|
- Tab Bar: Keep tab item close button visible while dragging a tab (independent of hovering state).
|
||||||
- Metrics: Various tweaks, listing windows front-to-back, greying inactive items when possible.
|
- 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').
|
- Demo: Add simple InputText() callbacks demo (aside from the more elaborate ones in 'Examples->Console').
|
||||||
- Examples: Vulkan: Reworked buffer resize handling, fix for Linux/X11. (#3390, #2626) [@RoryO]
|
- Examples: Vulkan: Reworked buffer resize handling, fix for Linux/X11. (#3390, #2626) [@RoryO]
|
||||||
|
@ -7453,8 +7453,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
|||||||
SetItemAllowOverlap();
|
SetItemAllowOverlap();
|
||||||
|
|
||||||
// Drag and drop: re-order tabs
|
// Drag and drop: re-order tabs
|
||||||
const bool is_dragging = (held && !tab_appearing && IsMouseDragging(0));
|
if (held && !tab_appearing && IsMouseDragging(0))
|
||||||
if (is_dragging)
|
|
||||||
{
|
{
|
||||||
if (!g.DragDropActive && (tab_bar->Flags & ImGuiTabBarFlags_Reorderable))
|
if (!g.DragDropActive && (tab_bar->Flags & ImGuiTabBarFlags_Reorderable))
|
||||||
{
|
{
|
||||||
@ -7497,7 +7496,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
|||||||
flags |= ImGuiTabItemFlags_NoCloseWithMiddleMouseButton;
|
flags |= ImGuiTabItemFlags_NoCloseWithMiddleMouseButton;
|
||||||
|
|
||||||
// Render tab label, process close button
|
// Render tab label, process close button
|
||||||
const ImGuiID close_button_id = (p_open && !is_dragging) ? window->GetID((void*)((intptr_t)id + 1)) : 0;
|
const ImGuiID close_button_id = p_open ? window->GetID((void*)((intptr_t)id + 1)) : 0;
|
||||||
bool just_closed = TabItemLabelAndCloseButton(display_draw_list, bb, flags, tab_bar->FramePadding, label, id, close_button_id, tab_contents_visible);
|
bool just_closed = TabItemLabelAndCloseButton(display_draw_list, bb, flags, tab_bar->FramePadding, label, id, close_button_id, tab_contents_visible);
|
||||||
if (just_closed && p_open != NULL)
|
if (just_closed && p_open != NULL)
|
||||||
{
|
{
|
||||||
@ -7609,7 +7608,7 @@ bool ImGui::TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb,
|
|||||||
bool close_button_visible = false;
|
bool close_button_visible = false;
|
||||||
if (close_button_id != 0)
|
if (close_button_id != 0)
|
||||||
if (is_contents_visible || bb.GetWidth() >= g.Style.TabMinWidthForUnselectedCloseButton)
|
if (is_contents_visible || bb.GetWidth() >= g.Style.TabMinWidthForUnselectedCloseButton)
|
||||||
if (g.HoveredId == tab_id || g.HoveredId == close_button_id || g.ActiveId == close_button_id)
|
if (g.HoveredId == tab_id || g.HoveredId == close_button_id || g.ActiveId == tab_id || g.ActiveId == close_button_id)
|
||||||
close_button_visible = true;
|
close_button_visible = true;
|
||||||
if (close_button_visible)
|
if (close_button_visible)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user