From c4975cdb79994ddb0a53b84f09c2ff1719526926 Mon Sep 17 00:00:00 2001 From: Leane Schlundt Date: Tue, 5 Mar 2024 09:36:20 +0100 Subject: [PATCH 1/3] Fix polygon tool bug by checking watcher value When interaction mode is changed, the old and new computed property change, which triggers their corresponding watchers. Fix bug by using watcher of current interaction mode only. Fixes #798 --- .../polygonBrushInteraction.vue | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/resources/assets/js/annotations/components/annotationCanvas/polygonBrushInteraction.vue b/resources/assets/js/annotations/components/annotationCanvas/polygonBrushInteraction.vue index 858439c21..d06fd2a98 100644 --- a/resources/assets/js/annotations/components/annotationCanvas/polygonBrushInteraction.vue +++ b/resources/assets/js/annotations/components/annotationCanvas/polygonBrushInteraction.vue @@ -111,18 +111,24 @@ export default { }, watch: { isUsingPolygonBrush() { - this.resetCurrentInteraction(); - this.togglePolygonBrushInteraction(); + if(this.isUsingPolygonBrush){ + this.resetCurrentInteraction(); + this.togglePolygonBrushInteraction(); + } }, isUsingPolygonEraser() { - this.resetCurrentInteraction(); - this.toggleShiftClickSelectInteraction(); - this.togglePolygonEraserInteraction(); + if(this.isUsingPolygonEraser){ + this.resetCurrentInteraction(); + this.toggleShiftClickSelectInteraction(); + this.togglePolygonEraserInteraction(); + } }, isUsingPolygonFill() { - this.resetCurrentInteraction(); - this.toggleShiftClickSelectInteraction(); - this.togglePolygonFillInteraction(); + if(this.isUsingPolygonFill){ + this.resetCurrentInteraction(); + this.toggleShiftClickSelectInteraction(); + this.togglePolygonFillInteraction(); + } }, }, created() { From 05f1b085dd3a02c2a4a19ddaec5e77089afa0706 Mon Sep 17 00:00:00 2001 From: Leane Schlundt Date: Thu, 7 Mar 2024 07:52:04 +0100 Subject: [PATCH 2/3] Fix bug where interaction is not reset on escape --- .../annotationCanvas/polygonBrushInteraction.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/resources/assets/js/annotations/components/annotationCanvas/polygonBrushInteraction.vue b/resources/assets/js/annotations/components/annotationCanvas/polygonBrushInteraction.vue index d06fd2a98..8a2d96528 100644 --- a/resources/assets/js/annotations/components/annotationCanvas/polygonBrushInteraction.vue +++ b/resources/assets/js/annotations/components/annotationCanvas/polygonBrushInteraction.vue @@ -26,6 +26,9 @@ export default { isUsingPolygonFill() { return this.interactionMode === 'polygonFill'; }, + isDefault() { + return this.interactionMode === 'default'; + } }, methods: { togglePolygonBrush() { @@ -111,25 +114,30 @@ export default { }, watch: { isUsingPolygonBrush() { - if(this.isUsingPolygonBrush){ + if (this.isUsingPolygonBrush) { this.resetCurrentInteraction(); this.togglePolygonBrushInteraction(); } }, isUsingPolygonEraser() { - if(this.isUsingPolygonEraser){ + if (this.isUsingPolygonEraser) { this.resetCurrentInteraction(); this.toggleShiftClickSelectInteraction(); this.togglePolygonEraserInteraction(); } }, isUsingPolygonFill() { - if(this.isUsingPolygonFill){ + if (this.isUsingPolygonFill) { this.resetCurrentInteraction(); this.toggleShiftClickSelectInteraction(); this.togglePolygonFillInteraction(); } }, + isDefault() { + if (this.isDefault) { + this.resetCurrentInteraction(); + } + } }, created() { Keyboard.on('r', this.togglePolygonEraser, 0, this.listenerSet); From f194a08d6ffea04c9914522f3a8afd94463c0451 Mon Sep 17 00:00:00 2001 From: Leane Schlundt Date: Mon, 11 Mar 2024 07:48:45 +0100 Subject: [PATCH 3/3] Fix bug where magicwand tool and polygonbrush is active --- .../annotationCanvas/polygonBrushInteraction.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/assets/js/annotations/components/annotationCanvas/polygonBrushInteraction.vue b/resources/assets/js/annotations/components/annotationCanvas/polygonBrushInteraction.vue index 8a2d96528..c642e1100 100644 --- a/resources/assets/js/annotations/components/annotationCanvas/polygonBrushInteraction.vue +++ b/resources/assets/js/annotations/components/annotationCanvas/polygonBrushInteraction.vue @@ -26,8 +26,8 @@ export default { isUsingPolygonFill() { return this.interactionMode === 'polygonFill'; }, - isDefault() { - return this.interactionMode === 'default'; + isNotAPolygonTool() { + return !(this.isUsingPolygonBrush || this.isUsingPolygonEraser || this.isUsingPolygonFill); } }, methods: { @@ -133,8 +133,8 @@ export default { this.togglePolygonFillInteraction(); } }, - isDefault() { - if (this.isDefault) { + isNotAPolygonTool() { + if (this.isNotAPolygonTool) { this.resetCurrentInteraction(); } }