diff --git a/src/app/ui/doc_view.h b/src/app/ui/doc_view.h index 1dce2ff8a..4b703d049 100644 --- a/src/app/ui/doc_view.h +++ b/src/app/ui/doc_view.h @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019-2020 Igara Studio S.A. +// Copyright (C) 2019-2023 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -55,6 +55,10 @@ namespace app { bool isPreview() { return m_type == Preview; } + // Preferred timeline scroll + const gfx::Point& timelineScroll() { return m_timelineScroll; } + void setTimelineScroll(const gfx::Point& pt) { m_timelineScroll = pt; } + // TabView implementation std::string getTabText() override; TabIcon getTabIcon() override; @@ -106,6 +110,7 @@ namespace app { ui::View* m_view; DocViewPreviewDelegate* m_previewDelegate; Editor* m_editor; + gfx::Point m_timelineScroll; }; } // namespace app diff --git a/src/app/ui/timeline/timeline.cpp b/src/app/ui/timeline/timeline.cpp index 277d4c572..a02da5883 100644 --- a/src/app/ui/timeline/timeline.cpp +++ b/src/app/ui/timeline/timeline.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018-2022 Igara Studio S.A. +// Copyright (C) 2018-2023 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -390,7 +390,7 @@ void Timeline::updateUsingEditor(Editor* editor) setFocusStop(true); regenerateRows(); - setViewScroll(viewScroll()); + setViewScroll(view->timelineScroll()); showCurrentCel(); } @@ -417,6 +417,9 @@ void Timeline::detachDocument() m_dropRange.clearRange(); if (m_editor) { + if (DocView* view = m_editor->getDocView()) + view->setTimelineScroll(viewScroll()); + m_editor->remove_observer(this); m_editor = nullptr; }