add a little bit of snapping to the rotate at 90 degree intervals
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=738148
This commit is contained in:
parent
fa25221352
commit
db730a36d9
@ -230,6 +230,8 @@ qreal _k_angleForPoints(const QPointF ¢er, const QPointF &pt1, const QPointF
|
||||
|
||||
void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
static const qreal snapAngle = 3.14159 / 2.0;
|
||||
|
||||
if (m_pressedButton == MoveButton) {
|
||||
QPointF delta = event->pos()-event->lastPos();
|
||||
setPos(pos()+delta);
|
||||
@ -244,6 +246,11 @@ void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
QPointF center = rect.center();
|
||||
|
||||
m_angle = _k_angleForPoints(center, pressPos, event->pos());
|
||||
|
||||
if (fabs(remainder(m_angle, snapAngle)) < 0.15) {
|
||||
m_angle = m_angle - remainder(m_angle, snapAngle);
|
||||
}
|
||||
|
||||
m_scale = _k_distanceForPoint(event->pos()-center) / _k_distanceForPoint(pressPos-center);
|
||||
|
||||
QTransform matrix;
|
||||
|
Loading…
Reference in New Issue
Block a user