Skip to content

Commit

Permalink
Select last editor tool on new annotation, closes #85
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Feb 16, 2019
1 parent 04298bf commit 6532752
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 8 deletions.
1 change: 1 addition & 0 deletions client/src/components/annotator/Category.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export default {
this.selectedAnnotation = annotationId;
this.$nextTick(() => {
this.$parent.selectLastEditorTool();
this.$emit("click", {
annotation: annotationId,
category: this.index
Expand Down
1 change: 1 addition & 0 deletions client/src/components/annotator/tools/BrushTool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export default {
if (active) {
this.tool.activate();
localStorage.setItem("editorTool", this.name)
}
},
/**
Expand Down
1 change: 1 addition & 0 deletions client/src/components/annotator/tools/EraserTool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export default {
if (active) {
this.tool.activate();
localStorage.setItem("editorTool", this.name)
}
},
/**
Expand Down
8 changes: 8 additions & 0 deletions client/src/components/annotator/tools/MagicWandTool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ export default {
}
};
},
watch: {
isActive(active) {
if (active) {
this.tool.activate();
localStorage.setItem("editorTool", this.name)
}
}
},
methods: {
/**
* Exports settings
Expand Down
6 changes: 6 additions & 0 deletions client/src/components/annotator/tools/PolygonTool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ export default {
}
},
watch: {
isActive(active) {
if (active) {
this.tool.activate();
localStorage.setItem("editorTool", this.name)
}
},
/**
* Change width of stroke based on zoom of image
*/
Expand Down
17 changes: 9 additions & 8 deletions client/src/components/cards/ImageCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
@mouseover="hover = true"
@mouseleave="hover = false"
>
<v-lazy-image
:src="imageUrl"
:src-placeholder="loaderUrl"
@click="openAnnotator"
class="card-img-top"
style="width: 100%; display: block"
:style="{'opacity': annotated ? 0.3 : 1}"
/>
<div @click="openAnnotator">
<v-lazy-image
:src="imageUrl"
:src-placeholder="loaderUrl"
class="card-img-top"
style="width: 100%; display: block"
:style="{'opacity': annotated ? 0.3 : 1}"
/>
</div>

<b v-if="annotated" class="overlay-text text-center">
Being annotated by {{image.annotating.join(', ')}}
Expand Down
4 changes: 4 additions & 0 deletions client/src/views/Annotator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,10 @@ export default {
this.currentAnnotation.subtract(compound, simplify, undoable);
},
selectLastEditorTool() {
this.activeTool = localStorage.getItem("editorTool") || "Select"
},
setCursor(newCursor) {
this.cursor = newCursor;
},
Expand Down

0 comments on commit 6532752

Please sign in to comment.