import { Transform } from 'dacha';
const TOLERANCE = 0.01;
export const isFloatEqual = (a, b) => Math.abs(a - b) < TOLERANCE;
export const updateActorTransform = (actorConfig, newTransformMap) => {
    var _a, _b;
    if (!newTransformMap.has(actorConfig.id)) {
        return Object.assign(Object.assign({}, actorConfig), { children: (_a = actorConfig.children) === null || _a === void 0 ? void 0 : _a.map((child) => updateActorTransform(child, newTransformMap)) });
    }
    return Object.assign(Object.assign({}, actorConfig), { components: (_b = actorConfig.components) === null || _b === void 0 ? void 0 : _b.map((component) => {
            if (component.name !== Transform.componentName) {
                return component;
            }
            return Object.assign(Object.assign({}, component), { config: Object.assign(Object.assign({}, component.config), newTransformMap.get(actorConfig.id)) });
        }) });
};
