mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
- Allow all TypedArrays
- Validator should not crash when TypedArray is not available
This commit is contained in:
parent
01134dcf2a
commit
f6d077b3ec
@ -142,7 +142,10 @@ export function getFunctionValidator() {
|
||||
export function getNumberArrayValidator() {
|
||||
if (Konva.isUnminified) {
|
||||
return function (val: any, attr: string) {
|
||||
if (val instanceof Uint8Array || val instanceof Uint16Array || val instanceof Uint32Array || val instanceof Uint8ClampedArray) {
|
||||
// Retrieve TypedArray constructor as found in MDN (if TypedArray is available)
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#description
|
||||
const TypedArray = Int8Array ? Object.getPrototypeOf(Int8Array) : null;
|
||||
if (TypedArray && val instanceof TypedArray) {
|
||||
return val
|
||||
}
|
||||
if (!Util._isArray(val)) {
|
||||
|
@ -51,7 +51,7 @@ function expandPoints(p, tension) {
|
||||
}
|
||||
|
||||
export interface LineConfig extends ShapeConfig {
|
||||
points?: number[] | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray;
|
||||
points?: number[] | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
||||
tension?: number;
|
||||
closed?: boolean;
|
||||
bezier?: boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user