[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/office/flake/lib
From: Thomas Zander <zander () kde ! org>
Date: 2006-05-24 12:18:06
Message-ID: 1148473086.629417.25451.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 544297 by zander:
For nested objects the rotation didn't work since the calculated position
was wrong and the object just swirled all over the canvas.
With the introduction of get/set absolute position thats easy to solve.
Fixed the rotation for nested shapes
M +3 -4 KoShapeRotateStrategy.cpp
--- trunk/playground/office/flake/lib/KoShapeRotateStrategy.cpp #544296:544297
@@ -39,7 +39,7 @@
if(shape->isLocked())
continue;
m_selectedObjects << shape;
- m_startPositions << shape->position();
+ m_startPositions << shape->absolutePosition();
m_initialAngles << shape->rotation();
m_initialBoundingRect = m_initialBoundingRect.unite( shape->boundingBox() );
}
@@ -63,13 +63,12 @@
QMatrix matrix;
matrix.translate(center.x(), center.y());
matrix.rotate(angle);
+ matrix.translate(-center.x(), -center.y());
int counter=0;
foreach(KoShape *shape, m_selectedObjects) {
shape->repaint();
- QPointF centerOfShape(shape->size().width()/2, shape->size().height()/2);
- QPointF newCenter = matrix.map(m_startPositions[counter] + centerOfShape - center);
- shape->setPosition(newCenter - centerOfShape);
+ shape->setAbsolutePosition(matrix.map(m_startPositions[counter]));
shape->rotate(m_initialAngles[counter] + angle);
shape->repaint();
counter++;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic