[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-16 11:13:29
Message-ID: 1147778009.504639.3517.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 541468 by zander:

* Implement alt/control to only move along one axis
* Implement alt/control to only rotate 45 degrees increments


 M  +7 -0      KoShapeMoveStrategy.cpp  
 M  +10 -0     KoShapeRotateStrategy.cpp  


--- trunk/playground/office/flake/lib/KoShapeMoveStrategy.cpp #541467:541468
@@ -58,6 +58,13 @@
         applyGrid(newPos);
         m_diff = newPos - m_initialTopLeft;
     }
+    if(event->modifiers() & (Qt::AltModifier | Qt::ControlModifier)) {
+        // keep x or y position unchanged
+        if(qAbs(m_diff.x()) < qAbs(m_diff.y()))
+            m_diff.setX(0);
+        else
+            m_diff.setY(0);
+    }
 
     int i=0;
     foreach(KoShape *shape, m_selectedObjects) {
--- trunk/playground/office/flake/lib/KoShapeRotateStrategy.cpp #541467:541468
@@ -50,6 +50,16 @@
     double angle = atan2( event->point.y() - center.y(), event->point.x() - center.x() ) -
         atan2( m_start.y() - center.y(), m_start.x() - center.x() );
     angle = angle / M_PI * 180;  // convert to degrees.
+    if(event->modifiers() & (Qt::AltModifier | Qt::ControlModifier)) {
+        // limit to 45 degree angles
+        double modula = qAbs(angle);
+        while(modula > 45.0)
+            modula -= 45.0;
+        if(modula > 22.5)
+            modula -= 45.0;
+        angle += (angle>0?-1:1)*modula;
+    }
+
     QMatrix matrix;
     matrix.translate(center.x(), center.y());
     matrix.rotate(angle);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic