From b4e78679225506ffdc2e825966b6fefbcb758f5b Mon Sep 17 00:00:00 2001 From: zdg Date: Wed, 31 Jul 2024 11:23:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/public/imgs/erase.svg | 3 ++ src/renderer/src/plugins/fabric/index.js | 5 ++- src/renderer/src/views/tool/test.vue | 47 ++++++++++++++++++++++-- 3 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 src/renderer/public/imgs/erase.svg diff --git a/src/renderer/public/imgs/erase.svg b/src/renderer/public/imgs/erase.svg new file mode 100644 index 0000000..a746074 --- /dev/null +++ b/src/renderer/public/imgs/erase.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/renderer/src/plugins/fabric/index.js b/src/renderer/src/plugins/fabric/index.js index cb16fb9..4d6926b 100644 --- a/src/renderer/src/plugins/fabric/index.js +++ b/src/renderer/src/plugins/fabric/index.js @@ -624,7 +624,7 @@ export class History { const canvas = this.FabricVue?.canvas if (canvas) { this.diffs = this.diffs.slice(0, this.index) - const canvasJson = Utils.getCanvasJSON() + const canvasJson = Utils.getCanvasJSON(canvas) const delta = diff(canvasJson, this.canvasData) this.diffs.push(delta) @@ -686,7 +686,7 @@ export class History { initHistory() { const canvas = this.FabricVue.canvas if (canvas) { - const canvasJson = Utils.getCanvasJSON() + const canvasJson = Utils.getCanvasJSON(canvas) this.canvasData = canvasJson this.index = 0 this.diffs = [] @@ -1010,4 +1010,5 @@ export class fabricVue { } export const FabricVue = new fabricVue() export default FabricVue +export const Fabric = fabric diff --git a/src/renderer/src/views/tool/test.vue b/src/renderer/src/views/tool/test.vue index d49b599..1deb706 100644 --- a/src/renderer/src/views/tool/test.vue +++ b/src/renderer/src/views/tool/test.vue @@ -1,6 +1,9 @@