Commit ba973a68 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

Timeline: Properly clear the flickable when clearing the timeline



If zoomer.rangeDuration <= 0 we should set contentWidth and contentX to
0. Otherwise we get a long empty, but scrollable trace.

Change-Id: I1fcb5d75d220fdec609d1a7a2908f68d084d0f49
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
parent b1dd6c9d
......@@ -106,18 +106,21 @@ ScrollView {
// Scroll when the zoom control is updated
function scroll() {
if (recursionGuard || zoomer.rangeDuration <= 0)
if (recursionGuard)
return;
recursionGuard = true;
var newWidth = zoomer.windowDuration * scroller.width / zoomer.rangeDuration;
if (isFinite(newWidth) && Math.abs(newWidth - contentWidth) >= 1)
contentWidth = newWidth;
var newStartX = (zoomer.rangeStart - zoomer.windowStart) * scroller.width /
zoomer.rangeDuration;
if (isFinite(newStartX) && Math.abs(newStartX - contentX) >= 1)
contentX = newStartX;
if (zoomer.rangeDuration <= 0) {
contentWidth = 0;
contentX = 0;
} else {
var newWidth = zoomer.windowDuration * scroller.width / zoomer.rangeDuration;
if (isFinite(newWidth) && Math.abs(newWidth - contentWidth) >= 1)
contentWidth = newWidth;
var newStartX = (zoomer.rangeStart - zoomer.windowStart) * scroller.width /
zoomer.rangeDuration;
if (isFinite(newStartX) && Math.abs(newStartX - contentX) >= 1)
contentX = newStartX;
}
recursionGuard = false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment