@annotorious/annotorious 3.1.3 → 3.1.4

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.1.3",
3
+ "version": "3.1.4",
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.0.4"
50
50
  },
51
51
  "dependencies": {
52
- "@annotorious/core": "3.1.3",
52
+ "@annotorious/core": "3.1.4",
53
53
  "rbush": "^4.0.1",
54
54
  "uuid": "^11.0.5"
55
55
  }
@@ -22,7 +22,7 @@
22
22
  // Keep track of the user keeping the finger
23
23
  // in place. Long pauses will be interpreted like a
24
24
  // double click and close the shape.
25
- let touchPauseTimer: number | undefined;
25
+ let touchPauseTimer: ReturnType<typeof setTimeout> | undefined;
26
26
 
27
27
  let isClosable: boolean = false;
28
28
 
@@ -121,17 +121,18 @@
121
121
  }
122
122
  }
123
123
 
124
- const onDblClick = () => {
124
+ const onDblClick = () => {
125
125
  if (!cursor) return;
126
126
 
127
- // Require min 3 points (incl. cursor) and minimum
128
- // polygon area
129
- const p = [...points, cursor];
127
+ // Require min 3 points and minimum polygon area.
128
+ // Note that the double click will have added a duplicate point!
129
+ const p = points.slice(0, -1);
130
+ if (p.length < 3) return;
130
131
 
131
132
  const shape: Polygon = {
132
133
  type: ShapeType.POLYGON,
133
134
  geometry: {
134
- bounds: boundsFromPoints(p),
135
+ bounds: boundsFromPoints(points),
135
136
  points: p
136
137
  }
137
138
  }
@@ -140,7 +141,7 @@
140
141
  if (area > 4) {
141
142
  points = [];
142
143
  cursor = undefined;
143
-
144
+
144
145
  dispatch('create', shape);
145
146
  }
146
147
  }
@@ -156,7 +157,7 @@
156
157
 
157
158
  points = [];
158
159
  cursor = undefined;
159
-
160
+
160
161
  dispatch('create', shape);
161
162
  }
162
163