From e2641668a43c4b8002551dce98ed3ec08b8505d7 Mon Sep 17 00:00:00 2001 From: Basssiiie Date: Fri, 2 Aug 2024 21:16:22 +0200 Subject: [PATCH] Fix off-by-one pixel issue in active widget width and height setters --- distribution/changelog.txt | 1 + src/openrct2-ui/scripting/ScWidget.hpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 95e79d1ead..5fd34e887f 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -37,6 +37,7 @@ - Fix: [#22339] Printing ui.tool.cursor in console crashes the game. - Fix: [#22348] Progress bar screen doesn’t handle window resizing. - Fix: [#22389] Alpine coaster has wrong tunnel entrance type. +- Fix: [#22435] [Plugin] Off-by-one pixel issue in active widget width and height setters. 0.4.12 (2024-07-07) ------------------------------------------------------------------------ diff --git a/src/openrct2-ui/scripting/ScWidget.hpp b/src/openrct2-ui/scripting/ScWidget.hpp index 37f05a95f9..5bb00ccd7f 100644 --- a/src/openrct2-ui/scripting/ScWidget.hpp +++ b/src/openrct2-ui/scripting/ScWidget.hpp @@ -207,7 +207,7 @@ namespace OpenRCT2::Scripting auto widget = GetWidget(); if (widget != nullptr) { - return widget->width(); + return widget->width() + 1; } return 0; } @@ -216,7 +216,7 @@ namespace OpenRCT2::Scripting auto widget = GetWidget(); if (widget != nullptr) { - auto delta = widget->left + value - widget->right; + auto delta = widget->left + value - (widget->right + 1); Invalidate(); widget->right += delta; @@ -246,7 +246,7 @@ namespace OpenRCT2::Scripting auto widget = GetWidget(); if (widget != nullptr) { - return widget->height(); + return widget->height() + 1; } return 0; } @@ -255,7 +255,7 @@ namespace OpenRCT2::Scripting auto widget = GetWidget(); if (widget != nullptr) { - auto delta = widget->top + value - widget->bottom; + auto delta = widget->top + value - (widget->bottom + 1); Invalidate(); widget->bottom += delta;