1
0
mirror of synced 2026-04-04 07:08:34 +08:00
Files
tmagic-editor/packages/editor/src/utils/tree.ts
2023-11-01 14:06:04 +08:00

16 lines
495 B
TypeScript

import type { Id } from '@tmagic/schema';
import { getKeys } from '@tmagic/utils';
import type { LayerNodeStatus } from '@editor/type';
export const updateStatus = (nodeStatusMap: Map<Id, LayerNodeStatus>, id: Id, status: Partial<LayerNodeStatus>) => {
const nodeStatus = nodeStatusMap.get(id);
if (!nodeStatus) return;
getKeys(status).forEach((key) => {
if (nodeStatus[key] !== undefined && status[key] !== undefined) {
nodeStatus[key] = Boolean(status[key]);
}
});
};