From a77300f96a3a2531530bb5c6bae0392f2f77a926 Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 6 Feb 2015 12:50:46 -0300 Subject: [PATCH] Keep editor scroll when the timeline is hidden/shown This is not complete yet, there is a little flicker. --- src/app/ui/editor/editor_view.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/app/ui/editor/editor_view.cpp b/src/app/ui/editor/editor_view.cpp index e18290584..5bda3a02c 100644 --- a/src/app/ui/editor/editor_view.cpp +++ b/src/app/ui/editor/editor_view.cpp @@ -87,10 +87,19 @@ void EditorView::onPaint(PaintEvent& ev) void EditorView::onResize(ResizeEvent& ev) { - // This avoid the displacement of the widgets in the viewport + Editor* editor = this->editor(); + gfx::Point oldPos; + if (editor) + oldPos = editor->editorToScreen(gfx::Point(0, 0)); - setBoundsQuietly(ev.getBounds()); - updateView(); + View::onResize(ev); + + if (editor) { + // This keeps the same scroll position for the editor + gfx::Point newPos = editor->editorToScreen(gfx::Point(0, 0)); + gfx::Point oldScroll = getViewScroll(); + editor->setEditorScroll(oldScroll + newPos - oldPos, false); + } } void EditorView::onScrollChange()