From 4c583c26197518c6ee371880e52e79b77c30a98a Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 4 Apr 2019 13:23:39 -0300 Subject: [PATCH] Fix new bounds of tilemap after Edit > Clear or Edit > Cut --- src/app/cmd/trim_cel.cpp | 5 ++++- src/app/util/clipboard.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/cmd/trim_cel.cpp b/src/app/cmd/trim_cel.cpp index 81cf979f8..8fe15e5b0 100644 --- a/src/app/cmd/trim_cel.cpp +++ b/src/app/cmd/trim_cel.cpp @@ -25,7 +25,10 @@ using namespace doc; TrimCel::TrimCel(Cel* cel) { gfx::Rect newBounds; - if (algorithm::shrink_cel_bounds(cel, cel->image()->maskColor(), newBounds)) { + if (algorithm::shrink_bounds(cel->image(), + cel->image()->maskColor(), + cel->layer(), newBounds)) { + newBounds.offset(cel->position()); if (cel->bounds() != newBounds) { add(new cmd::CropCel(cel, newBounds)); } diff --git a/src/app/util/clipboard.cpp b/src/app/util/clipboard.cpp index 21aeccd52..6cec39f5d 100644 --- a/src/app/util/clipboard.cpp +++ b/src/app/util/clipboard.cpp @@ -256,6 +256,7 @@ void clear_mask_from_cels(Tx& tx, cel = doc::get(celId); if (cel && cel->layer()->isTransparent() && + // Don't shrink tilemaps automatically !cel->layer()->isTilemap()) { tx(new cmd::TrimCel(cel)); }