@deepnoid/canvas 0.1.45 → 0.1.47
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.
|
@@ -71,7 +71,7 @@ const AnnotationCanvas = ({ image, coordinates, setCoordinates, options, drawing
|
|
|
71
71
|
};
|
|
72
72
|
}, [image, resetOnImageChange]);
|
|
73
73
|
useEffect(() => {
|
|
74
|
-
if (imageRef.current.src
|
|
74
|
+
if (imageRef.current.src) {
|
|
75
75
|
updateDisplayCoordinates(coordinates);
|
|
76
76
|
}
|
|
77
77
|
}, [coordinates, imageRef.current]);
|
|
@@ -40,26 +40,17 @@ export const isEqualWith = (a, b, areValuesEqual) => {
|
|
|
40
40
|
};
|
|
41
41
|
export const ignoreImageKey = (objValue, othValue) => {
|
|
42
42
|
if (Array.isArray(objValue) && Array.isArray(othValue)) {
|
|
43
|
-
if (objValue.length !== othValue.length)
|
|
43
|
+
if (objValue.length !== othValue.length)
|
|
44
44
|
return false;
|
|
45
|
-
|
|
46
|
-
for (let i = 0; i < objValue.length; i++) {
|
|
47
|
-
if (!isEqualWith(objValue[i], othValue[i], ignoreImageKey)) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
45
|
+
return objValue.every((item, i) => isEqualWith(item, othValue[i], ignoreImageKey));
|
|
52
46
|
}
|
|
53
|
-
if (typeof objValue === 'object' && typeof othValue === 'object' && objValue
|
|
54
|
-
const objKeys = Object.keys(objValue);
|
|
55
|
-
const othKeys = Object.keys(othValue);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
for (let key of objKeys) {
|
|
60
|
-
if (key === 'image') {
|
|
47
|
+
if (typeof objValue === 'object' && typeof othValue === 'object' && objValue && othValue) {
|
|
48
|
+
const objKeys = Object.keys(objValue).filter((key) => key !== 'image');
|
|
49
|
+
const othKeys = Object.keys(othValue).filter((key) => key !== 'image');
|
|
50
|
+
const allKeys = new Set([...objKeys, ...othKeys]);
|
|
51
|
+
for (const key of allKeys) {
|
|
52
|
+
if (key === 'image')
|
|
61
53
|
continue;
|
|
62
|
-
}
|
|
63
54
|
if (!isEqualWith(objValue[key], othValue[key], ignoreImageKey)) {
|
|
64
55
|
return false;
|
|
65
56
|
}
|