mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-26 19:19:59 +08:00
16 lines
493 B
TypeScript
16 lines
493 B
TypeScript
import type { Id } from '@tmagic/core';
|
|
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]);
|
|
}
|
|
});
|
|
};
|