Fix bug in MovingCelState::onMouseUp(): restore the mask visibility when the position is not changed.

This commit is contained in:
David Capello 2011-10-29 22:06:16 -03:00
parent 8d37636f1a
commit 89b97b8e65

View File

@ -69,12 +69,12 @@ MovingCelState::~MovingCelState()
bool MovingCelState::onMouseUp(Editor* editor, Message* msg) bool MovingCelState::onMouseUp(Editor* editor, Message* msg)
{ {
Document* document = editor->getDocument();
// Here we put back the cel into its original coordinate (so we can // Here we put back the cel into its original coordinate (so we can
// add an undoer before). // add an undoer before).
if (m_celStartX != m_celNewX || if (m_celStartX != m_celNewX ||
m_celStartY != m_celNewY) { m_celStartY != m_celNewY) {
Document* document = editor->getDocument();
// Put the cel in the original position. // Put the cel in the original position.
if (m_cel) if (m_cel)
m_cel->setPosition(m_celStartX, m_celStartY); m_cel->setPosition(m_celStartX, m_celStartY);
@ -94,11 +94,12 @@ bool MovingCelState::onMouseUp(Editor* editor, Message* msg)
undoTransaction.commit(); undoTransaction.commit();
} }
}
if (m_maskVisible) { // Restore the mask visibility.
document->setMaskVisible(m_maskVisible); if (m_maskVisible) {
document->generateMaskBoundaries(); document->setMaskVisible(m_maskVisible);
} document->generateMaskBoundaries();
} }
editor->setState(editor->getDefaultState()); editor->setState(editor->getDefaultState());