Skip to content

Commit 2bfeeb5

Browse files
authored
fix: 修复图层显示隐藏图标不更新问题
1 parent 6691fbf commit 2bfeeb5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/store/modules/template.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,17 @@ export const useTemplatesStore = defineStore('Templates', {
9696
target: target.toObject(propertiesToInclude),
9797
tid: this.templateId
9898
}
99+
const proxyEl: any = this.currentTemplate.objects.find(i => i.id === target.id)
99100
addHistorySnapshot(data)
100101
target.set({...options});
102+
// 更新target同时更新template的对象
103+
if (proxyEl) {
104+
Object.keys(options).forEach((key) => {
105+
if (key in proxyEl) {
106+
proxyEl[key] = options[key]
107+
}
108+
})
109+
}
101110
if (options.filters) {
102111
(target as FabricImage).applyFilters();
103112
}
@@ -310,4 +319,4 @@ export const useTemplatesStore = defineStore('Templates', {
310319
},
311320

312321
}
313-
})
322+
})

0 commit comments

Comments
 (0)