🎨 隐藏停靠栏会导致点击两侧内容触发浮动面板弹出,因此需减小鼠标范围

This commit is contained in:
Vanessa 2023-02-14 10:53:54 +08:00
parent d4e3c1e660
commit fb2c35e9d3
2 changed files with 6 additions and 3 deletions

View File

@ -131,7 +131,7 @@ ${this.position === "Top" ? ("top:" + (this.element.offsetHeight + document.getE
} }
}); });
this.layout.element.addEventListener("mouseleave", (event: MouseEvent & { toElement: HTMLElement }) => { this.layout.element.addEventListener("mouseleave", (event: MouseEvent & { toElement: HTMLElement }) => {
if (this.pin || event.toElement.classList.contains("b3-menu")) { if (this.pin || event.toElement?.classList.contains("b3-menu")) {
return; return;
} }
if (this.position === "Left" && event.clientX < 43) { if (this.position === "Left" && event.clientX < 43) {

View File

@ -97,7 +97,9 @@ export const globalShortcut = () => {
} }
if (!isWindow() && !hasClosestByClassName(event.target, "b3-dialog") && !hasClosestByClassName(event.target, "b3-menu")) { if (!isWindow() && !hasClosestByClassName(event.target, "b3-dialog") && !hasClosestByClassName(event.target, "b3-menu")) {
if (event.clientX < 43) { if (event.clientX < 43) {
if (!window.siyuan.layout.leftDock.pin && window.siyuan.layout.leftDock.layout.element.clientWidth > 0) { if (!window.siyuan.layout.leftDock.pin && window.siyuan.layout.leftDock.layout.element.clientWidth > 0 &&
// 隐藏停靠栏会导致点击两侧内容触发浮动面板弹出,因此需减小鼠标范围
(window.siyuan.layout.leftDock.element.clientWidth > 0 || (window.siyuan.layout.leftDock.element.clientWidth === 0 && event.clientX < 8))) {
if (event.clientY > document.getElementById("toolbar").clientHeight + document.getElementById("dockTop").clientHeight && if (event.clientY > document.getElementById("toolbar").clientHeight + document.getElementById("dockTop").clientHeight &&
event.clientY < window.innerHeight - document.getElementById("status").clientHeight - document.getElementById("dockBottom").clientHeight) { event.clientY < window.innerHeight - document.getElementById("status").clientHeight - document.getElementById("dockBottom").clientHeight) {
if (!hasClosestByClassName(event.target, "b3-menu") && if (!hasClosestByClassName(event.target, "b3-menu") &&
@ -109,7 +111,8 @@ export const globalShortcut = () => {
} }
} }
} else if (event.clientX > window.innerWidth - 41) { } else if (event.clientX > window.innerWidth - 41) {
if (!window.siyuan.layout.rightDock.pin && window.siyuan.layout.rightDock.layout.element.clientWidth > 0) { if (!window.siyuan.layout.rightDock.pin && window.siyuan.layout.rightDock.layout.element.clientWidth > 0 &&
(window.siyuan.layout.rightDock.element.clientWidth > 0 || (window.siyuan.layout.rightDock.element.clientWidth === 0 && event.clientX > window.innerWidth - 8))) {
if (event.clientY > document.getElementById("toolbar").clientHeight + document.getElementById("dockTop").clientHeight && if (event.clientY > document.getElementById("toolbar").clientHeight + document.getElementById("dockTop").clientHeight &&
event.clientY < window.innerHeight - document.getElementById("status").clientHeight - document.getElementById("dockBottom").clientHeight) { event.clientY < window.innerHeight - document.getElementById("status").clientHeight - document.getElementById("dockBottom").clientHeight) {
if (!hasClosestByClassName(event.target, "layout--float")) { if (!hasClosestByClassName(event.target, "layout--float")) {