import React, { useEffect, useMemo, useRef } from "react"; import { register } from "@antv/x6-react-shape"; import { Graph, Node } from "@antv/x6"; import type { TopicAreaInfo } from "@/type"; import { useSessionStorageState } from "ahooks"; const TopicAreaNode = ({ node, graph }: { node: Node; graph: Graph }) => { const { style, name } = node.getData(); const [showEdit, setShowEdit] = React.useState(false); const [_tabActiveKey, setTabActiveKey] = useSessionStorageState("tabs-active-key"); const [playModeEnable] = useSessionStorageState( "playModeEnable", { listenStorageChange: true, } ); const handleEdit = () => { setTabActiveKey("3"); }; return (
setShowEdit(true)} onMouseLeave={() => setShowEdit(false)} >
{name}{" "} {showEdit && !playModeEnable && (
)}
); }; register({ shape: "topic-node", component: TopicAreaNode, width: 300, height: 300, effect: ["data"], });