mylingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
29 lines • 1.13 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
import useInit from "../../utils/useInit";
import { createPortal } from "preact/compat";
const ContextMenu = ({ data, setData, children }) => {
const elRef = useInit();
if (!data)
return null;
return createPortal(_jsxs("div", { ref: elRef, className: "lingo3d-ui", style: {
zIndex: 2,
position: "absolute",
left: 0,
top: 0,
width: "100%",
height: "100%"
}, children: [_jsx("div", { onMouseDown: () => setData(undefined), style: {
position: "absolute",
left: 0,
top: 0,
width: "100%",
height: "100%"
} }), _jsx("div", { className: "lingo3d-bg", style: {
position: "absolute",
left: data.x,
top: data.y,
padding: 6
}, children: children })] }), document.body);
};
export default ContextMenu;
//# sourceMappingURL=index.js.map