fix(editor): 修复历史状态变化后,画布没有更新

This commit is contained in:
roymondchen 2022-04-07 19:50:24 +08:00 committed by jia000
parent ece1bab5c0
commit bb5e192dcd

View File

@ -339,9 +339,10 @@ class Editor extends BaseService {
if (`${newConfig.id}` === `${this.get('node').id}`) {
this.set('node', newConfig);
this.get<StageCore | null>('stage')?.update({ config: cloneDeep(newConfig), root: this.get('root') });
}
this.get<StageCore | null>('stage')?.update({ config: cloneDeep(newConfig), root: this.get('root') });
if (newConfig.type === NodeType.PAGE) {
this.set('page', newConfig);
}
@ -520,7 +521,11 @@ class Editor extends BaseService {
this.isHistoryStateChange = true;
await this.update(value.data);
this.set('modifiedNodeIds', value.modifiedNodeIds);
setTimeout(() => value.nodeId && this.select(value.nodeId), 0);
setTimeout(async () => {
if (!value.nodeId) return;
await this.select(value.nodeId);
this.get<StageCore | null>('stage')?.select(value.nodeId);
}, 0);
}
private async toggleFixedPosition(dist: MNode, src: MNode, root: MApp) {