From 59688e6532aa5954bbd56535746107bff40d7847 Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Mon, 22 Jun 2026 21:10:38 +0200 Subject: [PATCH] fix issue where scrolling while drawing selection box did not update selection box size --- src/ui/GameWorldView.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ui/GameWorldView.cpp b/src/ui/GameWorldView.cpp index 689acab..6b7afa6 100644 --- a/src/ui/GameWorldView.cpp +++ b/src/ui/GameWorldView.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -183,9 +184,17 @@ void GameWorldView::onFrame() { const float delta = kScrollSpeedTilesPerSec * static_cast(elapsed) / 1000.0f; + const float scrollBefore = m_scrollXTiles; if (m_scrollLeft) { m_scrollXTiles -= delta; } if (m_scrollRight) { m_scrollXTiles += delta; } clampScroll(); + + // While the view scrolls, the tile under a stationary cursor changes, + // so refresh the box-select rectangle even though no mouse move fires. + if (m_boxSelecting && m_scrollXTiles != scrollBefore) + { + m_boxCurrentTile = widgetToTile(mapFromGlobal(QCursor::pos())); + } } // Fire events for any state that changed since the last frame