This commit is contained in:
Rizky 2024-07-27 18:38:38 +07:00
parent f3c34088e3
commit c639a13fec
3 changed files with 23 additions and 25 deletions

View File

@ -2,7 +2,8 @@ import { getBackendOptions } from "@minoru/react-dnd-treeview";
import { DndProvider } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";
import { useGlobal, useLocal } from "web-utils";
import { EDGlobal } from "./logic/ed-global";
import { active, EDGlobal } from "./logic/ed-global";
import { treeRebuild } from "./logic/tree/build";
import { EdApi } from "./panel/header/left/api";
import { EdSiteJS } from "./panel/header/left/js";
import { EdSitePicker } from "./panel/header/left/site-picker";
@ -10,7 +11,6 @@ import { EdTreeBody } from "./panel/tree/body";
import { EdPageHistoryBtn } from "./panel/tree/history-btn";
import { EdPageHistoryList } from "./panel/tree/history-list";
import { EdTreeSearch } from "./panel/tree/search";
import { treeRebuild } from "./logic/tree/build";
export const EdLeft = () => {
const p = useGlobal(EDGlobal, "EDITOR");
@ -84,6 +84,15 @@ export const EdLeft = () => {
ref={(ref) => {
if (ref) local.tree = ref;
}}
onPointerMove={() => {
active.hover.tree = true;
}}
onPointerOut={() => {
active.hover.tree = false;
}}
onPointerLeave={() => {
active.hover.tree = false;
}}
>
{p.page.history.show ? (
<EdPageHistoryList />

View File

@ -35,18 +35,7 @@ export const EdTreeBody = () => {
if (tree.length === 0)
return (
<div
className="flex py-[100px] select-none justify-center flex-1"
onPointerMove={() => {
active.hover.tree = true;
}}
onPointerOut={() => {
active.hover.tree = false;
}}
onPointerLeave={() => {
active.hover.tree = false;
}}
>
<div className="flex py-[100px] select-none justify-center flex-1">
<div className="flex flex-col items-center">
<img
draggable={false}

View File

@ -2,16 +2,16 @@ import { active } from "../../logic/ed-global";
export const scrollTreeActiveItem = () => {
setTimeout(() => {
let i = 0;
const ival = setInterval(() => {
const div = document.querySelector(
`.tree-${active.item_id}`
) as HTMLDivElement;
if (div) {
if (!active.hover.tree) div.scrollIntoView();
}
if (i > 7) clearInterval(ival);
i++;
}, 30);
// let i = 0;
// const ival = setInterval(() => {
const div = document.querySelector(
`.tree-${active.item_id}`
) as HTMLDivElement;
if (div) {
if (!active.hover.tree) div.scrollIntoView();
}
// if (i > 7) clearInterval(ival);
// i++;
// }, 30);
}, 100);
};