@searpent/react-image-annotate 2.0.37 → 2.0.38
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/Annotator/examplePhotos.js +4 -4
- package/hooks/use-colors.js +15 -1
- package/package.json +1 -1
|
@@ -420,7 +420,7 @@ var examplePhotos = [{
|
|
|
420
420
|
"Y2": 0.8037425
|
|
421
421
|
},
|
|
422
422
|
"text": "[{\"label\":\"title\",\"text\":\"Fotbal. Remíza s Ukrajinou\"}]",
|
|
423
|
-
"groupId": "
|
|
423
|
+
"groupId": "42ba09e0-b2f5-439d-bdae-201e7c37787b",
|
|
424
424
|
"id": "346807503780052992"
|
|
425
425
|
}, {
|
|
426
426
|
"label": "text",
|
|
@@ -432,7 +432,7 @@ var examplePhotos = [{
|
|
|
432
432
|
"Y2": 0.95930564
|
|
433
433
|
},
|
|
434
434
|
"text": "[{\"label\":\"text\",\"text\":\"\"}]",
|
|
435
|
-
"groupId": "
|
|
435
|
+
"groupId": "42ba09e0-b2f5-439d-bdae-201e7c37787b",
|
|
436
436
|
"id": "346807503780052993"
|
|
437
437
|
}, {
|
|
438
438
|
"label": "author",
|
|
@@ -444,7 +444,7 @@ var examplePhotos = [{
|
|
|
444
444
|
"Y2": 0.95930564
|
|
445
445
|
},
|
|
446
446
|
"text": "[{\"label\":\"author\",\"text\":\"ČTK\"}]",
|
|
447
|
-
"groupId": "
|
|
447
|
+
"groupId": "42ba09e0-b2f5-439d-bdae-201e7c37787b",
|
|
448
448
|
"id": "346807503780052994"
|
|
449
449
|
}, {
|
|
450
450
|
"label": "title",
|
|
@@ -784,7 +784,7 @@ var examplePhotos = [{
|
|
|
784
784
|
"Y2": 1
|
|
785
785
|
},
|
|
786
786
|
"text": "[{\"key\":\"articleType\",\"value\":\"news\"}, {\"key\":\"section\",\"value\":\"editorial\"}]",
|
|
787
|
-
"groupId": "
|
|
787
|
+
"groupId": "42ba09e0-b2f5-439d-bdae-201e7c37787b",
|
|
788
788
|
"id": "aba453dd-f870-4510-ae40-a19eb52eb7d6"
|
|
789
789
|
}, {
|
|
790
790
|
"label": "metadata",
|
package/hooks/use-colors.js
CHANGED
|
@@ -50,6 +50,16 @@ function defaultClsColor(cls) {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
function stringToNumber(str) {
|
|
54
|
+
var sum = 0;
|
|
55
|
+
|
|
56
|
+
for (var index = 0; index < str.length; index++) {
|
|
57
|
+
sum += str.charCodeAt(index);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return sum;
|
|
61
|
+
}
|
|
62
|
+
|
|
53
63
|
var useColors = function useColors() {
|
|
54
64
|
var _useSettings = useSettings(),
|
|
55
65
|
clsColors = _useSettings.clsColors,
|
|
@@ -68,7 +78,11 @@ var useColors = function useColors() {
|
|
|
68
78
|
};
|
|
69
79
|
|
|
70
80
|
var groupColor = function groupColor(idx) {
|
|
71
|
-
|
|
81
|
+
if (isNaN(idx)) {
|
|
82
|
+
return groupColors[stringToNumber(idx) % groupColors.length] || DEFAULT_GROUP_COLOR;
|
|
83
|
+
} else {
|
|
84
|
+
return groupColors[idx % groupColors.length] || DEFAULT_GROUP_COLOR;
|
|
85
|
+
}
|
|
72
86
|
};
|
|
73
87
|
|
|
74
88
|
return {
|