1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Fix deadzone when panning while zoomed in. (#22877)

This commit is contained in:
mrmbernardi
2024-10-01 23:48:08 +10:00
committed by GitHub
parent ffad32ee8c
commit 1719bbdfb7
2 changed files with 9 additions and 2 deletions

View File

@@ -29,6 +29,7 @@
- Fix: [#22729] Invisibility settings persist after reloading OpenRCT2.
- Fix: [#22734] Support clearance above steep Side-Friction track is too low.
- Fix: [#22774] Fix entities leaving stale pixels on the screen when the framerate is uncapped.
- Fix: [#22805] Fix deadzone when panning the view in positive axis directions.
- Fix: [#22857] Side-Friction Roller Coaster train clips through slopes.
- Fix: [objects#346] Invalid refund price for Brick Base Block scenery item.

View File

@@ -586,8 +586,14 @@ static void InputViewportDragContinue()
// As the user moved the mouse, don't interpret it as right click in any case.
_ticksSinceDragStart = std::nullopt;
differentialCoords.x = (viewport->zoom + 1).ApplyTo(differentialCoords.x);
differentialCoords.y = (viewport->zoom + 1).ApplyTo(differentialCoords.y);
// applying the zoom only with negative values avoids a "deadzone" effect where small positive value round to zero.
const bool posX = differentialCoords.x > 0;
const bool posY = differentialCoords.y > 0;
differentialCoords.x = (viewport->zoom + 1).ApplyTo(-std::abs(differentialCoords.x));
differentialCoords.y = (viewport->zoom + 1).ApplyTo(-std::abs(differentialCoords.y));
differentialCoords.x = posX ? -differentialCoords.x : differentialCoords.x;
differentialCoords.y = posY ? -differentialCoords.y : differentialCoords.y;
if (Config::Get().general.InvertViewportDrag)
{
w->savedViewPos -= differentialCoords;