resize of rotated applets -almost- correct.. almost..

svn path=/trunk/KDE/kdelibs/; revision=1021737
This commit is contained in:
Marco Martin 2009-09-09 22:24:49 +00:00
parent e1c7e86bcf
commit ae59b63602

View File

@ -664,22 +664,24 @@ void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
newSize.ry() = qMin(max.height(), qMax(min.height(), newSize.y())); newSize.ry() = qMin(max.height(), qMax(min.height(), newSize.y()));
} }
// move center such that the static corner remains in the same place
if (m_buttonsOnRight) { if (m_buttonsOnRight) {
newCenter = _k_rotatePoint(QPointF(rStaticPoint.x() + newSize.x()/2, newCenter = (QPointF(m_originalGeom.size().width(), m_originalGeom.size().height())/2 - newSize/2);
rStaticPoint.y() - newSize.y()/2), 0); newCenter = QPointF(0, newCenter.y()*2);
} else { } else {
newCenter = _k_rotatePoint(QPointF(rStaticPoint.x() - newSize.x()/2, newCenter = (QPointF(m_originalGeom.size().width(), m_originalGeom.size().height())/2 - newSize/2)*2;
rStaticPoint.y() - newSize.y()/2), 0);
} }
newAngle = m_angle; newAngle = m_angle;
} }
if (m_pressedButton == ResizeButton) { if (m_pressedButton == ResizeButton) {
// set applet size // set applet size
kDebug() << newCenter << m_originalGeom.topLeft() << newSize; kDebug() << newCenter << m_originalGeom.topLeft() << newSize;
m_applet->setPos(newCenter - (m_originalGeom.topLeft() + newSize/2)); QPointF newPos = m_originalGeom.topLeft() + _k_rotatePoint(newCenter, m_angle);
m_applet->setPos(newPos);
// m_applet->moveBy(newCenter.x(), newCenter.y());
m_applet->resize(newSize.x(), newSize.y()); m_applet->resize(newSize.x(), newSize.y());
} else { } else {
// set applet handle rotation - rotate around center of applet // set applet handle rotation - rotate around center of applet