TabItem 'Unsaved document' bullet rendered too low #6862

Closed
opened 2023-09-25 17:46:04 +00:00 by alektron · 1 comment
alektron commented 2023-09-25 17:46:04 +00:00 (Migrated from github.com)

Version/Branch of Dear ImGui:

Version: 1.90 WIP (18992)
Branch: docking

Back-ends: (tested with) example_win32_directx11, custom backend
Operating System: Windows 10

Issue (regression):
TabBarItems with the ImGuiTabItemFlags_UnsavedDocument flag set has the dot/bullet rendered too low:
image

The reason seems to be a change in TabItemLabelAndCloseButton in imgui_widgets.cpp.
(introduced into docking when merging from master in 676497fe, I did not investigate further where exactly in master).

When calculating button_pos the frame_padding.y gets added to the y value.
The tab close button seems to have been adjusted by removing the surrounding Push/PopStyleVar(FramePadding).

//PushStyleVar(ImGuiStyleVar_FramePadding, frame_padding);
if (CloseButton(close_button_id, button_pos))
    close_button_pressed = true;
//PopStyleVar();

However the unsaved document bullet still has a + g.Style.FramePadding * 2.0f added to its bounds.
This then affects bb.GetCenter().

const ImRect bullet_bb(button_pos, button_pos + ImVec2(button_sz, button_sz) + g.Style.FramePadding * 2.0f);
RenderBullet(draw_list, bullet_bb.GetCenter(), GetColorU32(ImGuiCol_Text));
Version/Branch of Dear ImGui: Version: 1.90 WIP (18992) Branch: docking Back-ends: (tested with) example_win32_directx11, custom backend Operating System: Windows 10 Issue (regression): TabBarItems with the ImGuiTabItemFlags_UnsavedDocument flag set has the dot/bullet rendered too low: ![image](https://github.com/ocornut/imgui/assets/9118389/c8524dc5-c7bc-438f-9648-ea58029ed012) The reason seems to be a change in `TabItemLabelAndCloseButton` in imgui_widgets.cpp. (introduced into docking when merging from master in 676497fe, I did not investigate further where exactly in master). When calculating `button_pos` the frame_padding.y gets added to the y value. The tab close button seems to have been adjusted by removing the surrounding Push/PopStyleVar(FramePadding). ```cpp //PushStyleVar(ImGuiStyleVar_FramePadding, frame_padding); if (CloseButton(close_button_id, button_pos)) close_button_pressed = true; //PopStyleVar(); ``` However the unsaved document bullet still has a `+ g.Style.FramePadding * 2.0f` added to its bounds. This then affects bb.GetCenter(). ```cpp const ImRect bullet_bb(button_pos, button_pos + ImVec2(button_sz, button_sz) + g.Style.FramePadding * 2.0f); RenderBullet(draw_list, bullet_bb.GetCenter(), GetColorU32(ImGuiCol_Text)); ```
ocornut commented 2023-09-25 18:40:47 +00:00 (Migrated from github.com)

This was indeed broken by 4a814244.
I pushed the fix e5ca535 now.
I confirmed this cherry-pick fine in docking until we merge it (usually once a week).

Thank you!

This was indeed broken by 4a814244. I pushed the fix e5ca535 now. I confirmed this cherry-pick fine in docking until we merge it (usually once a week). Thank you!
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#6862
No description provided.