mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Tabs: fixed middle-button to close not checking hovering, only close button visibility. (#8399, #8387)
Main bug has been here since54a60aaa4, but it's onlyef7ffaff7which made it very visible.
This commit is contained in:
parent
78ec1272e9
commit
c4a32a129d
2 changed files with 6 additions and 3 deletions
|
|
@ -72,13 +72,15 @@ Other changes:
|
||||||
- Tables, Error Handling: Recovery from invalid index in TableSetColumnIndex(). (#1651)
|
- Tables, Error Handling: Recovery from invalid index in TableSetColumnIndex(). (#1651)
|
||||||
- Selectable: Fixed horizontal label alignment with SelectableTextAlign.x > 0 and
|
- Selectable: Fixed horizontal label alignment with SelectableTextAlign.x > 0 and
|
||||||
specifying a selectable size. (#8338)
|
specifying a selectable size. (#8338)
|
||||||
- Styles, Tabs: made the Close Button of selected tabs always visible by default,
|
- Tabs, Style: made the Close Button of selected tabs always visible by default,
|
||||||
without requiring to hover the tab. (#8387)
|
without requiring to hover the tab. (#8387)
|
||||||
- Added style.TabCloseButtonMinWidthSelected/TabCloseButtonMinWidthUnselected settings
|
- Added style.TabCloseButtonMinWidthSelected/TabCloseButtonMinWidthUnselected settings
|
||||||
to configure visibility of the Close Button for selected and unselected tabs.
|
to configure visibility of the Close Button for selected and unselected tabs.
|
||||||
(-1: always visible. 0.0f: visible when hovered. >0.0f: visible when hovered if minimum width)
|
(-1: always visible. 0.0f: visible when hovered. >0.0f: visible when hovered if minimum width)
|
||||||
- Default for selected tabs: TabCloseButtonMinWidthSelected = -1.0f (always visible)
|
- Default for selected tabs: TabCloseButtonMinWidthSelected = -1.0f (always visible)
|
||||||
- Default for unselected tabs: TabCloseButtonMinWidthUnselected = 0.0f (visible when hovered)
|
- Default for unselected tabs: TabCloseButtonMinWidthUnselected = 0.0f (visible when hovered)
|
||||||
|
- Tabs: fixed middle-mouse-button to close tab not checking that close button
|
||||||
|
is hovered, merely it's visibility. (#8399, #8387) [@nicovanbentum]
|
||||||
- TextLinkOpenURL(): fixed default Win32 io.PlatformOpenInShellFn handler to
|
- TextLinkOpenURL(): fixed default Win32 io.PlatformOpenInShellFn handler to
|
||||||
handle UTF-8 regardless of system regional settings. (#7660) [@achabense]
|
handle UTF-8 regardless of system regional settings. (#7660) [@achabense]
|
||||||
- Demo: Combos: demonstrate a very simple way to add a filter to a combo,
|
- Demo: Combos: demonstrate a very simple way to add a filter to a combo,
|
||||||
|
|
|
||||||
|
|
@ -10368,9 +10368,10 @@ void ImGui::TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb,
|
||||||
// 'g.ActiveId==close_button_id' will be true when we are holding on the close button, in which case both hovered booleans are false
|
// 'g.ActiveId==close_button_id' will be true when we are holding on the close button, in which case both hovered booleans are false
|
||||||
bool close_button_pressed = false;
|
bool close_button_pressed = false;
|
||||||
bool close_button_visible = false;
|
bool close_button_visible = false;
|
||||||
|
bool is_hovered = g.HoveredId == tab_id || g.HoveredId == close_button_id || g.ActiveId == tab_id || g.ActiveId == close_button_id; // Any interaction account for this too.
|
||||||
|
|
||||||
if (close_button_id != 0)
|
if (close_button_id != 0)
|
||||||
{
|
{
|
||||||
bool is_hovered = g.HoveredId == tab_id || g.HoveredId == close_button_id || g.ActiveId == tab_id || g.ActiveId == close_button_id; // Any interaction account for this too.
|
|
||||||
if (is_contents_visible)
|
if (is_contents_visible)
|
||||||
close_button_visible = (g.Style.TabCloseButtonMinWidthSelected < 0.0f) ? true : (is_hovered && bb.GetWidth() >= ImMax(button_sz, g.Style.TabCloseButtonMinWidthSelected));
|
close_button_visible = (g.Style.TabCloseButtonMinWidthSelected < 0.0f) ? true : (is_hovered && bb.GetWidth() >= ImMax(button_sz, g.Style.TabCloseButtonMinWidthSelected));
|
||||||
else
|
else
|
||||||
|
|
@ -10386,7 +10387,7 @@ void ImGui::TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb,
|
||||||
g.LastItemData = last_item_backup;
|
g.LastItemData = last_item_backup;
|
||||||
|
|
||||||
// Close with middle mouse button
|
// Close with middle mouse button
|
||||||
if (!(flags & ImGuiTabItemFlags_NoCloseWithMiddleMouseButton) && IsMouseClicked(2))
|
if (is_hovered && !(flags & ImGuiTabItemFlags_NoCloseWithMiddleMouseButton) && IsMouseClicked(2))
|
||||||
close_button_pressed = true;
|
close_button_pressed = true;
|
||||||
}
|
}
|
||||||
else if (unsaved_marker_visible)
|
else if (unsaved_marker_visible)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue