mylingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
22 lines • 957 B
JavaScript
import { debounce } from "@lincode/utils";
import { appendableRoot } from "../../../../api/core/Appendable";
import { getSelectionFrozen } from "../../../../states/useSelectionFrozen";
const selectionCandidates = new Set();
export default selectionCandidates;
export const unselectableSet = new WeakSet();
const traverse = (targets, frozenSet) => {
for (const manager of targets) {
if (frozenSet.has(manager))
continue;
if ("addToRaycastSet" in manager && !unselectableSet.has(manager))
//@ts-ignore
manager.addToRaycastSet(selectionCandidates);
manager.children && traverse(manager.children, frozenSet);
}
};
export const getSelectionCandidates = debounce((targets = appendableRoot) => {
const [frozenSet] = getSelectionFrozen();
selectionCandidates.clear();
traverse(targets, frozenSet);
}, 0, "trailing");
//# sourceMappingURL=selectionCandidates.js.map