mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
[Editor] Allow Float32Array for quadpoints in annotations (bug 1907958)
Added annotations could have some quadpoints (highlight, ink). The isNumberArray check was returning false and consequently the annotation wasn't printable. The tests didn't catch this issue because the quadpoints were passed as Array. So driver.js has been updated in order to pass them as Float32Array in order to be in a situation similar to the real life one.
This commit is contained in:
parent
f6b356eff7
commit
5f95d9b1ba
2 changed files with 18 additions and 4 deletions
|
@ -242,10 +242,19 @@ function isBooleanArray(arr, len) {
|
|||
* @returns {boolean}
|
||||
*/
|
||||
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 (
|
||||
Array.isArray(arr) &&
|
||||
(len === null || arr.length === len) &&
|
||||
arr.every(x => typeof x === "number")
|
||||
ArrayBuffer.isView(arr) &&
|
||||
(arr.length === 0 || typeof arr[0] === "number") &&
|
||||
(len === null || arr.length === len)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue