diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-28 23:22:29 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-01-22 20:38:21 -0500 |
commit | 4d85a36091c68237c53136a6f78692eaf3a60a37 (patch) | |
tree | f5882dd2a02cbc610ee978cbabc80aad76cc736f | |
parent | 351598a1829930a25a27a007fb3bc69bde251787 (diff) |
Fix popup size changing when zooming
-rw-r--r-- | ext/fg/js/popup.js | 7 |
1 files 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, |