From 4ccdc53dc54538a14934d34f52f40fc209d44fac Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 25 Jul 2022 17:15:31 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/5510 --- app/src/menus/Menu.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/menus/Menu.ts b/app/src/menus/Menu.ts index 369c1af3d..af3041871 100644 --- a/app/src/menus/Menu.ts +++ b/app/src/menus/Menu.ts @@ -33,9 +33,13 @@ export class Menu { itemElement.classList.add("b3-menu__item--show"); const rect = subMenuElement.getBoundingClientRect(); let style = ""; - if (rect.right > window.innerWidth && (rect.left - this.element.clientWidth - rect.width > 0 || - Math.abs(rect.left - this.element.clientWidth - rect.width) < (rect.right - window.innerWidth))) { - style = "left:auto;right:100%;"; + const leftPosition = rect.left - this.element.clientWidth - rect.width + if (rect.right > window.innerWidth && Math.abs(leftPosition) < (rect.right - window.innerWidth)) { + if (leftPosition >= 0) { + style = "left:auto;right:100%;"; + } else { + style = `z-index:1;mix-blend-mode: normal;left:-${this.element.style.left};`; + } } else if (rect.right > window.innerWidth) { style = `z-index:1;mix-blend-mode: normal;left:${window.innerWidth - rect.width}px;`; }