]> git.parisson.com Git - pdf.js.git/commitdiff
Move scale out of pdf.js
authornotmasteryet <async.processingjs@yahoo.com>
Fri, 19 Aug 2011 03:48:07 +0000 (22:48 -0500)
committernotmasteryet <async.processingjs@yahoo.com>
Fri, 19 Aug 2011 03:48:07 +0000 (22:48 -0500)
pdf.js
web/viewer.js

diff --git a/pdf.js b/pdf.js
index 79a9bba7794b3a3000af86177a2acd99d7ca6378..63aefcd3285531ff6359d6c38c69a77439a3c3ab 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -3340,7 +3340,7 @@ var Page = (function() {
           return {x: y, y: x};
       }
     },
-    getLinks: function(scale) {
+    getLinks: function() {
       var xref = this.xref;
       var annotations = xref.fetchIfRef(this.annotations);
       var i, n = annotations.length;
@@ -3357,10 +3357,10 @@ var Page = (function() {
         var bottomRightCorner = this.rotatePoint(rect[2], rect[3]);
 
         var link = {};
-        link.x = scale * Math.min(topLeftCorner.x, bottomRightCorner.x);
-        link.y = scale * Math.min(topLeftCorner.y, bottomRightCorner.y);
-        link.width = scale * Math.abs(topLeftCorner.x - bottomRightCorner.x);
-        link.height = scale * Math.abs(topLeftCorner.y - bottomRightCorner.y);
+        link.x = Math.min(topLeftCorner.x, bottomRightCorner.x);
+        link.y = Math.min(topLeftCorner.y, bottomRightCorner.y);
+        link.width = Math.abs(topLeftCorner.x - bottomRightCorner.x);
+        link.height = Math.abs(topLeftCorner.y - bottomRightCorner.y);
         var a = annotation.get("A");
         if (a) {
           switch(a.get("S").name) {
index e4db38bc839e15e921bb518571063517b2a9dc1a..b1e28407fe3af2461a80f7f71b108af203ff960e 100644 (file)
@@ -166,7 +166,7 @@ var PageView = function(container, content, id, width, height, stats) {
   };
 
   function setupLinks(canvas, content, scale) {
-    var links = content.getLinks(scale);
+    var links = content.getLinks();
     var currentLink = null;
     if (links.length > 0)
     {
@@ -177,6 +177,8 @@ var PageView = function(container, content, id, width, height, stats) {
           x -= p.offsetLeft;
           y -= p.offsetTop;
         }
+        x /= scale;
+        y /= scale;
         for (var i = 0; i < links.length; i++) {
           var link = links[i];
           if (!link.url)