@cogic/annotorious 2.7.17 → 2.7.19

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/dist/index.html CHANGED
@@ -68,6 +68,8 @@
68
68
  minPolygonPoints: 3,
69
69
  crosshair: true,
70
70
  crosshairWithCursor: true,
71
+ disableEscapeKey: false,
72
+ disableDeleteKey: false,
71
73
 
72
74
  // Only works when drawOnSingleClick is true
73
75
  addPolygonPointOnMouseDown: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cogic/annotorious",
3
- "version": "2.7.17",
3
+ "version": "2.7.19",
4
4
  "description": "A JavaScript image annotation library",
5
5
  "main": "dist/annotorious.min.js",
6
6
  "scripts": {
package/public/index.html CHANGED
@@ -68,6 +68,8 @@
68
68
  minPolygonPoints: 3,
69
69
  crosshair: true,
70
70
  crosshairWithCursor: true,
71
+ disableEscapeKey: false,
72
+ disableDeleteKey: false,
71
73
 
72
74
  // Only works when drawOnSingleClick is true
73
75
  addPolygonPointOnMouseDown: true,
@@ -72,12 +72,16 @@ export default class ImageAnnotator extends Component {
72
72
 
73
73
  onKeyUp = evt => {
74
74
  if (evt.which === 27) { // Escape
75
- this.annotationLayer.stopDrawing();
76
-
77
- const { selectedAnnotation } = this.state;
78
- if (selectedAnnotation) {
79
- this.cancelSelected();
80
- this.props.onCancelSelected(selectedAnnotation);
75
+ const { disableEscapeKey } = this.props.config;
76
+
77
+ if (!disableEscapeKey) {
78
+ this.annotationLayer.stopDrawing();
79
+
80
+ const { selectedAnnotation } = this.state;
81
+ if (selectedAnnotation) {
82
+ this.cancelSelected();
83
+ this.props.onCancelSelected(selectedAnnotation);
84
+ }
81
85
  }
82
86
  } else if (evt.which === 46) { // Delete
83
87
  const { disableDeleteKey } = this.props.config;
@@ -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();