mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-02 13:20:12 +00:00
Fix bug "Rewind on Stop" increments start frame randomly (fix #1569)
This commit is contained in:
parent
49d2cd14f0
commit
7b7b12b593
src
@ -92,13 +92,13 @@ void PlayState::onEnterState(Editor* editor)
|
|||||||
|
|
||||||
EditorState::LeaveAction PlayState::onLeaveState(Editor* editor, EditorState* newState)
|
EditorState::LeaveAction PlayState::onLeaveState(Editor* editor, EditorState* newState)
|
||||||
{
|
{
|
||||||
if (!m_toScroll) {
|
|
||||||
if (m_playOnce || Preferences::instance().general.rewindOnStop())
|
|
||||||
m_editor->setFrame(m_refFrame);
|
|
||||||
|
|
||||||
// We don't stop the timer if we are going to the ScrollingState
|
// We don't stop the timer if we are going to the ScrollingState
|
||||||
// (we keep playing the animation).
|
// (we keep playing the animation).
|
||||||
|
if (!m_toScroll) {
|
||||||
m_playTimer.stop();
|
m_playTimer.stop();
|
||||||
|
|
||||||
|
if (m_playOnce || Preferences::instance().general.rewindOnStop())
|
||||||
|
m_editor->setFrame(m_refFrame);
|
||||||
}
|
}
|
||||||
return KeepState;
|
return KeepState;
|
||||||
}
|
}
|
||||||
@ -169,6 +169,8 @@ bool PlayState::onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos)
|
|||||||
|
|
||||||
void PlayState::onPlaybackTick()
|
void PlayState::onPlaybackTick()
|
||||||
{
|
{
|
||||||
|
ASSERT(m_playTimer.isRunning());
|
||||||
|
|
||||||
if (m_nextFrameTime < 0)
|
if (m_nextFrameTime < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// Aseprite UI Library
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -41,8 +41,8 @@ Timer::~Timer()
|
|||||||
ASSERT(it != timers.end());
|
ASSERT(it != timers.end());
|
||||||
timers.erase(it);
|
timers.erase(it);
|
||||||
|
|
||||||
// Remove messages of this timer in the queue
|
// Stop the timer and remove it from the message queue.
|
||||||
Manager::getDefault()->removeMessagesForTimer(this);
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer::start()
|
void Timer::start()
|
||||||
@ -54,6 +54,12 @@ void Timer::start()
|
|||||||
void Timer::stop()
|
void Timer::stop()
|
||||||
{
|
{
|
||||||
m_running = false;
|
m_running = false;
|
||||||
|
|
||||||
|
// Remove messages of this timer in the queue. The expected behavior
|
||||||
|
// is that when we stop a timer, we'll not receive more messages
|
||||||
|
// about it (even if there are enqueued messages waiting in the
|
||||||
|
// message queue).
|
||||||
|
Manager::getDefault()->removeMessagesForTimer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer::tick()
|
void Timer::tick()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user