@annotorious/annotorious 3.3.1 → 3.3.2
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.3.
|
|
3
|
+
"version": "3.3.2",
|
|
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.9"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@annotorious/core": "3.3.
|
|
52
|
+
"@annotorious/core": "3.3.2",
|
|
53
53
|
"rbush": "^4.0.1",
|
|
54
54
|
"svg-pathdata": "^7.2.0",
|
|
55
55
|
"uuid": "^11.1.0"
|
|
@@ -52,11 +52,13 @@ export const parseW3CImageAnnotation = (
|
|
|
52
52
|
const w3cTarget = Array.isArray(annotation.target)
|
|
53
53
|
? annotation.target[0] : annotation.target;
|
|
54
54
|
|
|
55
|
-
const w3cSelector =
|
|
56
|
-
? w3cTarget
|
|
55
|
+
const w3cSelector =
|
|
56
|
+
typeof w3cTarget === 'string' ? w3cTarget :
|
|
57
|
+
Array.isArray(w3cTarget.selector)
|
|
58
|
+
? w3cTarget.selector[0] : w3cTarget.selector;
|
|
57
59
|
|
|
58
60
|
const selector =
|
|
59
|
-
w3cSelector?.type === 'FragmentSelector' ?
|
|
61
|
+
typeof w3cSelector === 'string' || w3cSelector?.type === 'FragmentSelector' ?
|
|
60
62
|
parseFragmentSelector(w3cSelector as FragmentSelector, opts.invertY) :
|
|
61
63
|
w3cSelector?.type === 'SvgSelector' ?
|
|
62
64
|
parseSVGSelector(w3cSelector as SVGSelector) : undefined;
|
|
@@ -15,11 +15,10 @@ export const parseFragmentSelector = (
|
|
|
15
15
|
fragmentOrSelector: FragmentSelector | string,
|
|
16
16
|
invertY = false
|
|
17
17
|
): Rectangle => {
|
|
18
|
-
|
|
19
18
|
const fragment =
|
|
20
19
|
typeof fragmentOrSelector === 'string' ? fragmentOrSelector : fragmentOrSelector.value;
|
|
21
20
|
|
|
22
|
-
const regex =
|
|
21
|
+
const regex = /(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g;
|
|
23
22
|
|
|
24
23
|
const matches = [...fragment.matchAll(regex)][0];
|
|
25
24
|
const [_, prefix, unit, a, b, c, d] = matches;
|