Commit 9fa02824 authored by Jan Hambrecht's avatar Jan Hambrecht

fix setting the shape psotion with setPosition when shape is already transformed

removed recalcMatrix and made notifyChanged public as that was called inside
recalcMatrix anyway


svn path=/trunk/koffice/; revision=683020
parent 2bdd0826
......@@ -112,7 +112,7 @@ public:
KoShape::KoShape()
: d(new Private(this))
{
recalcMatrix();
notifyChanged();
}
KoShape::~KoShape()
......@@ -150,7 +150,7 @@ void KoShape::scale( double sx, double sy )
scaleMatrix.translate( -pos.x(), -pos.y() );
applyTransformation( scaleMatrix );
recalcMatrix();
notifyChanged();
d->shapeChanged(ScaleChanged);
}
......@@ -163,7 +163,7 @@ void KoShape::rotate( double angle )
rotateMatrix.translate( -center.x(), -center.y() );
d->localMatrix = rotateMatrix * d->localMatrix;
recalcMatrix();
notifyChanged();
d->shapeChanged(RotationChanged);
}
......@@ -176,7 +176,7 @@ void KoShape::shear( double sx, double sy )
shearMatrix.translate( -pos.x(), -pos.y() );
d->localMatrix = shearMatrix * d->localMatrix;
recalcMatrix();
notifyChanged();
d->shapeChanged(ShearChanged);
}
......@@ -197,7 +197,7 @@ void KoShape::resize( const QSizeF &newSize )
point.setX(point.x() * fx);
point.setY(point.y() * fy);
}
recalcMatrix();
notifyChanged();
d->shapeChanged(SizeChanged);
}
......@@ -206,8 +206,11 @@ void KoShape::setPosition( const QPointF &position )
QPointF currentPos = d->localMatrix.map( QPointF(0,0) );
if( position == currentPos )
return;
d->localMatrix.translate( position.x()-currentPos.x(), position.y()-currentPos.y() );
recalcMatrix();
QMatrix translateMatrix;
translateMatrix.translate( position.x()-currentPos.x(), position.y()-currentPos.y() );
d->localMatrix = d->localMatrix * translateMatrix;
notifyChanged();
d->shapeChanged(PositionChanged);
}
......@@ -237,11 +240,6 @@ QRectF KoShape::boundingRect() const
return transformationMatrix(0).mapRect( bb );
}
void KoShape::recalcMatrix()
{
notifyChanged();
}
QMatrix KoShape::transformationMatrix(const KoViewConverter *converter) const {
QMatrix matrix;
// apply parents matrix to inherit any transformations done there.
......@@ -312,7 +310,7 @@ void KoShape::setParent(KoShapeContainer *parent) {
}
else
d->parent = 0;
recalcMatrix();
notifyChanged();
d->shapeChanged(ParentChanged);
}
......@@ -370,7 +368,7 @@ void KoShape::setAbsolutePosition(QPointF newPosition, KoFlake::Position anchor)
QPointF currentAbsPosition = absolutePosition( anchor );
QPointF translate = newPosition - currentAbsPosition;
d->localMatrix.translate( translate.x(), translate.y() );
recalcMatrix();
notifyChanged();
d->shapeChanged(PositionChanged);
}
......
......@@ -411,11 +411,6 @@ public:
*/
static bool compareShapeZIndex(KoShape *s1, KoShape *s2);
/**
* Called internally whenever a property is changed that requires the matrix to be recalculated.
*/
void recalcMatrix();
/**
* returns the outline of the shape in the form of a path.
* The outline returned will always have the position() of the shape as the origin, so
......@@ -587,6 +582,11 @@ public:
*/
void setName( const QString & name );
/**
* Update the position of the shape in the tree of the KoShapeManager.
*/
void notifyChanged();
protected:
......@@ -647,11 +647,6 @@ protected:
/* ** end loading saving */
/**
* Update the position of the shape in the tree of the KoShapeManager.
*/
void notifyChanged();
/**
* A hook that allows inheriting classes to do something after a KoShape property changed
* This is called whenever the shape, position rotation or scale properties were altered.
......
......@@ -45,7 +45,7 @@ public:
return;
relation->m_inside = clipping;
relation->child()->repaint();
relation->child()->recalcMatrix();
relation->child()->notifyChanged();
relation->child()->repaint();
}
......@@ -228,7 +228,7 @@ void KoShapeContainer::shapeChanged(ChangeType type) {
return;
d->children->containerChanged(this);
foreach (KoShape *shape, d->children->iterator())
shape->recalcMatrix();
shape->notifyChanged();
}
bool KoShapeContainer::childClipped(const KoShape *child) 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