@annotorious/annotorious 3.0.19 → 3.0.21

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.0.19",
3
+ "version": "3.0.21",
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",
@@ -40,17 +40,17 @@
40
40
  "@sveltejs/vite-plugin-svelte": "^3.1.2",
41
41
  "@tsconfig/svelte": "^5.0.4",
42
42
  "@types/rbush": "^4.0.0",
43
- "jsdom": "^25.0.1",
43
+ "jsdom": "^26.0.0",
44
44
  "svelte": "^4.2.19",
45
45
  "svelte-preprocess": "^6.0.3",
46
- "typescript": "5.7.2",
47
- "vite": "^5.4.11",
48
- "vite-plugin-dts": "^4.3.0",
49
- "vitest": "^2.1.8"
46
+ "typescript": "5.7.3",
47
+ "vite": "^5.4.14",
48
+ "vite-plugin-dts": "^4.5.0",
49
+ "vitest": "^3.0.4"
50
50
  },
51
51
  "dependencies": {
52
- "@annotorious/core": "3.0.19",
52
+ "@annotorious/core": "3.0.21",
53
53
  "rbush": "^4.0.1",
54
- "uuid": "^11.0.3"
54
+ "uuid": "^11.0.5"
55
55
  }
56
56
  }
@@ -114,10 +114,8 @@ export const createImageAnnotator = <I extends Annotation = ImageAnnotation, E e
114
114
  // Most of the external API functions are covered in the base annotator
115
115
  const base = createBaseAnnotator<I, E>(state, undoStack, opts.adapter);
116
116
 
117
- const cancelDrawing = () => {
118
- annotationLayer.$set({ drawingEnabled: false });
119
- setTimeout(() => annotationLayer.$set({ drawingEnabled: true }), 1);
120
- }
117
+ const cancelDrawing = () =>
118
+ annotationLayer.cancelDrawing();
121
119
 
122
120
  const destroy = () => {
123
121
  // Destroy Svelte annotation layer
@@ -23,7 +23,11 @@
23
23
  export let user: User;
24
24
  export let visible = true;
25
25
 
26
+ // Trick to force tool re-mounting on cancelDrawing
27
+ let toolMountKey = 0;
28
+
26
29
  /** API methods */
30
+ export const cancelDrawing = () => toolMountKey += 1;
27
31
  export const getDrawingTool = () => toolName;
28
32
  export const isDrawingEnabled = () => drawingEnabled;
29
33
 
@@ -195,7 +199,7 @@
195
199
  {/if}
196
200
  {/each}
197
201
  {:else if (tool && drawingEnabled)}
198
- {#key toolName}
202
+ {#key `${toolName}-${toolMountKey}`}
199
203
  <ToolMount
200
204
  target={drawingEl}
201
205
  tool={tool}
@@ -181,7 +181,7 @@
181
181
 
182
182
  {#if isClosable}
183
183
  <rect
184
- class="a9s-corner-handle"
184
+ class="a9s-handle"
185
185
  x={points[0][0] - handleSize / 2}
186
186
  y={points[0][1] - handleSize / 2}
187
187
  height={handleSize}