fix issue where scrolling while drawing selection box did not update selection box size

This commit is contained in:
2026-06-22 21:10:38 +02:00
parent c7218c7c1e
commit 59688e6532

View File

@@ -9,6 +9,7 @@
#include <string>
#include <QColor>
#include <QCursor>
#include <QFont>
#include <QKeyEvent>
#include <QMessageBox>
@@ -183,9 +184,17 @@ void GameWorldView::onFrame()
{
const float delta = kScrollSpeedTilesPerSec
* static_cast<float>(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