diff --git a/ui/pageviewannotator.cpp b/ui/pageviewannotator.cpp --- a/ui/pageviewannotator.cpp +++ b/ui/pageviewannotator.cpp @@ -36,6 +36,7 @@ #include "core/document.h" #include "core/page.h" #include "core/annotations.h" +#include "core/utils.h" #include "settings.h" #include "annotationtools.h" #include "guiutils.h" @@ -209,12 +210,14 @@ ann = ta; ta->setTextType( Okular::TextAnnotation::Linked ); ta->setTextIcon( iconName ); - //ta->window.flags &= ~(Okular::Annotation::Hidden); - const double iconhei=0.03; + // Calculate annotation width so that icon will be 1/3 inch (i.e. 24 pts) on screen. + // This is required so that painted rectangles match around icons rendered by Poppler. + // Poppler enforces 24x24 pts for embedded appearance icons regardless of what we set here. + double iconWidth = Okular::Utils::realDpi(nullptr).width() / ( 3. * pagewidth ); rect.left = point.x; rect.top = point.y; - rect.right=rect.left+iconhei; - rect.bottom=rect.top+iconhei*xscale/yscale; + rect.right = rect.left + iconWidth; + rect.bottom = rect.top + iconWidth * xscale / yscale; ta->window().setSummary( i18n( "Pop-up Note" ) ); } // create StampAnnotation from path diff --git a/ui/pageviewmouseannotation.cpp b/ui/pageviewmouseannotation.cpp --- a/ui/pageviewmouseannotation.cpp +++ b/ui/pageviewmouseannotation.cpp @@ -261,15 +261,10 @@ if ( !isFocused() ) return; - /* - * Get annotation bounding rectangle in uncropped page coordinates. - * Distinction between AnnotationUtils::annotationGeometry() and AnnotationObjectRect::boundingRect() is, - * that boundingRect would enlarge the QRect to a minimum size of 14 x 14. - * This is useful for getting focus an a very small annotation, - * but for drawing and modification we want the real size. - */ - const QRect boundingRect = Okular::AnnotationUtils::annotationGeometry( - m_focusedAnnotation.annotation, m_focusedAnnotation.pageViewItem->uncroppedWidth(), + + /* Get annotation bounding rectangle in uncropped page coordinates */ + const QRect boundingRect = m_focusedAnnotation.annotation->transformedBoundingRectangle().geometry( + m_focusedAnnotation.pageViewItem->uncroppedWidth(), m_focusedAnnotation.pageViewItem->uncroppedHeight() ); if ( !paintRect.intersects( boundingRect