From b55d407ac1e9ed22ac49aede4bd8677b88327c3d Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 6 Aug 2019 15:17:11 -0300 Subject: [PATCH] Fix zooming w/tiled mode (fix #2120) Regression introduced in d0962eb737ab0f652952982db7b0d68596b80545 Bug reported in: * https://github.com/aseprite/aseprite/issues/2120 * https://community.aseprite.org/t/less-jank-in-tile-view/3659 --- src/app/ui/editor/editor.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp index 0e3a305b7..e707323f2 100644 --- a/src/app/ui/editor/editor.cpp +++ b/src/app/ui/editor/editor.cpp @@ -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);