From fdd5d414ed5716cd95522184ba8790b6548c14fd Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Mon, 25 Nov 2013 08:54:47 -0600 Subject: [PATCH] Fixes find position in HiDPI displays --- web/page_view.js | 6 ++++-- web/ui_utils.js | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/web/page_view.js b/web/page_view.js index ddb30220c..e28d8bfa7 100644 --- a/web/page_view.js +++ b/web/page_view.js @@ -455,8 +455,8 @@ var PageView = function pageView(container, id, scale, outputScale.scaled = true; } - canvas.width = Math.floor(viewport.width * outputScale.sx); - canvas.height = Math.floor(viewport.height * outputScale.sy); + canvas.width = (Math.floor(viewport.width) * outputScale.sx) | 0; + canvas.height = (Math.floor(viewport.height) * outputScale.sy) | 0; canvas.style.width = Math.floor(viewport.width) + 'px'; canvas.style.height = Math.floor(viewport.height) + 'px'; // Add the viewport so it's known what it was originally drawn with. @@ -489,6 +489,8 @@ var PageView = function pageView(container, id, scale, (1 / outputScale.sy) + ')'; CustomStyle.setProp('transform' , textLayerDiv, cssScale); CustomStyle.setProp('transformOrigin' , textLayerDiv, '0% 0%'); + textLayerDiv.dataset._scaleX = outputScale.sx; + textLayerDiv.dataset._scaleY = outputScale.sy; } //#if (FIREFOX || MOZCENTRAL) diff --git a/web/ui_utils.js b/web/ui_utils.js index 8b2c1f121..2684dc675 100644 --- a/web/ui_utils.js +++ b/web/ui_utils.js @@ -113,6 +113,9 @@ function scrollIntoView(element, spot) { return; } while (parent.clientHeight == parent.scrollHeight) { + if (parent.dataset._scaleY) { + offsetY /= parent.dataset._scaleY; + } offsetY += parent.offsetTop; parent = parent.offsetParent; if (!parent)