mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 13:21:34 +00:00
Fix Shift+N behavior (fix #2957)
This commit is contained in:
parent
2b57fcaa6c
commit
ff851157cc
@ -62,7 +62,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
|
||||
namespace app {
|
||||
@ -1782,8 +1781,7 @@ paintNoDoc:;
|
||||
|
||||
void Timeline::onBeforeCommandExecution(CommandExecutionEvent& ev)
|
||||
{
|
||||
m_savedCounter = (m_document ? *m_document->undoHistory()->savedCounter():
|
||||
std::numeric_limits<int>::min());
|
||||
m_savedVersion = (m_document ? m_document->sprite()->version(): 0);
|
||||
}
|
||||
|
||||
void Timeline::onAfterCommandExecution(CommandExecutionEvent& ev)
|
||||
@ -1791,9 +1789,9 @@ void Timeline::onAfterCommandExecution(CommandExecutionEvent& ev)
|
||||
if (!m_document)
|
||||
return;
|
||||
|
||||
// TODO improve this: no need to regenerate everything after each command
|
||||
const int currentCounter = *m_document->undoHistory()->savedCounter();
|
||||
if (m_savedCounter != currentCounter) {
|
||||
// TODO Improve this: check if the structure of layers/frames has changed
|
||||
const doc::ObjectVersion currentVersion = m_document->sprite()->version();
|
||||
if (m_savedVersion != currentVersion) {
|
||||
regenerateRows();
|
||||
showCurrentCel();
|
||||
invalidate();
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "base/debug.h"
|
||||
#include "doc/frame.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/object_version.h"
|
||||
#include "doc/selected_frames.h"
|
||||
#include "doc/selected_layers.h"
|
||||
#include "doc/sprite.h"
|
||||
@ -393,10 +394,10 @@ namespace app {
|
||||
Range m_dropRange;
|
||||
State m_state;
|
||||
|
||||
// Value of DocUndo::savedCounter() before executing a
|
||||
// command. Used to compare after executing a command to avoid
|
||||
// Version of the sprite before executing a command. Used to check
|
||||
// if the sprite was modified after executing a command to avoid
|
||||
// regenerating all rows if it's not necessary.
|
||||
int m_savedCounter;
|
||||
doc::ObjectVersion m_savedVersion;
|
||||
|
||||
// Data used to display each row in the timeline
|
||||
std::vector<Row> m_rows;
|
||||
|
Loading…
x
Reference in New Issue
Block a user