From ed8ee35a86e2fc37e368c8624dc54065a6aa011f Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 16 Jan 2022 00:48:35 +0100 Subject: [PATCH] ui: Fixed sizing of several popups --- main/source/window/window.cpp | 6 +----- .../builtin/include/content/views/view_command_palette.hpp | 4 ++-- plugins/builtin/include/content/views/view_settings.hpp | 5 ++--- .../builtin/source/content/views/view_pattern_editor.cpp | 2 +- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/main/source/window/window.cpp b/main/source/window/window.cpp index 25dba43bb..872efbd2a 100644 --- a/main/source/window/window.cpp +++ b/main/source/window/window.cpp @@ -519,11 +519,7 @@ namespace hex { continue; if (view->isAvailable()) { - auto minSize = view->getMinSize(); - minSize.x *= SharedData::globalScale; - minSize.y *= SharedData::globalScale; - - ImGui::SetNextWindowSizeConstraints(minSize, view->getMaxSize()); + ImGui::SetNextWindowSizeConstraints(scaled(view->getMinSize()), scaled(view->getMaxSize())); view->drawContent(); } diff --git a/plugins/builtin/include/content/views/view_command_palette.hpp b/plugins/builtin/include/content/views/view_command_palette.hpp index 9d3badd14..ab14d4644 100644 --- a/plugins/builtin/include/content/views/view_command_palette.hpp +++ b/plugins/builtin/include/content/views/view_command_palette.hpp @@ -22,8 +22,8 @@ namespace hex::plugin::builtin { [[nodiscard]] bool shouldProcess() const override { return true; } [[nodiscard]] bool hasViewMenuItemEntry() const override { return false; } - [[nodiscard]] ImVec2 getMinSize() const override { return ImVec2(400, 100); } - [[nodiscard]] ImVec2 getMaxSize() const override { return ImVec2(400, 100); } + [[nodiscard]] ImVec2 getMinSize() const override { return { 400, 100 }; } + [[nodiscard]] ImVec2 getMaxSize() const override { return { 400, 100 }; } private: enum class MatchType { diff --git a/plugins/builtin/include/content/views/view_settings.hpp b/plugins/builtin/include/content/views/view_settings.hpp index 1ce59d7cb..05b3c5038 100644 --- a/plugins/builtin/include/content/views/view_settings.hpp +++ b/plugins/builtin/include/content/views/view_settings.hpp @@ -18,9 +18,8 @@ namespace hex::plugin::builtin { [[nodiscard]] bool hasViewMenuItemEntry() const override { return false; } - [[nodiscard]] ImVec2 getMinSize() const override { - return scaled(ImVec2(500, 300)); - } + [[nodiscard]] ImVec2 getMinSize() const override { return { 500, 300 }; } + [[nodiscard]] ImVec2 getMaxSize() const override { return { 500, 300 }; } }; } \ No newline at end of file diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index 166344763..e333aa0e7 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -566,7 +566,7 @@ namespace hex::plugin::builtin { ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5F, 0.5F)); if (ImGui::BeginPopupModal("hex.builtin.view.pattern_editor.menu.file.load_pattern"_lang, &opened, ImGuiWindowFlags_AlwaysAutoResize)) { - if (ImGui::BeginListBox("##patterns", ImVec2(-FLT_MIN, 0))) { + if (ImGui::BeginListBox("##patterns", ImVec2(300_scaled, 0))) { u32 index = 0; for (auto &path : this->m_possiblePatternFiles) {