Fix zooming w/tiled mode (fix #2120)

Regression introduced in d0962eb737

Bug reported in:
* https://github.com/aseprite/aseprite/issues/2120
* https://community.aseprite.org/t/less-jank-in-tile-view/3659
This commit is contained in:
David Capello 2019-08-06 15:17:11 -03:00
parent a70a3a11c7
commit b55d407ac1

View File

@ -2279,8 +2279,11 @@ void Editor::setZoomAndCenterInMouse(const Zoom& zoom,
break;
}
// Limit zooming screen position to the visible sprite bounds
gfx::Rect visibleBounds = editorToScreen(getVisibleSpriteBounds());
// Limit zooming screen position to the visible sprite bounds (we
// use canvasSize() because if the tiled mode is enabled, we need
// extra space for the zoom)
gfx::Rect visibleBounds = editorToScreen(
getViewportBounds().createIntersection(gfx::Rect(gfx::Point(0, 0), canvasSize())));
screenPos.x = base::clamp(screenPos.x, visibleBounds.x, visibleBounds.x2()-1);
screenPos.y = base::clamp(screenPos.y, visibleBounds.y, visibleBounds.y2()-1);