From bdbb8e0cbb54980f48720194ac7a19a036e4025d Mon Sep 17 00:00:00 2001 From: Garik Harutyunyan Date: Tue, 14 Apr 2020 15:57:52 +0400 Subject: [PATCH] add eraser --- package.json | 2 +- src/Editor.vue | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 6d8d742..6dbe657 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-image-markup", - "version": "3.0.3", + "version": "3.0.4", "description": "vue-image-markup will provide you to edit uploaded image easily and save it.", "main": "src/Editor.vue", "repository": { diff --git a/src/Editor.vue b/src/Editor.vue index 792460c..98b76c4 100644 --- a/src/Editor.vue +++ b/src/Editor.vue @@ -105,6 +105,7 @@ this.cancelCroppingImage() }, set(type, params) { + this.canvas.off("mouse:down"); switch (type) { case "text": this.currentActiveTool = type; @@ -241,6 +242,15 @@ this.croppedImage = true; new CropImage(this.canvas, true, false, false, this.params); break; + case 'eraser': + this.currentActiveTool = type; + let inst = this; + this.canvas.on("mouse:down", function () { + if (inst.canvas.getActiveObject()) { + inst.canvas.remove(inst.canvas.getActiveObject()) + } + }); + break; default: } },