From 9d5e58f32b14dd2f65789ccc45ed33b96e7efa3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Thu, 14 May 2020 17:15:39 +0200 Subject: [PATCH] [escher/scroll_view] Do not compute offset if view invisible --- escher/src/scroll_view.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/escher/src/scroll_view.cpp b/escher/src/scroll_view.cpp index 294ec5350..ec06497d9 100644 --- a/escher/src/scroll_view.cpp +++ b/escher/src/scroll_view.cpp @@ -53,9 +53,16 @@ void ScrollView::scrollToContentPoint(KDPoint p, bool allowOverscroll) { if (!allowOverscroll && !m_contentView->bounds().contains(p)) { return; } + + KDRect visibleRect = visibleContentRect(); + + if (visibleRect.width() < 0 || visibleRect.height() < 0) { + return; + } + KDCoordinate offsetX = 0; KDCoordinate offsetY = 0; - KDRect visibleRect = visibleContentRect(); + if (visibleRect.left() > p.x()) { offsetX = p.x() - visibleRect.left(); }