From 85b4de4898263358e623fc21e84781ab27ca2d0c Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Thu, 7 Nov 2013 16:37:21 +0800 Subject: [PATCH] fix link handling --- TODO | 2 -- share/pdf2htmlEX.js.in | 11 +++++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 5088cb4..3423e98 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ -link handling + scale - more information on demo page: - showing pdf2htmlEX home page - link to other demos diff --git a/share/pdf2htmlEX.js.in b/share/pdf2htmlEX.js.in index ad41a26..15aee3c 100644 --- a/share/pdf2htmlEX.js.in +++ b/share/pdf2htmlEX.js.in @@ -648,7 +648,7 @@ }, link_handler : function (e) { - var target = e.currentTarget; + var target = e.target; var cur_pos = [0,0]; @@ -710,13 +710,16 @@ } if(ok) { + var _ = this; + var scale = this.scale; + var _pos = [pos[0] * scale, pos[1] * scale] /* page should of type Page */ var transform_and_scroll = function(page) { - pos = transform(page.ctm, pos); + _pos = transform(page.ctm, _pos); if(upside_down) { - pos[1] = page.height() - pos[1]; + _pos[1] = page.height() - _pos[1]; } - this.scroll_to(target_page_idx, pos); + _.scroll_to(target_page_idx, _pos); }; if (target_page.loaded) {