fix issue where scrolling while drawing selection box did not update selection box size
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <QCursor>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@@ -183,9 +184,17 @@ void GameWorldView::onFrame()
|
|||||||
{
|
{
|
||||||
const float delta = kScrollSpeedTilesPerSec
|
const float delta = kScrollSpeedTilesPerSec
|
||||||
* static_cast<float>(elapsed) / 1000.0f;
|
* static_cast<float>(elapsed) / 1000.0f;
|
||||||
|
const float scrollBefore = m_scrollXTiles;
|
||||||
if (m_scrollLeft) { m_scrollXTiles -= delta; }
|
if (m_scrollLeft) { m_scrollXTiles -= delta; }
|
||||||
if (m_scrollRight) { m_scrollXTiles += delta; }
|
if (m_scrollRight) { m_scrollXTiles += delta; }
|
||||||
clampScroll();
|
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
|
// Fire events for any state that changed since the last frame
|
||||||
|
|||||||
Reference in New Issue
Block a user