Don't destroy linked cels after moving the whole cel content (fix #1214)

This commit is contained in:
David Capello 2016-09-12 16:44:14 -03:00
parent 2e14064ef7
commit 638206becd
3 changed files with 15 additions and 4 deletions

View File

@ -523,6 +523,8 @@ void MovingPixelsState::onBeforeCommandExecution(CommandExecutionEvent& ev)
// Clear floating pixels on Cut/Clear.
if (command->id() != CommandId::Copy) {
m_pixelsMovement->trim();
// Discard the dragged image.
m_pixelsMovement->discardImage();
m_discarded = true;

View File

@ -173,6 +173,16 @@ void PixelsMovement::rotate(double angle)
update_screen_for_document(m_document);
}
void PixelsMovement::trim()
{
ContextWriter writer(m_reader, 1000);
ASSERT(writer.cel());
if (writer.cel() &&
writer.cel()->layer()->isTransparent())
m_transaction.execute(new cmd::TrimCel(writer.cel()));
}
void PixelsMovement::cutMask()
{
{
@ -180,10 +190,8 @@ void PixelsMovement::cutMask()
if (writer.cel()) {
m_transaction.execute(new cmd::ClearMask(writer.cel()));
ASSERT(writer.cel());
if (writer.cel() &&
writer.cel()->layer()->isTransparent())
m_transaction.execute(new cmd::TrimCel(writer.cel()));
// Do not trim here so we don't lost the information about all
// linked cels related to "writer.cel()"
}
}

View File

@ -56,6 +56,7 @@ namespace app {
HandleType handle() const { return m_handle; }
void trim();
void cutMask();
void copyMask();
void catchImage(const gfx::Point& pos, HandleType handle);