[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-25 15:03:41
Message-ID: 1148569421.416852.8952.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 544628 by zander:
* Fix rescaling of shapes giving weird results when they were nested shapes.
* Make sure its impossible to make a shape too small or even negative sized
M +5 -4 KoShapeResizeStrategy.cpp
--- trunk/playground/office/flake/lib/KoShapeResizeStrategy.cpp #544627:544628
@@ -33,7 +33,7 @@
KoSelectionSet selectedObjects = \
canvas->shapeManager()->selection()->selectedObjects(KoFlake::StrippedSelection); \
foreach(KoShape *shape, selectedObjects) { m_selectedObjects << shape;
- m_startPositions << shape->position();
+ m_startPositions << shape->absolutePosition();
m_startSizes << shape->size();
m_initialBoundingRect = m_initialBoundingRect.unite( shape->boundingBox() );
}
@@ -70,7 +70,6 @@
if(m_canvas->snapToGrid() && (event->modifiers() & Qt::ShiftModifier) == 0)
applyGrid(distance);
-
double startWidth = m_initialBoundingRect.width();
double startHeight = m_initialBoundingRect.height();
QMatrix matrix;
@@ -113,7 +112,7 @@
else if(m_bottom)
zoomY = (startHeight + distance.y()) / startHeight;
}
- matrix.scale(zoomX, zoomY);
+ matrix.scale(qMax(0.0, zoomX), qMax(0.0, zoomY));
if(scaleFromCenter) // and back
matrix.translate(-startWidth / 2.0, -startHeight / 2.0);
else
@@ -123,8 +122,10 @@
foreach(KoShape *shape, m_selectedObjects) {
QRectF rect(m_startPositions.at(i) - m_initialBoundingRect.topLeft(), \
m_startSizes.at(i)); QRectF result = matrix.mapRect(rect);
+ result.setWidth(qMax(4.0, result.width()));
+ result.setHeight(qMax(4.0, result.height()));
shape->repaint();
- shape->setPosition( result.topLeft() + m_initialBoundingRect.topLeft() );
+ shape->setAbsolutePosition( result.topLeft() + \
m_initialBoundingRect.topLeft() ); shape->resize( result.size() );
shape->repaint();
i++;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic