From 3656d8ea47820099c595d6343fc6da9f882eefc3 Mon Sep 17 00:00:00 2001 From: Fabio D'Urso Date: Sun, 16 Dec 2012 19:35:04 +0100 Subject: [PATCH] Force minimum AnnotationObjectRect size So that it's easier to select thin horizontal/vertical lines --- core/area.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/area.cpp b/core/area.cpp index 825976079..d772fc0df 100644 --- a/core/area.cpp +++ b/core/area.cpp @@ -370,7 +370,15 @@ Annotation *AnnotationObjectRect::annotation() const QRect AnnotationObjectRect::boundingRect( double xScale, double yScale ) const { - return AnnotationUtils::annotationGeometry( m_annotation, xScale, yScale ); + const QRect annotRect = AnnotationUtils::annotationGeometry( m_annotation, xScale, yScale ); + const QPoint center = annotRect.center(); + + // Make sure that the rectangle has a minimum size, so that it's possible + // to click on it + const int minSize = 14; + const QRect minRect( center.x()-minSize/2, center.y()-minSize/2, minSize, minSize ); + + return annotRect | minRect; } bool AnnotationObjectRect::contains( double x, double y, double xScale, double yScale ) const