From 4e77dc870547670b44828fc263ed24ad1c63321e Mon Sep 17 00:00:00 2001 From: Pascal Thomet Date: Mon, 1 Jan 2024 17:03:59 +0100 Subject: [PATCH] Finish work on bordeless_movable --- src/hello_imgui/internal/borderless_movable.cpp | 8 ++++---- .../hello_imgui_demodocking.main.cpp | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hello_imgui/internal/borderless_movable.cpp b/src/hello_imgui/internal/borderless_movable.cpp index f918159c..1478731c 100644 --- a/src/hello_imgui/internal/borderless_movable.cpp +++ b/src/hello_imgui/internal/borderless_movable.cpp @@ -26,11 +26,11 @@ namespace HelloImGui // Update dragging state ImVec2 mousePos = ImGui::GetMousePos(); static bool isDragging = false; - if (dragArea.Contains(mousePos) && !isDragging && ImGui::IsMouseDragging(ImGuiMouseButton_Left)) + if (dragArea.Contains(mousePos) && !isDragging && ImGui::IsMouseDown(ImGuiMouseButton_Left)) { isDragging = true; } - if (!ImGui::IsMouseDragging(ImGuiMouseButton_Left) && isDragging) + if (!ImGui::IsMouseDown(ImGuiMouseButton_Left) && isDragging) isDragging = false; // Draw drag zone @@ -70,9 +70,9 @@ namespace HelloImGui // Update dragging state static bool isDragging = false; ImVec2 mousePos = ImGui::GetIO().MousePos; - if (dragArea.Contains(mousePos) && !isDragging && ImGui::IsMouseDragging(ImGuiMouseButton_Left)) + if (dragArea.Contains(mousePos) && !isDragging && ImGui::IsMouseDown(ImGuiMouseButton_Left)) isDragging = true; - if (!ImGui::IsMouseDragging(ImGuiMouseButton_Left)) + if (!ImGui::IsMouseDown(ImGuiMouseButton_Left)) isDragging = false; // Draw drag zone diff --git a/src/hello_imgui_demos/hello_imgui_demodocking/hello_imgui_demodocking.main.cpp b/src/hello_imgui_demos/hello_imgui_demodocking/hello_imgui_demodocking.main.cpp index 71a79bab..d911b976 100644 --- a/src/hello_imgui_demos/hello_imgui_demodocking/hello_imgui_demodocking.main.cpp +++ b/src/hello_imgui_demos/hello_imgui_demodocking/hello_imgui_demodocking.main.cpp @@ -498,7 +498,11 @@ int main(int, char**) runnerParams.imGuiWindowParams.menuAppTitle = "Docking Demo"; runnerParams.appWindowParams.windowGeometry.size = {1000, 900}; runnerParams.appWindowParams.restorePreviousGeometry = true; + + // Our application uses a borderless window, but is movable/resizable runnerParams.appWindowParams.borderless = true; + runnerParams.appWindowParams.borderlessMovable = true; + runnerParams.appWindowParams.borderlessResizable = true; // Load additional font runnerParams.callbacks.LoadAdditionalFonts = LoadFonts;