Commit 5b67d432 authored by Jan Hambrecht's avatar Jan Hambrecht

use outline of shape to determine if it was hit or not


svn path=/trunk/koffice/; revision=873510
parent 26fbef0a
......@@ -249,15 +249,19 @@ bool KoShape::hitTest(const QPointF &position) const
return false;
QPointF point = absoluteTransformation(0).inverted().map(position);
QRectF bb(QPointF(), size());
const QPainterPath outlinePath = outline();
if (d->border) {
KoInsets insets;
d->border->borderInsets(this, insets);
bb.adjust(-insets.left, -insets.top, insets.right, insets.bottom);
QRectF roi( QPointF(-insets.left, -insets.top), QPointF(insets.right, insets.bottom) );
roi.moveCenter( point );
if( outlinePath.intersects( roi ) || outlinePath.contains( roi ) )
return true;
} else {
if( outlinePath.contains( point ) )
return true;
}
if (bb.contains(point))
return true;
// if there is no shadow we can as well just leave
if (! d->shadow)
return false;
......@@ -266,7 +270,7 @@ bool KoShape::hitTest(const QPointF &position) const
// check if the position minus the shadow offset hits the shape
point = absoluteTransformation(0).inverted().map(position - d->shadow->offset());
return bb.contains(point);
return outlinePath.contains(point);
}
QRectF KoShape::boundingRect() const
......
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