Skip to content

Commit 2dc328c

Browse files
committed
MapWidget: panning back when scrolling out at 1x
The meaning of baseScale changed, so the calculation needs to change.
1 parent 71d875e commit 2dc328c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ui/mapwidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ void MapWidget::connectSignals()
252252
// At minimum zoom, scrolling down pans back to center
253253
// Use percentage of widget size for consistent feel across different image sizes
254254
constexpr float PAN_STEP_PERCENT = 0.3f; // 30% of widget size per scroll
255-
const float screenStep = std::min(_size.width, _size.height) * PAN_STEP_PERCENT;
255+
const float screenStep = static_cast<float>(std::min(_size.width, _size.height)) * PAN_STEP_PERCENT;
256256

257257
// Convert screen pixels to image pixels
258-
const float imageStep = (baseScale > 0) ? screenStep / baseScale : screenStep;
258+
const float imageStep = (baseScale > 0) ? screenStep * baseScale : screenStep;
259259

260260
const float dist = std::sqrt(_panX * _panX + _panY * _panY);
261261
if (dist <= imageStep) {

0 commit comments

Comments
 (0)