Commit 81a18bcf authored by Jan Hambrecht's avatar Jan Hambrecht

This commit fixes the calculation of absolute transformation matrix

when a view converter is given. This could be seen when rotating a
selection where the painted shapes and the painted selection rect
did not match anymore. This has also the neat sideeffect that
KoShape::applyConversion is not needed anymore. This will get removed
next.

BUG:171969


svn path=/trunk/koffice/; revision=869031
parent c8faf4c3
......@@ -295,21 +295,22 @@ QMatrix KoShape::absoluteTransformation(const KoViewConverter *converter) const
if (container->childClipped(this))
matrix = container->absoluteTransformation(0);
else {
QSizeF containerSize = container->size();
QPointF containerPos = container->absolutePosition() - QPointF(0.5 * containerSize.width(), 0.5 * containerSize.height());
if (converter)
containerPos = converter->documentToView(containerPos);
// childs trasformations are relative to the parents position
QRectF containerRect( QPointF(), container->size() );
QPointF containerPos = container->absolutePosition() - containerRect.center();
matrix.translate(containerPos.x(), containerPos.y());
}
}
QMatrix scaleMatrix;
// calculate the scaling if a view converter is given
if (converter) {
QPointF pos = d->localMatrix.map(QPointF());
QPointF trans = converter->documentToView(pos) - pos;
matrix.translate(trans.x(), trans.y());
qreal zoomX, zoomY;
converter->zoom(&zoomX, &zoomY);
scaleMatrix.scale(zoomX, zoomY);
}
return d->localMatrix * matrix;
return d->localMatrix * matrix * scaleMatrix;
}
void KoShape::applyAbsoluteTransformation(const QMatrix &matrix)
......@@ -1140,9 +1141,11 @@ void KoShape::init(const QMap<QString, KoDataCenter *> & dataCenterMap)
// static
void KoShape::applyConversion(QPainter &painter, const KoViewConverter &converter)
{
/*
qreal zoomX, zoomY;
converter.zoom(&zoomX, &zoomY);
painter.scale(zoomX, zoomY);
*/
}
QPointF KoShape::shapeToDocument(const QPointF &point) 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