Revision: 2733
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2733&view=rev
Author:   hofman
Date:     2007-08-27 11:42:57 -0700 (Mon, 27 Aug 2007)

Log Message:
-----------
Restrict line angles to multiples of 45 degrees when moving the end points with 
the shift key held down.

Modified Paths:
--------------
    trunk/SKPDFView.m

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2007-08-27 17:03:37 UTC (rev 2732)
+++ trunk/SKPDFView.m   2007-08-27 18:42:57 UTC (rev 2733)
@@ -2856,6 +2856,23 @@
                 newBounds.origin.y = floorf(0.5 * (startPoint.y + endPoint.y) 
- 4.0);
             }
             
+            if ([theEvent modifierFlags] & NSShiftKeyMask) {
+                NSPoint *fixedPoint = draggingStartPoint ? &endPoint : 
&startPoint;
+                NSPoint diffPoint = SKSubstractPoints(*draggedPoint, 
*fixedPoint);
+                float dx = fabs(diffPoint.x), dy = fabs(diffPoint.y);
+                
+                if (dx < 0.4 * dy) {
+                    diffPoint.x = 0.0;
+                } else if (dy < 0.4 * dx) {
+                    diffPoint.y = 0.0;
+                } else {
+                    dx = fmin(dx, dy);
+                    diffPoint.x = diffPoint.x < 0.0 ? -dx : dx;
+                    diffPoint.y = diffPoint.y < 0.0 ? -dx : dx;
+                }
+                *draggedPoint = SKAddPoints(*fixedPoint, diffPoint);
+            }
+            
             startPoint = SKSubstractPoints(startPoint, newBounds.origin);
             endPoint = SKSubstractPoints(endPoint, newBounds.origin);
             


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to