From 1a322ca67a29cedd8b33da85fbae0c27a99cd24b Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Sun, 2 Apr 2023 21:37:24 +0100 Subject: [PATCH] Fix scaled position --- web/extensions/core/contextMenuFilter.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/web/extensions/core/contextMenuFilter.js b/web/extensions/core/contextMenuFilter.js index 8aac84d5b..fa4cb2422 100644 --- a/web/extensions/core/contextMenuFilter.js +++ b/web/extensions/core/contextMenuFilter.js @@ -111,9 +111,13 @@ app.registerExtension({ // Focus the filter box when opening filter.focus(); - // If the top is off screen then shift the element - if (parseInt(this.root.style.top) < 0) { - this.root.style.top = 0; + const rect = this.root.getBoundingClientRect(); + + // If the top is off screen then shift the element with scaling applied + if (rect.top < 0) { + const scale = 1 - this.root.getBoundingClientRect().height / this.root.clientHeight; + const shift = (this.root.clientHeight * scale) / 2; + this.root.style.top = -shift + "px"; } }); }