mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-04 04:12:05 +01:00
fix(ui): keep panels in the main window when resizing them at the screen edge
Pulling a panel's grip into the corner of the screen pushed it a couple of pixels past the main window, and ImGui gave it an OS window of its own. Now a panel only comes out when dragged with the cursor outside the main window. A panel that stays in the main window needs its grips in reach, so a resize stops at the edge, and a panel left past the edge or too big for the window is moved back and shrunk to fit. This is a new io.ConfigViewportsNoAutoDetach option in our copy of ImGui, so it has to be carried over when ImGui gets updated. ImGui itself has no option for this, as of 1.93.1.
This commit is contained in:
@@ -403,6 +403,8 @@ bool ui_layer::init(GLFWwindow *Window)
|
||||
{
|
||||
m_imguiio->ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||
m_imguiio->ConfigViewportsNoTaskBarIcon = true;
|
||||
// only dragging a panel with the cursor past the main window takes it out, not resizing it or placing it at the edge
|
||||
m_imguiio->ConfigViewportsNoAutoDetach = true;
|
||||
auto &platformio{ImGui::GetPlatformIO()};
|
||||
imgui_create_window = platformio.Platform_CreateWindow;
|
||||
platformio.Platform_CreateWindow = create_viewport_window;
|
||||
|
||||
Reference in New Issue
Block a user