From 5d947905f754ad0c11b1c77e4a34a2ecefa75802 Mon Sep 17 00:00:00 2001 From: Pedro Arthur Pinheiro Rosa Duarte Date: Mon, 7 Sep 2020 05:56:28 +0000 Subject: [PATCH] Remove artifact while navigating though pages When the view is paged (ie, non continuous), and an annotation is selected while the user navigate through pages, the annotation selection will become an artifact in other pages. Besides that, the annotation will still receive keystrokes (such as delete). Steps to Reproduce: - Open a PDF file with Okular - Draw an ellipsis annotation in the document - Select the ellipsis - Change to the previous or next page --- ui/pageview.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/pageview.cpp b/ui/pageview.cpp index 9c5bdd710..cf792aa0f 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -1427,6 +1427,14 @@ void PageView::notifyCurrentPageChanged(int previous, int current) } } } + + // if the view is paged (or not continuous) and there is a selected annotation, + // we call reset to avoid creating an artifact in the next page. + if (!Okular::Settings::viewContinuous()) { + if (d->mouseAnnotation && d->mouseAnnotation->isFocused()) { + d->mouseAnnotation->reset(); + } + } } // END DocumentObserver inherited methods