Revision: 2731
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2731&view=rev
Author:   hofman
Date:     2007-08-27 10:00:09 -0700 (Mon, 27 Aug 2007)

Log Message:
-----------
Fix typos in calculating hittest for lines and dragging end points of lines.

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

Modified: trunk/SKPDFAnnotationNote.m
===================================================================
--- trunk/SKPDFAnnotationNote.m 2007-08-27 16:18:01 UTC (rev 2730)
+++ trunk/SKPDFAnnotationNote.m 2007-08-27 17:00:09 UTC (rev 2731)
@@ -1415,8 +1415,6 @@
     NSPoint startPoint = [self startPoint];
     NSPoint endPoint = [self endPoint];
     
-    point = SKSubstractPoints(point, bounds.origin);
-    
     if ([super hitTest:point]) {
         NSPoint relPoint = SKSubstractPoints(endPoint, startPoint);
         float lengthSquared = relPoint.x * relPoint.x + relPoint.y * 
relPoint.y;
@@ -1425,11 +1423,13 @@
         if (lengthSquared < 16.0)
             return YES;
         
-        extProduct = (point.x - startPoint.x) * relPoint.y - (point.y - 
startPoint.y) * relPoint.x;
+        point = SKSubstractPoints(SKSubstractPoints(point, bounds.origin), 
startPoint);
+        extProduct = point.x * relPoint.y - point.y * relPoint.x;
         
         return extProduct * extProduct < 16.0 * lengthSquared;
     } else {
         
+        point = SKSubstractPoints(point, bounds.origin);
         return (fabs(point.x - startPoint.x) < 3.5 && fabs(point.y - 
startPoint.y) < 3.5) ||
                (fabs(point.x - endPoint.x) < 3.5 && fabs(point.y - endPoint.y) 
< 3.5);
     }

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2007-08-27 16:18:01 UTC (rev 2730)
+++ trunk/SKPDFView.m   2007-08-27 17:00:09 UTC (rev 2731)
@@ -2837,8 +2837,8 @@
         if ([[activeAnnotation type] isEqualToString:@"Line"]) {
             
             SKPDFAnnotationLine *annotation = (SKPDFAnnotationLine 
*)activeAnnotation;
-            NSPoint endPoint = SKIntegralPoint(SKSubstractPoints(wasEndPoint, 
wasBounds.origin));
-            startPoint = SKIntegralPoint(SKSubstractPoints(wasStartPoint, 
wasBounds.origin));
+            NSPoint endPoint = SKIntegralPoint(SKAddPoints(wasEndPoint, 
wasBounds.origin));
+            startPoint = SKIntegralPoint(SKAddPoints(wasStartPoint, 
wasBounds.origin));
             NSPoint *draggedPoint = draggingStartPoint ? &startPoint : 
&endPoint;
             
             *draggedPoint = SKConstrainPointInRect(SKAddPoints(*draggedPoint, 
relPoint), pageBounds);


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