Merge pull request #18526 from calixteman/bug1907958
[Editor] Allow Float32Array for quadpoints in annotations (bug 1907958)
This commit is contained in:
commit
63371eaed8
@ -242,10 +242,19 @@ function isBooleanArray(arr, len) {
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isNumberArray(arr, len) {
|
function isNumberArray(arr, len) {
|
||||||
|
if (Array.isArray(arr)) {
|
||||||
|
return (
|
||||||
|
(len === null || arr.length === len) &&
|
||||||
|
arr.every(x => typeof x === "number")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This check allows us to have typed arrays but not the
|
||||||
|
// BigInt64Array/BigUint64Array types (their elements aren't "number").
|
||||||
return (
|
return (
|
||||||
Array.isArray(arr) &&
|
ArrayBuffer.isView(arr) &&
|
||||||
(len === null || arr.length === len) &&
|
(arr.length === 0 || typeof arr[0] === "number") &&
|
||||||
arr.every(x => typeof x === "number")
|
(len === null || arr.length === len)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -610,7 +610,7 @@ class Driver {
|
|||||||
|
|
||||||
if (task.annotationStorage) {
|
if (task.annotationStorage) {
|
||||||
for (const annotation of Object.values(task.annotationStorage)) {
|
for (const annotation of Object.values(task.annotationStorage)) {
|
||||||
const { bitmapName } = annotation;
|
const { bitmapName, quadPoints } = annotation;
|
||||||
if (bitmapName) {
|
if (bitmapName) {
|
||||||
promise = promise.then(async doc => {
|
promise = promise.then(async doc => {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
@ -643,6 +643,11 @@ class Driver {
|
|||||||
return doc;
|
return doc;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (quadPoints) {
|
||||||
|
// Just to ensure that the quadPoints are always a Float32Array
|
||||||
|
// like IRL (in order to avoid bugs like bug 1907958).
|
||||||
|
annotation.quadPoints = new Float32Array(quadPoints);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user