From 37e15c6834563e7825376f8dcc468224a9521ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sunsonliu=28=E5=88=98=E9=98=B3=29?= Date: Thu, 28 Nov 2024 19:16:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20#985=20=E4=BF=AE=E5=A4=8D=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E9=94=AE=E9=85=8D=E7=BD=AE=E5=BC=B9=E7=AA=97=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/toolbars/ShortcutKeyConfigPanel.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/toolbars/ShortcutKeyConfigPanel.js b/src/toolbars/ShortcutKeyConfigPanel.js index 2265973e..7b4eb211 100644 --- a/src/toolbars/ShortcutKeyConfigPanel.js +++ b/src/toolbars/ShortcutKeyConfigPanel.js @@ -326,13 +326,14 @@ export default class ShortcutKeyConfigPanel { throw new Error(`settingsDom must be an instance of HTMLElement, but got: ${settingsDom}`); } const pos = settingsDom.getBoundingClientRect(); + const cherryWrapPos = this.$cherry.wrapperDom.getBoundingClientRect(); if (this.isHide()) { - this.dom.style.left = `${pos.left + pos.width / 2}px`; - this.dom.style.top = `${pos.top + pos.height}px`; + this.dom.style.left = `${pos.left - cherryWrapPos.left + pos.width / 2}px`; + this.dom.style.top = `${pos.top - cherryWrapPos.top + pos.height}px`; this.show(); const me = this.dom.getBoundingClientRect(); this.dom.style.marginLeft = `0px`; - this.dom.style.left = `${pos.left + pos.width / 2 - me.width / 2}px`; + this.dom.style.left = `${pos.left - cherryWrapPos.left + pos.width / 2 - me.width / 2}px`; // 如果弹窗位置超出屏幕,则自动调整位置 if (me.left + me.width > window.innerWidth) { this.dom.style.left = `${window.innerWidth - me.width - 5}px`;