mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-16 10:20:50 +00:00
Fix sprite position after undoing/redoing a move/copy timeline range operation
This commit is contained in:
parent
f3bb1ecdf1
commit
c0b4224f32
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -38,7 +39,7 @@ void CmdTransaction::setNewDocRange(const DocRange& range)
|
||||
#endif
|
||||
}
|
||||
|
||||
void CmdTransaction::commit()
|
||||
void CmdTransaction::updateSpritePositionAfter()
|
||||
{
|
||||
m_spritePositionAfter = calcSpritePosition();
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -25,7 +26,7 @@ namespace app {
|
||||
bool changeSavedState, int* savedCounter);
|
||||
|
||||
void setNewDocRange(const DocRange& range);
|
||||
void commit();
|
||||
void updateSpritePositionAfter();
|
||||
|
||||
SpritePosition spritePositionBeforeExecute() const { return m_spritePositionBefore; }
|
||||
SpritePosition spritePositionAfterExecute() const { return m_spritePositionAfter; }
|
||||
|
@ -87,7 +87,7 @@ void Transaction::commit()
|
||||
ASSERT(m_cmds);
|
||||
TX_TRACE("TX: Commit <%s>\n", m_cmds->label().c_str());
|
||||
|
||||
m_cmds->commit();
|
||||
m_cmds->updateSpritePositionAfter();
|
||||
m_undo->add(m_cmds);
|
||||
m_cmds = nullptr;
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/app_menus.h"
|
||||
#include "app/cmd_transaction.h"
|
||||
#include "app/color_utils.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/commands.h"
|
||||
@ -3725,6 +3726,12 @@ void Timeline::dropRange(DropOp op)
|
||||
!m_sprite->frameTags().empty()) {
|
||||
invalidateRect(getFrameHeadersBounds().offset(origin()));
|
||||
}
|
||||
|
||||
// Update the sprite position after the command was executed
|
||||
// TODO improve this workaround
|
||||
Cmd* cmd = m_document->undoHistory()->lastExecutedCmd();
|
||||
if (auto cmdTx = dynamic_cast<CmdTransaction*>(cmd))
|
||||
cmdTx->updateSpritePositionAfter();
|
||||
}
|
||||
catch (const std::exception& ex) {
|
||||
Console::showException(ex);
|
||||
|
Loading…
x
Reference in New Issue
Block a user