Skip to content

Commit

Permalink
Merge pull request #935 from biigle/annotation-shortcut
Browse files Browse the repository at this point in the history
Annotation shortcut
  • Loading branch information
mzur authored Oct 7, 2024
2 parents f238db0 + 27dc8ca commit 764ec21
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ export default {
}
},
convertMeasurement() {
if (!this.hasSelectedLabel) {
this.requireSelectedLabel(false);
} else {
this.annotationSource.addFeature(this.measureFeature);
this.handleNewFeature({feature: this.measureFeature});
this.clearMeasureFeature();
if (this.isMeasuring && !this.cantConvertMeasureFeature) {
if (!this.hasSelectedLabel) {
this.requireSelectedLabel(false);
} else {
this.annotationSource.addFeature(this.measureFeature);
this.handleNewFeature({feature: this.measureFeature});
this.clearMeasureFeature();
}
}
},
clearMeasureFeature() {
Expand Down Expand Up @@ -110,6 +112,7 @@ export default {
measureInteraction.on('drawstart', this.handleMeasureDrawStart);
measureInteraction.on('drawend', this.handleMeasureDrawEnd);
Keyboard.on('Shift+f', this.toggleMeasuring, 0, this.listenerSet);
Keyboard.on('Enter', this.convertMeasurement, 0, this.listenerSet)
// Do not make this reactive.
// See: https://github.com/biigle/annotations/issues/108
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</control-button>
<control-button icon="icon-linestring" title="Draw a line string 𝗙, hold π—¦π—΅π—Άπ—³π˜ for freehand" :active="isDrawingLineString" v-on:click="drawLineString">
<control-button icon="fa-ruler" title="Measure a line string π—¦π—΅π—Άπ—³π˜+𝗙" :active="isMeasuring" v-on:click="toggleMeasuring"></control-button>
<control-button icon="fa-check" title="Convert measurement to a line string" :disabled="cantConvertMeasureFeature" v-on:click="convertMeasurement"></control-button>
<control-button icon="fa-check" title="Convert measurement to a line string π—˜π—»π˜π—²π—Ώ" :disabled="cantConvertMeasureFeature" v-on:click="convertMeasurement"></control-button>
</control-button>
<control-button icon="icon-polygon" title="Draw a polygon π—š, hold π—¦π—΅π—Άπ—³π˜ for freehand" :active="isDrawingPolygon" v-on:click="drawPolygon">
<control-button v-cloak icon="fa-paint-brush" title="Draw a polygon using the brush tool π—˜" :active="isUsingPolygonBrush" v-on:click="togglePolygonBrush"></control-button>
Expand Down
19 changes: 19 additions & 0 deletions resources/views/manual/tutorials/annotations/shortcuts.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,25 @@
</tbody>
</table>

<p>
When the ruler tool is activated:
</p>

<table class="table">
<thead>
<tr>
<th>Key</th>
<th>Function</th>
</tr>
</thead>
<tbody>
<tr>
<td><kbd>Enter</kbd></td>
<td>Convert measurement to a line string annotation</td>
</tr>
</tbody>
</table>

<p>
When Volare (cycle through annotations) is activated:
</p>
Expand Down

0 comments on commit 764ec21

Please sign in to comment.