@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.
@@ -1,5 +1,5 @@
1
1
  import { ImageAnnotationTarget } from '../model';
2
- import { Annotation, AnnotationTarget, Filter } from '@annotorious/core';
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, filter?: Filter<Annotation>, buffer?: number) => ImageAnnotationTarget[];
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.4",
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.4",
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",
@@ -19,12 +19,12 @@
19
19
  user-select: none;
20
20
  }
21
21
 
22
- .a9s-annotationlayer.hidden {
23
- display: none;
22
+ .a9s-annotationlayer.hover {
23
+ cursor: pointer;
24
24
  }
25
25
 
26
- .a9s-annotationlayer .a9s-annotation {
27
- cursor: pointer;
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 of the mouse is at least within THRESHOLD distance
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.outHandle || nextPoint.inHandle;
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, filter as Filter<Annotation>, buffer);
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
- .map(target => store.getAnnotation(target.annotation) as I)
76
- .filter(Boolean); // Race conditions may have deleted annotations concurrently
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: {
@@ -75,7 +75,7 @@ export const createSpatialTree = () => {
75
75
  };
76
76
 
77
77
 
78
- const getAt = (x: number, y: number, filter?: Filter<Annotation>, buffer: number = 0): ImageAnnotationTarget[] => {
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,