UNPKG

lingo3d

Version:

Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor

29 lines 1.03 kB
import store, { createEffect } from "@lincode/reactivity"; import { getEditorMode } from "./useEditorMode"; import { getSelectionTarget } from "./useSelectionTarget"; import { getWorldPlay } from "./useWorldPlay"; import { selectionTargetPtr } from "../pointers/selectionTargetPtr"; export const [setEditorModeComputed, getEditorModeComputed] = store(getEditorMode()); createEffect(() => { const [target] = selectionTargetPtr; const mode = getEditorMode(); if (getWorldPlay()) { setEditorModeComputed("play"); return; } if (!target || (mode !== "rotate" && mode !== "scale" && mode !== "translate")) { setEditorModeComputed(mode); return; } if (!("x" in target)) { setEditorModeComputed("select"); return; } if (!("rotationX" in target)) { setEditorModeComputed("translate"); return; } setEditorModeComputed(mode); }, [getEditorMode, getSelectionTarget, getWorldPlay]); //# sourceMappingURL=useEditorModeComputed.js.map