mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 13:21:34 +00:00
Allow executing transactions on contextless docs
This commit is contained in:
parent
e5bf9cb253
commit
8b0b1d8d1e
@ -14,6 +14,7 @@
|
||||
#include "app/app.h"
|
||||
#include "app/context.h"
|
||||
#include "app/site.h"
|
||||
#include "app/sprite_position.h"
|
||||
#include "app/ui/timeline/timeline.h"
|
||||
|
||||
namespace app {
|
||||
@ -118,6 +119,12 @@ size_t CmdTransaction::onMemSize() const
|
||||
|
||||
SpritePosition CmdTransaction::calcSpritePosition() const
|
||||
{
|
||||
// This check was added to allow executing transactions on documents that are
|
||||
// not part of any context. For instance, when dragging and dropping a
|
||||
// document on the timeline, the dragged document doesn't have any context (
|
||||
// it is not associated with any editor).
|
||||
if (!context())
|
||||
return SpritePosition();
|
||||
Site site = context()->activeSite();
|
||||
return SpritePosition(site.layer(), site.frame());
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ void Transaction::commit()
|
||||
else
|
||||
set_current_palette(nullptr, false);
|
||||
|
||||
if (m_ctx->isUIAvailable())
|
||||
if (m_ctx && m_ctx->isUIAvailable())
|
||||
ui::Manager::getDefault()->invalidate();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user