Fix some scrolling issues in Timeline when clicking in a new cel

This commit is contained in:
David Capello 2015-09-17 16:39:55 -03:00
parent 43b3df52b9
commit 581fbb6632
2 changed files with 13 additions and 3 deletions

View File

@ -41,6 +41,7 @@
#include "app/util/clipboard.h"
#include "base/convert_to.h"
#include "base/memory.h"
#include "base/scoped_value.h"
#include "doc/doc.h"
#include "doc/document_event.h"
#include "doc/frame_tag.h"
@ -131,6 +132,7 @@ Timeline::Timeline()
, m_clipboard_timer(100, this)
, m_offset_count(0)
, m_scroll(false)
, m_fromTimeline(false)
{
m_ctxConn = m_context->AfterCommandExecution.connect(
&Timeline::onAfterCommandExecution, this);
@ -360,6 +362,7 @@ bool Timeline::onProcessMessage(Message* msg)
break;
}
case PART_LAYER_TEXT: {
base::ScopedValue<bool> lock(m_fromTimeline, true, false);
LayerIndex old_layer = getLayerIndex(m_layer);
bool selectLayer = (mouseMsg->left() || !isLayerActive(m_clk.layer));
@ -387,6 +390,7 @@ bool Timeline::onProcessMessage(Message* msg)
case PART_LAYER_CONTINUOUS_ICON:
break;
case PART_CEL: {
base::ScopedValue<bool> lock(m_fromTimeline, true, false);
LayerIndex old_layer = getLayerIndex(m_layer);
bool selectCel = (mouseMsg->left()
|| !isLayerActive(m_clk.layer)
@ -1113,6 +1117,9 @@ void Timeline::onStateChanged(Editor* editor)
void Timeline::onAfterFrameChanged(Editor* editor)
{
if (m_fromTimeline)
return;
setFrame(editor->frame());
if (!hasCapture())
@ -1124,6 +1131,9 @@ void Timeline::onAfterFrameChanged(Editor* editor)
void Timeline::onAfterLayerChanged(Editor* editor)
{
if (m_fromTimeline)
return;
setLayer(editor->layer());
if (!hasCapture())

View File

@ -84,9 +84,6 @@ namespace app {
Layer* getLayer() { return m_layer; }
frame_t getFrame() { return m_frame; }
void setLayer(Layer* layer);
void setFrame(frame_t frame);
State getState() const { return m_state; }
bool isMovingCel() const;
@ -185,6 +182,8 @@ namespace app {
int xpos, ypos;
};
void setLayer(Layer* layer);
void setFrame(frame_t frame);
bool allLayersVisible();
bool allLayersInvisible();
bool allLayersLocked();
@ -287,6 +286,7 @@ namespace app {
bool m_scroll; // True if the drag-and-drop operation is a scroll operation.
bool m_copy; // True if the drag-and-drop operation is a copy.
bool m_fromTimeline;
AniControls m_aniControls;