mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-19 02:21:38 +08:00
This commit is contained in:
parent
493eba5a14
commit
3724d274c9
@ -5,6 +5,7 @@ import {windowKeyUp} from "./keyup";
|
||||
import {windowKeyDown} from "./keydown";
|
||||
import {globalClick} from "./click";
|
||||
import {goBack, goForward} from "../../util/backForward";
|
||||
import {Constants} from "../../constants";
|
||||
|
||||
export const initWindowEvent = (app: App) => {
|
||||
document.body.addEventListener("mouseleave", () => {
|
||||
@ -14,9 +15,18 @@ export const initWindowEvent = (app: App) => {
|
||||
window.siyuan.layout.bottomDock.hideDock();
|
||||
}
|
||||
});
|
||||
let mouseIsEnter = false;
|
||||
document.body.addEventListener("mouseenter", () => {
|
||||
if (window.siyuan.layout.leftDock) {
|
||||
mouseIsEnter = true;
|
||||
setTimeout(() => {
|
||||
mouseIsEnter = false;
|
||||
}, Constants.TIMEOUT_TRANSITION);
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener("mousemove", (event: MouseEvent & { target: HTMLElement }) => {
|
||||
windowMouseMove(event);
|
||||
windowMouseMove(event, mouseIsEnter);
|
||||
});
|
||||
|
||||
window.addEventListener("mouseup", (event) => {
|
||||
@ -46,6 +56,6 @@ export const initWindowEvent = (app: App) => {
|
||||
});
|
||||
|
||||
window.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => {
|
||||
globalClick(event);
|
||||
globalClick(event);
|
||||
});
|
||||
};
|
||||
|
@ -14,7 +14,11 @@ const getRightBlock = (element: HTMLElement, x: number, y: number) => {
|
||||
return nodeElement;
|
||||
};
|
||||
|
||||
export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }) => {
|
||||
export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }, mouseIsEnter:boolean) => {
|
||||
if (document.body.classList.contains("body--blur")) {
|
||||
// 非激活状态下不执行 https://ld246.com/article/1693474547631
|
||||
return;
|
||||
}
|
||||
// https://github.com/siyuan-note/siyuan/pull/8793
|
||||
const coordinates = window.siyuan.coordinates ?? (window.siyuan.coordinates = {
|
||||
pageX: 0,
|
||||
@ -40,7 +44,8 @@ export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }) =>
|
||||
item.editor.protyle.breadcrumb.render(item.editor.protyle, true);
|
||||
});
|
||||
}
|
||||
if (event.buttons === 0 && // 鼠标按键被按下时不触发
|
||||
if (!mouseIsEnter &&
|
||||
event.buttons === 0 && // 鼠标按键被按下时不触发
|
||||
window.siyuan.layout.bottomDock &&
|
||||
!isWindow() && !hasClosestByClassName(event.target, "b3-dialog") && !hasClosestByClassName(event.target, "b3-menu")) {
|
||||
if (event.clientX < 43) {
|
||||
|
Loading…
Reference in New Issue
Block a user