@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
16 lines (15 loc) • 484 B
JavaScript
;
export function updateSelectionState(selectionStates, entity, state) {
const currentState = selectionStates.get(entity);
if (!currentState) {
selectionStates.set(entity, state);
}
}
export function selectedIndicesFromSelectionStates(selectionStates, selectedIndices, invert) {
selectionStates.forEach((state, entity) => {
const selected = !invert && state || invert && !state;
if (selected) {
selectedIndices.add(entity.index());
}
});
}