Vanessa 2025-02-05 10:57:43 +08:00
parent 180338a86f
commit e5867b0c2e
2 changed files with 7 additions and 5 deletions

View file

@ -518,16 +518,17 @@ export class Files extends Model {
) &&
// 防止文档拖拽到笔记本外
!(!sourceOnlyRoot && targetType === "navigation-root")) {
const nodeRect = (liElement as HTMLElement).getBoundingClientRect();
const nodeRect = liElement.getBoundingClientRect();
const dragHeight = nodeRect.height * .36;
if (targetType === "navigation-root" && sourceOnlyRoot) {
if (event.clientY > nodeRect.top + nodeRect.height / 2) {
(liElement as HTMLElement).classList.add("dragover__bottom");
} else {
(liElement as HTMLElement).classList.add("dragover__top");
}
} else if (event.clientY > nodeRect.top + nodeRect.height * 3 / 4) {
} else if (event.clientY > nodeRect.bottom - dragHeight) {
(liElement as HTMLElement).classList.add("dragover__bottom");
} else if (event.clientY < nodeRect.bottom - nodeRect.height * 3 / 4) {
} else if (event.clientY < nodeRect.top + dragHeight) {
(liElement as HTMLElement).classList.add("dragover__top");
}
event.preventDefault();

View file

@ -274,9 +274,10 @@ export class Outline extends Model {
return;
}
const selectRect = selectItem.getBoundingClientRect();
if (moveEvent.clientY > selectRect.top + selectRect.height * 3 / 4) {
const dragHeight = selectRect.height * .36;
if (moveEvent.clientY > selectRect.bottom - dragHeight) {
selectItem.classList.add("dragover__bottom");
} else if (moveEvent.clientY < selectRect.bottom - selectRect.height * 3 / 4) {
} else if (moveEvent.clientY < selectRect.top + dragHeight) {
selectItem.classList.add("dragover__top");
} else {
selectItem.classList.add("dragover");