Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Child resizing separator overlaying child contents #8034

Open
o-3-o opened this issue Oct 2, 2024 · 4 comments
Open

Child resizing separator overlaying child contents #8034

o-3-o opened this issue Oct 2, 2024 · 4 comments

Comments

@o-3-o
Copy link

o-3-o commented Oct 2, 2024

Version/Branch of Dear ImGui:

Version 1.91.2, Branch: docking

Back-ends:

imgui_impl_Win32.cpp + imgui_impl_DX11.cpp

Compiler, OS:

win11+vs2022

Full config/build information:

Dear ImGui 1.91.2 (19120)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: IMGUI_DISABLE_OBSOLETE_FUNCTIONS
define: IMGUI_DISABLE_OBSOLETE_KEYIO
define: _WIN32
define: _WIN64
define: _MSC_VER=1941
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx11
io.ConfigFlags: 0x0000C483
 NavEnableKeyboard
 NavEnableGamepad
 DockingEnable
 ViewportsEnable
 DpiEnableScaleViewports
 DpiEnableScaleFonts
io.ConfigViewportsNoAutoMerge
io.ConfigViewportsNoDecoration
io.ConfigViewportsNoDefaultParent
io.ConfigDockingTransparentPayload
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C0E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 3440.00,1392.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:

My Issue/Question:

BeginChild When ImGuiChildFlags_ResizeX is enabled, should the separator line be overlaid on the project element foreground?

Screenshots/Video:

无标题2

Minimal, Complete and Verifiable Example code:

	ImGui::SetNextWindowSize(ImVec2(100, 200));
	ImGui::Begin("##Main");
		ImGui::PushStyleColor(ImGuiCol_ChildBg,ImGui::GetColorU32(ImGuiCol_MenuBarBg));
		ImGui::BeginChild("##Child", ImVec2(45.0f, .0f), ImGuiChildFlags_ResizeX);
			ImGui::Text("LONG LONG LONG TEXT");
		ImGui::EndChild();
		ImGui::PopStyleColor();
	ImGui::End();
@ocornut ocornut changed the title Separator line hierarchy problem Child resizing separator overlaying child contents Oct 3, 2024
@ocornut
Copy link
Owner

ocornut commented Oct 3, 2024

This is essentially a byproduct of #7887 #7888 : border size don't affect layout and so a thick border (as the child window resizing border is) would overlap content.

In addition to that, windowing decorations are rendered first.
(They are also displayed in parent window when possible to reduce amount of draw calls as the decoration needs same clipping rect as parent, but there is a mechanism to control that, we could set back render_decorations_in_parent=false in Begin() when borders are hovered. But it won't solve the problem enough)

I acknowledge this is an issue but it seems very minor and due to the complexity of the changes required it's unlikely to be a priority and it's unlikely to be fixed soon.

@o-3-o
Copy link
Author

o-3-o commented Oct 3, 2024

ok, I haven't read the internal code in depth, so I think using the foreground draw list to draw the border should solve the problem, but I don't know if there will be any side effects?

But it's actually harmless, there are still many ways to solve this small problem at the user level.

@ocornut
Copy link
Owner

ocornut commented Oct 3, 2024

ok, I haven't read the internal code in depth, so I think using the foreground draw list to draw the border should solve the problem, but I don't know if there will be any side effects?

Well that's pretty wrong, as it means e.g. hovering a border of a partially covered window would display the border over all other windows.

@ocornut
Copy link
Owner

ocornut commented Oct 3, 2024

I suppose that drawing specific window decorations at the end of the frame would also fit #2856.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants