From f9ea449901bc10c81d564e28af64756c7d6f9c9f Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Tue, 12 Sep 2017 11:08:49 +0100 Subject: Consider devicePixelRatio when calculating viewport This should fix #2635, fix #2633 and fix #2620. --- lib/dom_utils.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index d0bd4615..24747837 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -293,7 +293,8 @@ DomUtils = style = getComputedStyle box if style.position == "static" and not /content|paint|strict/.test(style.contain or "") zoom = +style.zoom || 1 - top: Math.ceil(window.scrollY / zoom), left: Math.ceil(window.scrollX / zoom) + ratio = window.devicePixelRatio ? 1 + top: Math.ceil(window.scrollY * ratio / zoom), left: Math.ceil(window.scrollX * ratio / zoom) else rect = box.getBoundingClientRect() top: -rect.top - box.clientTop, left: -rect.left - box.clientLeft -- cgit v1.2.3