Set same scroll position in timeline after updating scrollable area

This fixes the following problem:

* Hide the Timeline, and restart the program
* Open a sprite with a lot of layers
* Show the Timeline

Without this fix, depending on the selected layer the scroll will be
invalid and the layer will not be displayed by default when the
Timeline appears.

Related to 229ded9642
This commit is contained in:
David Capello 2022-01-11 11:32:30 -03:00
parent f9d41665f0
commit 0f04e016b6

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A. // Copyright (C) 2018-2022 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
@ -304,7 +304,6 @@ void Timeline::setZoomAndUpdate(const double zoom,
setZoom(zoom); setZoom(zoom);
regenerateTagBands(); regenerateTagBands();
updateScrollBars(); updateScrollBars();
setViewScroll(viewScroll());
invalidate(); invalidate();
} }
if (updatePref && zoom != docPref().thumbnails.zoom()) { if (updatePref && zoom != docPref().thumbnails.zoom()) {
@ -3192,6 +3191,8 @@ void Timeline::updateScrollBars()
m_viewportArea, *this, m_viewportArea, *this,
m_hbar, m_hbar,
m_vbar); m_vbar);
setViewScroll(viewScroll());
} }
void Timeline::updateByMousePos(ui::Message* msg, const gfx::Point& mousePos) void Timeline::updateByMousePos(ui::Message* msg, const gfx::Point& mousePos)