@cogic/annotorious 2.7.16 → 2.7.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cogic/annotorious",
3
- "version": "2.7.16",
3
+ "version": "2.7.18",
4
4
  "description": "A JavaScript image annotation library",
5
5
  "main": "dist/annotorious.min.js",
6
6
  "scripts": {
@@ -309,6 +309,9 @@ export default class ImageAnnotator extends Component {
309
309
 
310
310
  getCurrentDrawingTool = () => this.annotationLayer.tools?.current;
311
311
 
312
+ getSelectedShape = () =>
313
+ this.annotationLayer.selectedShape;
314
+
312
315
  listDrawingTools = () =>
313
316
  this.annotationLayer.listDrawingTools();
314
317
 
package/src/index.jsx CHANGED
@@ -202,6 +202,8 @@ export class Annotorious {
202
202
 
203
203
  getCurrentDrawingTool = () => this._app.current.getCurrentDrawingTool();
204
204
 
205
+ getSelectedShape = () => this._app.current.getSelectedShape();
206
+
205
207
  listDrawingTools = () =>
206
208
  this._app.current.listDrawingTools();
207
209
 
@@ -24,6 +24,8 @@ export default class RubberbandRectTool extends Tool {
24
24
  }
25
25
 
26
26
  stop = () => {
27
+ this.detachListeners();
28
+
27
29
  if (this.rubberband) {
28
30
  this.rubberband.destroy();
29
31
  this.rubberband = null;
@@ -40,7 +42,6 @@ export default class RubberbandRectTool extends Tool {
40
42
  }
41
43
 
42
44
  onMouseUp = () => {
43
- this.detachListeners();
44
45
  this.started = false;
45
46
 
46
47
  const { width, height } = this.rubberband.getBoundingClientRect();