@annotorious/annotorious 3.6.6 → 3.6.7

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.6.6",
3
+ "version": "3.6.7",
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.6.6",
52
+ "@annotorious/core": "3.6.7",
53
53
  "dequal": "^2.0.3",
54
54
  "rbush": "^4.0.1",
55
55
  "simplify-js": "^1.2.4",
@@ -42,8 +42,8 @@ export const approximateAsPolygon = (corners: PolylinePoint[], closed = false):
42
42
  if (hasCurve) {
43
43
  const curvePoints = approximateBezierCurve(
44
44
  currentPoint.point,
45
- currentPoint.outHandle || currentPoint.point,
46
- nextPoint.inHandle || nextPoint.point,
45
+ currentPoint.type === 'CURVE' ? currentPoint.outHandle || currentPoint.point : currentPoint.point,
46
+ nextPoint.type === 'CURVE' ? nextPoint.inHandle || nextPoint.point : nextPoint.point,
47
47
  nextPoint.point,
48
48
  10 // number of approximation segments
49
49
  );
@@ -85,12 +85,12 @@ const isPointNearPath = (geom: PolylineGeometry, point: [number, number], buffer
85
85
  const currentPoint = geom.points[i];
86
86
  const nextPoint = geom.points[i + 1];
87
87
 
88
- const hasCurve = currentPoint.outHandle || nextPoint.inHandle;
88
+ const hasCurve = currentPoint.type === 'CURVE' || nextPoint.type === 'CURVE';
89
89
  if (hasCurve) {
90
90
  const curvePoints = approximateBezierCurve(
91
91
  currentPoint.point,
92
- currentPoint.outHandle || currentPoint.point,
93
- nextPoint.inHandle || nextPoint.point,
92
+ currentPoint.type === 'CURVE' ? currentPoint.outHandle || currentPoint.point : currentPoint.point,
93
+ nextPoint.type === 'CURVE' ? nextPoint.inHandle || nextPoint.point : nextPoint.point,
94
94
  nextPoint.point,
95
95
  20 // TODO make configurable? Based on scale factor? Length?
96
96
  );
@@ -174,8 +174,7 @@ export const computeSVGPath = (geom: PolylineGeometry) => {
174
174
  const lastPoint = geom.points[geom.points.length - 1];
175
175
  const firstPointRef = geom.points[0];
176
176
 
177
- const hasClosingCurve = lastPoint.outHandle || firstPointRef.inHandle;
178
-
177
+ const hasClosingCurve = lastPoint.type === 'CURVE' || firstPointRef.type === 'CURVE';
179
178
  if (hasClosingCurve) {
180
179
  const cp1 = lastPoint.outHandle || lastPoint.point;
181
180
  const cp2 = firstPointRef.inHandle || firstPointRef.point;