Commit b6f20114 authored by Fabio D'Urso's avatar Fabio D'Urso
Browse files

PickPointEngine: make sure that new annotations are within page limits

parent 13fd564f
......@@ -178,7 +178,6 @@ class PickPointEngine : public AnnotatorEngine
Qt::AlignTop | Qt::AlignLeft | Qt::TextWordWrap, ta->inplaceText() );
rect.right = qMax(rect.right, rect.left+(rcf.width()+padding*2)/pagewidth);
rect.bottom = qMax(rect.bottom, rect.top+(rcf.height()+padding*2)/pageheight);
ta->setBoundingRectangle( this->rect );
ta->window().setSummary( i18n( "Inline Note" ) );
}
}
......@@ -195,7 +194,6 @@ class PickPointEngine : public AnnotatorEngine
rect.top = point.y;
rect.right=rect.left+iconhei;
rect.bottom=rect.top+iconhei*xscale/yscale;
ta->setBoundingRectangle( this->rect );
ta->window().setSummary( i18n( "Note" ) );
}
// create StampAnnotation from path
......@@ -228,7 +226,6 @@ class PickPointEngine : public AnnotatorEngine
rect.right = rect.left + stampxscale;
rect.bottom = rect.top + stampyscale;
}
sa->setBoundingRectangle( rect );
}
// create GeomAnnotation
else if ( typeString == "GeomSquare" || typeString == "GeomCircle" )
......@@ -246,7 +243,6 @@ class PickPointEngine : public AnnotatorEngine
rect.top = qMin( startpoint.y, point.y );
rect.right = qMax( startpoint.x, point.x );
rect.bottom = qMax( startpoint.y, point.y );
ga->setBoundingRectangle( rect );
}
// safety check
......@@ -259,6 +255,20 @@ class PickPointEngine : public AnnotatorEngine
if ( m_annotElement.hasAttribute( "opacity" ) )
ann->style().setOpacity( m_annotElement.attribute( "opacity", "1.0" ).toDouble() );
// set the bounding rectangle, and make sure that the newly created
// annotation lies within the page by translating it if necessary
if ( rect.right > 1 )
{
rect.left -= rect.right - 1;
rect.right = 1;
}
if ( rect.bottom > 1 )
{
rect.top -= rect.bottom - 1;
rect.bottom = 1;
}
ann->setBoundingRectangle( rect );
// return annotation
return QList< Okular::Annotation* >() << ann;
}
......
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