@annotorious/annotorious 3.7.6 → 3.7.8

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": "@annotorious/annotorious",
3
- "version": "3.7.6",
3
+ "version": "3.7.8",
4
4
  "description": "Add image annotation functionality to any web page with a few lines of JavaScript",
5
5
  "author": "Rainer Simon",
6
6
  "license": "BSD-3-Clause",
@@ -49,7 +49,7 @@
49
49
  "vitest": "^3.2.4"
50
50
  },
51
51
  "dependencies": {
52
- "@annotorious/core": "3.7.6",
52
+ "@annotorious/core": "3.7.8",
53
53
  "dequal": "^2.0.3",
54
54
  "rbush": "^4.0.1",
55
55
  "simplify-js": "^1.2.4",
@@ -94,9 +94,15 @@
94
94
 
95
95
  cursor = point;
96
96
  } else {
97
- points.push(cursor!);
97
+ if (cursor)
98
+ points.push(cursor);
98
99
  }
99
100
  } else {
101
+ // Edge case: if anno.setDrawingEnabled(true) is called while
102
+ // the pointer is down, this handler may fire with an undefined
103
+ // cursor (in drag mode). In this case: ignore.
104
+ if (!cursor) return;
105
+
100
106
  // Require minimum drag of 4px
101
107
  if (points.length === 1) {
102
108
  const dist = distance(points[0], cursor!);
@@ -116,7 +122,7 @@
116
122
  if (isClosable) {
117
123
  stopDrawing();
118
124
  } else {
119
- points.push(cursor!);
125
+ points.push(cursor);
120
126
  }
121
127
  }
122
128
  }