mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-14 18:40:55 +00:00
Fix bug keeping the modified range different than the visible range when moving pixels
When we clicked the current cel/frame/layer on MovingPixelsState in the Timeline, we weren't dropping the pixels, so the range was different in the Timeline UI, but we were using the old site range which was different (bigger) than the Timeline range. Fixes several bugs: https://community.aseprite.org/t/8618
This commit is contained in:
parent
169cfa39cf
commit
67eeac8045
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
// Copyright (C) 2019-2021 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -35,6 +35,7 @@
|
|||||||
#include "app/ui/keyboard_shortcuts.h"
|
#include "app/ui/keyboard_shortcuts.h"
|
||||||
#include "app/ui/main_window.h"
|
#include "app/ui/main_window.h"
|
||||||
#include "app/ui/status_bar.h"
|
#include "app/ui/status_bar.h"
|
||||||
|
#include "app/ui/timeline/timeline.h"
|
||||||
#include "app/ui_context.h"
|
#include "app/ui_context.h"
|
||||||
#include "app/util/clipboard.h"
|
#include "app/util/clipboard.h"
|
||||||
#include "app/util/layer_utils.h"
|
#include "app/util/layer_utils.h"
|
||||||
@ -113,10 +114,14 @@ MovingPixelsState::MovingPixelsState(Editor* editor, MouseMessage* msg, PixelsMo
|
|||||||
ContextBar* contextBar = App::instance()->contextBar();
|
ContextBar* contextBar = App::instance()->contextBar();
|
||||||
contextBar->updateForMovingPixels();
|
contextBar->updateForMovingPixels();
|
||||||
contextBar->add_observer(this);
|
contextBar->add_observer(this);
|
||||||
|
|
||||||
|
App::instance()->mainWindow()->getTimeline()->add_observer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
MovingPixelsState::~MovingPixelsState()
|
MovingPixelsState::~MovingPixelsState()
|
||||||
{
|
{
|
||||||
|
App::instance()->mainWindow()->getTimeline()->remove_observer(this);
|
||||||
|
|
||||||
ContextBar* contextBar = App::instance()->contextBar();
|
ContextBar* contextBar = App::instance()->contextBar();
|
||||||
contextBar->remove_observer(this);
|
contextBar->remove_observer(this);
|
||||||
contextBar->updateForActiveTool();
|
contextBar->updateForActiveTool();
|
||||||
@ -712,6 +717,15 @@ void MovingPixelsState::onBeforeLayerChanged(Editor* editor)
|
|||||||
dropPixels();
|
dropPixels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MovingPixelsState::onBeforeRangeChanged(Timeline* timeline)
|
||||||
|
{
|
||||||
|
if (!isActiveDocument())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_pixelsMovement)
|
||||||
|
dropPixels();
|
||||||
|
}
|
||||||
|
|
||||||
void MovingPixelsState::onTransparentColorChange()
|
void MovingPixelsState::onTransparentColorChange()
|
||||||
{
|
{
|
||||||
ASSERT(m_pixelsMovement);
|
ASSERT(m_pixelsMovement);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
// Copyright (C) 2019-2021 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -15,6 +15,7 @@
|
|||||||
#include "app/ui/editor/pixels_movement.h"
|
#include "app/ui/editor/pixels_movement.h"
|
||||||
#include "app/ui/editor/standby_state.h"
|
#include "app/ui/editor/standby_state.h"
|
||||||
#include "app/ui/status_bar.h"
|
#include "app/ui/status_bar.h"
|
||||||
|
#include "app/ui/timeline/timeline_observer.h"
|
||||||
#include "obs/connection.h"
|
#include "obs/connection.h"
|
||||||
#include "ui/timer.h"
|
#include "ui/timer.h"
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ namespace app {
|
|||||||
class MovingPixelsState
|
class MovingPixelsState
|
||||||
: public StandbyState
|
: public StandbyState
|
||||||
, EditorObserver
|
, EditorObserver
|
||||||
|
, TimelineObserver
|
||||||
, ContextBarObserver {
|
, ContextBarObserver {
|
||||||
public:
|
public:
|
||||||
MovingPixelsState(Editor* editor, ui::MouseMessage* msg, PixelsMovementPtr pixelsMovement, HandleType handle);
|
MovingPixelsState(Editor* editor, ui::MouseMessage* msg, PixelsMovementPtr pixelsMovement, HandleType handle);
|
||||||
@ -63,6 +65,9 @@ namespace app {
|
|||||||
virtual void onBeforeFrameChanged(Editor* editor) override;
|
virtual void onBeforeFrameChanged(Editor* editor) override;
|
||||||
virtual void onBeforeLayerChanged(Editor* editor) override;
|
virtual void onBeforeLayerChanged(Editor* editor) override;
|
||||||
|
|
||||||
|
// TimelineObserver
|
||||||
|
virtual void onBeforeRangeChanged(Timeline* timeline) override;
|
||||||
|
|
||||||
// ContextBarObserver
|
// ContextBarObserver
|
||||||
virtual void onDropPixels(ContextBarObserver::DropAction action) override;
|
virtual void onDropPixels(ContextBarObserver::DropAction action) override;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
// Copyright (C) 2018-2021 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -3889,6 +3889,8 @@ void Timeline::invalidateRange()
|
|||||||
void Timeline::clearAndInvalidateRange()
|
void Timeline::clearAndInvalidateRange()
|
||||||
{
|
{
|
||||||
if (m_range.enabled()) {
|
if (m_range.enabled()) {
|
||||||
|
notify_observers(&TimelineObserver::onBeforeRangeChanged, this);
|
||||||
|
|
||||||
invalidateRange();
|
invalidateRange();
|
||||||
m_range.clearRange();
|
m_range.clearRange();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
// Copyright (C) 2018-2021 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -10,19 +10,21 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "app/doc_observer.h"
|
#include "app/doc_observer.h"
|
||||||
#include "app/docs_observer.h"
|
|
||||||
#include "app/doc_range.h"
|
#include "app/doc_range.h"
|
||||||
|
#include "app/docs_observer.h"
|
||||||
#include "app/loop_tag.h"
|
#include "app/loop_tag.h"
|
||||||
#include "app/pref/preferences.h"
|
#include "app/pref/preferences.h"
|
||||||
#include "app/ui/editor/editor_observer.h"
|
#include "app/ui/editor/editor_observer.h"
|
||||||
#include "app/ui/input_chain_element.h"
|
#include "app/ui/input_chain_element.h"
|
||||||
#include "app/ui/timeline/ani_controls.h"
|
#include "app/ui/timeline/ani_controls.h"
|
||||||
|
#include "app/ui/timeline/timeline_observer.h"
|
||||||
#include "doc/frame.h"
|
#include "doc/frame.h"
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/selected_frames.h"
|
#include "doc/selected_frames.h"
|
||||||
#include "doc/selected_layers.h"
|
#include "doc/selected_layers.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
#include "obs/connection.h"
|
#include "obs/connection.h"
|
||||||
|
#include "obs/observable.h"
|
||||||
#include "ui/scroll_bar.h"
|
#include "ui/scroll_bar.h"
|
||||||
#include "ui/timer.h"
|
#include "ui/timer.h"
|
||||||
#include "ui/widget.h"
|
#include "ui/widget.h"
|
||||||
@ -57,6 +59,7 @@ namespace app {
|
|||||||
|
|
||||||
class Timeline : public ui::Widget,
|
class Timeline : public ui::Widget,
|
||||||
public ui::ScrollableViewDelegate,
|
public ui::ScrollableViewDelegate,
|
||||||
|
public obs::observable<TimelineObserver>,
|
||||||
public ContextObserver,
|
public ContextObserver,
|
||||||
public DocsObserver,
|
public DocsObserver,
|
||||||
public DocObserver,
|
public DocObserver,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user