Don't jump inside "Loop" tag w/next/previous frame within tag when we are outside the tag (fix #1756)

This commit is contained in:
David Capello 2018-06-19 14:35:00 -03:00
parent a0c0b1c8e2
commit e82404e3ba
7 changed files with 21 additions and 17 deletions

View File

@ -99,7 +99,7 @@ protected:
FrameTag* tag = editor
->getCustomizationDelegate()
->getFrameTagProvider()
->getFrameTagByFrame(frame);
->getFrameTagByFrame(frame, false);
frame_t first = (tag ? tag->fromFrame(): 0);
frame_t last = (tag ? tag->toFrame(): editor->sprite()->lastFrame());
@ -118,7 +118,7 @@ protected:
FrameTag* tag = editor
->getCustomizationDelegate()
->getFrameTagProvider()
->getFrameTagByFrame(frame);
->getFrameTagByFrame(frame, false);
frame_t first = (tag ? tag->fromFrame(): 0);
frame_t last = (tag ? tag->toFrame(): editor->sprite()->lastFrame());

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -19,10 +19,7 @@ const char* kLoopTagName = "Loop";
doc::FrameTag* get_animation_tag(const doc::Sprite* sprite, doc::frame_t frame)
{
doc::FrameTag* tag = sprite->frameTags().innerTag(frame);
if (!tag)
tag = get_loop_tag(sprite);
return tag;
return sprite->frameTags().innerTag(frame);
}
doc::FrameTag* get_loop_tag(const doc::Sprite* sprite)

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2017 David Capello
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -20,7 +20,8 @@ namespace app {
class FrameTagProvider {
public:
virtual ~FrameTagProvider() { }
virtual doc::FrameTag* getFrameTagByFrame(const doc::frame_t frame) = 0;
virtual doc::FrameTag* getFrameTagByFrame(const doc::frame_t frame,
const bool getLoopTagIfNone) = 0;
};
doc::FrameTag* get_animation_tag(const doc::Sprite* sprite, doc::frame_t frame);

View File

@ -64,7 +64,7 @@ void PlayState::onEnterState(Editor* editor)
m_tag = m_editor
->getCustomizationDelegate()
->getFrameTagProvider()
->getFrameTagByFrame(m_refFrame);
->getFrameTagByFrame(m_refFrame, true);
// Go to the first frame of the animation or active frame tag
if (m_playOnce) {

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2017 David Capello
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -384,12 +384,12 @@ void PreviewEditorWindow::updateUsingEditor(Editor* editor)
doc::FrameTag* tag = editor
->getCustomizationDelegate()
->getFrameTagProvider()
->getFrameTagByFrame(editor->frame());
->getFrameTagByFrame(editor->frame(), true);
doc::FrameTag* playingTag = editor
->getCustomizationDelegate()
->getFrameTagProvider()
->getFrameTagByFrame(m_refFrame);
->getFrameTagByFrame(m_refFrame, true);
if (tag == playingTag)
return;

View File

@ -558,13 +558,18 @@ void Timeline::activateClipboardRange()
invalidate();
}
FrameTag* Timeline::getFrameTagByFrame(const frame_t frame)
FrameTag* Timeline::getFrameTagByFrame(const frame_t frame,
const bool getLoopTagIfNone)
{
if (!m_sprite)
return nullptr;
if (m_tagFocusBand < 0)
return get_animation_tag(m_sprite, frame);
if (m_tagFocusBand < 0) {
FrameTag* tag = get_animation_tag(m_sprite, frame);
if (!tag && getLoopTagIfNone)
tag = get_loop_tag(m_sprite);
return tag;
}
for (FrameTag* frameTag : m_sprite->frameTags()) {
if (frame >= frameTag->fromFrame() &&

View File

@ -116,7 +116,8 @@ namespace app {
// Returns the active frame tag depending on the timeline status
// E.g. if other frame tags are collapsed, the focused band has
// priority and tags in other bands are ignored.
FrameTag* getFrameTagByFrame(const frame_t frame) override;
FrameTag* getFrameTagByFrame(const frame_t frame,
const bool getLoopTagIfNone) override;
// ScrollableViewDelegate impl
gfx::Size visibleSize() const override;