lingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
24 lines • 1.33 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
import { signal } from "@preact/signals";
import deleteSelected from "../../engine/hotkeys/deleteSelected";
import { getGameGraph } from "../../states/useGameGraph";
import { getSelectionTarget } from "../../states/useSelectionTarget";
import ContextMenu from "../component/ContextMenu";
import MenuButton from "../component/MenuButton";
import useSyncState from "../hooks/useSyncState";
export const nodeContexMenuSignal = signal(undefined);
const NodeContextMenu = () => {
const selectionTarget = useSyncState(getSelectionTarget);
const gameGraph = useSyncState(getGameGraph);
if (!gameGraph || !selectionTarget)
return null;
return (_jsxs(ContextMenu, { positionSignal: nodeContexMenuSignal, children: [!gameGraph.children?.has(selectionTarget) && (_jsx(MenuButton, { onClick: () => {
getGameGraph().deleteData(selectionTarget.uuid);
nodeContexMenuSignal.value = undefined;
}, children: "Remove from GameGraph" })), _jsx(MenuButton, { onClick: () => {
deleteSelected();
nodeContexMenuSignal.value = undefined;
}, children: "Delete selected" })] }));
};
export default NodeContextMenu;
//# sourceMappingURL=NodeContextMenu.js.map