From 4d85a36091c68237c53136a6f78692eaf3a60a37 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 28 Dec 2019 23:22:29 -0500 Subject: [PATCH] Fix popup size changing when zooming --- ext/fg/js/popup.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 3c774f54..6c98491b 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -34,6 +34,7 @@ class Popup { this._options = null; this._stylesheetInjectedViaApi = false; this._contentScale = 1.0; + this._containerSizeContentScale = null; this._container = document.createElement('iframe'); this._container.className = 'yomichan-float'; @@ -258,10 +259,12 @@ class Popup { ); const scale = this._contentScale; + const scaleRatio = this._containerSizeContentScale === null ? 1.0 : scale / this._containerSizeContentScale; + this._containerSizeContentScale = scale; const [x, y, width, height, below] = getPosition( elementRect, - Math.max(containerRect.width, optionsGeneral.popupWidth * scale), - Math.max(containerRect.height, optionsGeneral.popupHeight * scale), + Math.max(containerRect.width * scaleRatio, optionsGeneral.popupWidth * scale), + Math.max(containerRect.height * scaleRatio, optionsGeneral.popupHeight * scale), document.body.clientWidth, window.innerHeight, scale,