[aseprite] 82/134: Final fix for "Paste at original position" (issue #57 and fix #336)
Tobias Hansen
thansen at moszumanska.debian.org
Sat Mar 14 17:10:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit 1dfb48e0683bada4c521075f414f9d45412f78a2
Author: David Capello <davidcapello at gmail.com>
Date: Sun Nov 30 10:40:32 2014 -0300
Final fix for "Paste at original position" (issue #57 and fix #336)
---
src/app/ui/editor/editor.cpp | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp
index b81ae28..35fa551 100644
--- a/src/app/ui/editor/editor.cpp
+++ b/src/app/ui/editor/editor.cpp
@@ -1403,22 +1403,10 @@ void Editor::pasteImage(const Image* image, int x, int y)
// Check bounds where the image will be pasted.
{
// Then we check if the image will be visible by the user.
- Rect visibleBounds = getVisibleSpriteBounds();
+ Rect visibleBounds = getVisibleSpriteBounds().shrink(4*jguiscale());
x = MID(visibleBounds.x-image->width(), x, visibleBounds.x+visibleBounds.w-1);
y = MID(visibleBounds.y-image->height(), y, visibleBounds.y+visibleBounds.h-1);
- // If the visible part of the pasted image will not fit in the
- // visible bounds of the editor, we put the image in the center of
- // the visible bounds.
- Rect visiblePasted = visibleBounds.createIntersect(gfx::Rect(x, y, image->width(), image->height()));
- if (((visibleBounds.w >= image->width() && visiblePasted.w < image->width()/2) ||
- (visibleBounds.w < image->width() && visiblePasted.w < visibleBounds.w/2)) ||
- ((visibleBounds.h >= image->height() && visiblePasted.h < image->width()/2) ||
- (visibleBounds.h < image->height() && visiblePasted.h < visibleBounds.h/2))) {
- x = visibleBounds.x + visibleBounds.w/2 - image->width()/2;
- y = visibleBounds.y + visibleBounds.h/2 - image->height()/2;
- }
-
// We limit the image inside the sprite's bounds.
x = MID(0, x, sprite->width() - image->width());
y = MID(0, y, sprite->height() - image->height());
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git
More information about the Pkg-games-commits
mailing list