Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit ec8edc4

Browse files
committed
🐛 Fix unselect in select feature
1 parent fadc1c4 commit ec8edc4

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-annotator",
3-
"version": "0.13.1",
3+
"version": "0.13.2",
44
"description": "Vue Component for drawing annotation (box, etc)",
55
"homepage": "http://vue-annotator.surge.sh",
66
"repository": "github:DrSensor/vue-annotator",

src/components/Annotator.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ export default {
5151
this.enableDrawing(value)
5252
},
5353
noInteract: function (value) {
54-
this.enableInteraction(value)
54+
this.enableInteraction(!value)
5555
},
5656
noSelect: function (value) {
57-
this.enableSelection(value)
57+
this.enableSelection(!value)
5858
},
5959
},
6060
@@ -105,9 +105,9 @@ export default {
105105
},
106106
107107
mounted () {
108+
this.background = SVG.adopt(this.$refs.bgSvg)
109+
this.annotations = SVG.adopt(this.$refs.annotations)
108110
this.$nextTick(() => {
109-
this.background = SVG.adopt(this.$refs.bgSvg)
110-
this.annotations = SVG.adopt(this.$refs.annotations)
111111
this.enableSelection(!this.noSelect)
112112
this.enableInteraction(!this.noInteract)
113113
this.enableDrawing(this.drawing)

src/mixins/select.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ function btncode2string (code) {
66
if (code === 0) return 'left'
77
else if (code === 1) return 'middle'
88
else if (code === 2) return 'right'
9-
return ''
9+
return null
1010
}
1111

1212
export default {
1313
props: {
1414
multipleSelect: Boolean,
1515
mouseSelect: {
16-
default: '',
16+
default: null,
1717
type: String
1818
}
1919
},
@@ -48,7 +48,7 @@ export default {
4848
}
4949

5050
const selectListener = event => {
51-
if (this.mouseSelect === btncode2string(event.button)) {
51+
if (!this.mouseSelect || this.mouseSelect === btncode2string(event.button) || !btncode2string(event.button)) {
5252
const selector = annotator.selectize({
5353
deepSelect: true,
5454
rotationPoint: false,
@@ -72,7 +72,7 @@ export default {
7272
if (this.$refs.annotations.hasChildNodes()) {
7373
this.$refs.annotations.childNodes.forEach((node, id) => {
7474
if (!enabled) {
75-
interact(node).selection.off('tap')
75+
interact(node).off('tap')
7676
this.background.fire('click') // unselect all
7777
this.background.off('click')
7878
} else {

0 commit comments

Comments
 (0)