@annotorious/annotorious 3.6.4 → 3.6.6
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/annotation/editors/index.d.ts +1 -0
- package/dist/annotorious.css +1 -1
- package/dist/annotorious.es.js +562 -561
- package/dist/annotorious.es.js.map +1 -1
- package/dist/annotorious.js +1 -1
- package/dist/annotorious.js.map +1 -1
- package/dist/state/spatialTree.d.ts +2 -2
- package/package.json +2 -2
- package/src/Annotorious.css +4 -4
- package/src/annotation/editors/index.ts +2 -1
- package/src/annotation/editors/polygon/PolygonEditor.svelte +1 -1
- package/src/model/core/polyline/polylineUtils.ts +1 -1
- package/src/state/ImageAnnotatorState.ts +3 -3
- package/src/state/spatialTree.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ImageAnnotationTarget } from '../model';
|
|
2
|
-
import {
|
|
2
|
+
import { AnnotationTarget } from '@annotorious/core';
|
|
3
3
|
interface IndexedTarget {
|
|
4
4
|
minX: number;
|
|
5
5
|
minY: number;
|
|
@@ -10,7 +10,7 @@ interface IndexedTarget {
|
|
|
10
10
|
export declare const createSpatialTree: () => {
|
|
11
11
|
all: () => IndexedTarget[];
|
|
12
12
|
clear: () => void;
|
|
13
|
-
getAt: (x: number, y: number,
|
|
13
|
+
getAt: (x: number, y: number, buffer?: number) => ImageAnnotationTarget[];
|
|
14
14
|
getIntersecting: (x: number, y: number, width: number, height: number) => ImageAnnotationTarget[];
|
|
15
15
|
insert: (target: AnnotationTarget) => void;
|
|
16
16
|
remove: (target: AnnotationTarget) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@annotorious/annotorious",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.6",
|
|
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.
|
|
52
|
+
"@annotorious/core": "3.6.6",
|
|
53
53
|
"dequal": "^2.0.3",
|
|
54
54
|
"rbush": "^4.0.1",
|
|
55
55
|
"simplify-js": "^1.2.4",
|
package/src/Annotorious.css
CHANGED
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
user-select: none;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.a9s-annotationlayer.
|
|
23
|
-
|
|
22
|
+
.a9s-annotationlayer.hover {
|
|
23
|
+
cursor: pointer;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.a9s-annotationlayer
|
|
27
|
-
|
|
26
|
+
.a9s-annotationlayer.hidden {
|
|
27
|
+
display: none;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.a9s-annotationlayer ellipse,
|
|
@@ -4,4 +4,5 @@ export * from './editorsRegistry';
|
|
|
4
4
|
|
|
5
5
|
export { default as Editor } from './Editor.svelte';
|
|
6
6
|
export { default as EditorMount } from './EditorMount.svelte';
|
|
7
|
-
export { default as Handle } from './Handle.svelte';
|
|
7
|
+
export { default as Handle } from './Handle.svelte';
|
|
8
|
+
export { default as MidpointHandle } from './MidpointHandle.svelte';
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
.reduce((closest, midpoint) =>
|
|
78
78
|
getDistSq(midpoint.point) < getDistSq(closest.point) ? midpoint : closest);
|
|
79
79
|
|
|
80
|
-
// Show midpoint
|
|
80
|
+
// Show midpoint if the mouse is at least within THRESHOLD distance
|
|
81
81
|
// of the midpoint or the closest corner. (Basically a poor man's shape buffering).
|
|
82
82
|
const threshold = Math.pow(MIN_HOVER_DISTANCE / viewportScale, 2);
|
|
83
83
|
|
|
@@ -38,7 +38,7 @@ export const approximateAsPolygon = (corners: PolylinePoint[], closed = false):
|
|
|
38
38
|
|
|
39
39
|
// If there's a curve to the next point, approximate it
|
|
40
40
|
if (i < corners.length - 1 || closed) {
|
|
41
|
-
const hasCurve = currentPoint.
|
|
41
|
+
const hasCurve = currentPoint.type === 'CURVE' || nextPoint.type == 'CURVE';
|
|
42
42
|
if (hasCurve) {
|
|
43
43
|
const curvePoints = approximateBezierCurve(
|
|
44
44
|
currentPoint.point,
|
|
@@ -55,7 +55,7 @@ export const createImageAnnotatorState = <I extends Annotation, E extends unknow
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
const getAt = (x: number, y: number, filter?: Filter<I>, buffer?: number): I | undefined => {
|
|
58
|
-
const targets = tree.getAt(x, y,
|
|
58
|
+
const targets = tree.getAt(x, y, buffer);
|
|
59
59
|
|
|
60
60
|
if (filter) {
|
|
61
61
|
// Resolve annotations first, so we can filter
|
|
@@ -72,8 +72,8 @@ export const createImageAnnotatorState = <I extends Annotation, E extends unknow
|
|
|
72
72
|
|
|
73
73
|
const getIntersecting = (x: number, y: number, width: number, height: number) =>
|
|
74
74
|
tree.getIntersecting(x, y, width, height)
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
.map(target => store.getAnnotation(target.annotation) as I)
|
|
76
|
+
.filter(Boolean); // Race conditions may have deleted annotations concurrently
|
|
77
77
|
|
|
78
78
|
return {
|
|
79
79
|
store: {
|
package/src/state/spatialTree.ts
CHANGED
|
@@ -75,7 +75,7 @@ export const createSpatialTree = () => {
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
const getAt = (x: number, y: number,
|
|
78
|
+
const getAt = (x: number, y: number, buffer: number = 0): ImageAnnotationTarget[] => {
|
|
79
79
|
const idxHits = tree.search({
|
|
80
80
|
minX: x - buffer,
|
|
81
81
|
minY: y - buffer,
|