From 0f745d5f1ba6f8f21de117adff4ac2b0c57a9a51 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Sat, 4 Jan 2025 01:23:26 +0100 Subject: [PATCH 1/2] fix long texts in popup --- client/windows/CMessage.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/windows/CMessage.cpp b/client/windows/CMessage.cpp index ed7f09fe3..e02f3a808 100644 --- a/client/windows/CMessage.cpp +++ b/client/windows/CMessage.cpp @@ -28,6 +28,7 @@ #include "../../lib/texts/TextOperations.h" constexpr int RIGHT_CLICK_POPUP_MIN_SIZE = 100; +constexpr int RIGHT_CLICK_POPUP_MAX_HEIGHT_TEXTONLY = 450; constexpr int SIDE_MARGIN = 11; constexpr int TOP_MARGIN = 20; constexpr int BOTTOM_MARGIN = 16; @@ -260,9 +261,11 @@ void CMessage::drawIWindow(CInfoWindow * ret, std::string text, PlayerColor play if(ret->buttons.empty() && !ret->components) { // use more compact form for right-click popup with no buttons / components + if(ret->text->slider) + ret->text->resize(Point(ret->text->pos.w, std::min(ret->text->label->textSize.y, RIGHT_CLICK_POPUP_MAX_HEIGHT_TEXTONLY))); - ret->pos.w = std::max(RIGHT_CLICK_POPUP_MIN_SIZE, ret->text->label->textSize.x + 2 * SIDE_MARGIN); - ret->pos.h = std::max(RIGHT_CLICK_POPUP_MIN_SIZE, ret->text->label->textSize.y + TOP_MARGIN + BOTTOM_MARGIN); + ret->pos.w = std::max(RIGHT_CLICK_POPUP_MIN_SIZE, ret->text->pos.w + 2 * SIDE_MARGIN); + ret->pos.h = std::max(RIGHT_CLICK_POPUP_MIN_SIZE, ret->text->pos.h + TOP_MARGIN + BOTTOM_MARGIN); } else { From c7963cf62f07b75f5577d5218d72eecb5922c739 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Sat, 4 Jan 2025 02:01:44 +0100 Subject: [PATCH 2/2] fix TeleporterPopup out of screen --- client/windows/InfoWindows.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/client/windows/InfoWindows.cpp b/client/windows/InfoWindows.cpp index 71bb9dd0a..70579a229 100644 --- a/client/windows/InfoWindows.cpp +++ b/client/windows/InfoWindows.cpp @@ -408,6 +408,7 @@ TeleporterPopup::TeleporterPopup(const Point & position, const CGTeleport * tele } center(position); + fitToScreen(10); } std::shared_ptr