Fix new bounds of tilemap after Edit > Clear or Edit > Cut

This commit is contained in:
David Capello 2019-04-04 13:23:39 -03:00
parent 26139c4ae2
commit 4c583c2619
2 changed files with 5 additions and 1 deletions

View File

@ -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));
}

View File

@ -256,6 +256,7 @@ void clear_mask_from_cels(Tx& tx,
cel = doc::get<Cel>(celId);
if (cel &&
cel->layer()->isTransparent() &&
// Don't shrink tilemaps automatically
!cel->layer()->isTilemap()) {
tx(new cmd::TrimCel(cel));
}