From 01134dcf2adf5a84898402199abbff3bf048a7a1 Mon Sep 17 00:00:00 2001 From: Tim de Koning Date: Mon, 8 Aug 2022 12:19:47 +0200 Subject: [PATCH] Allow line points to be of type TypedArray. --- src/Validators.ts | 3 +++ src/shapes/Line.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Validators.ts b/src/Validators.ts index a41e6537..48da4d2d 100644 --- a/src/Validators.ts +++ b/src/Validators.ts @@ -142,6 +142,9 @@ 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) { + return val + } if (!Util._isArray(val)) { Util.warn( _formatValue(val) + diff --git a/src/shapes/Line.ts b/src/shapes/Line.ts index df80694c..fb3340d1 100644 --- a/src/shapes/Line.ts +++ b/src/shapes/Line.ts @@ -51,7 +51,7 @@ function expandPoints(p, tension) { } export interface LineConfig extends ShapeConfig { - points?: number[]; + points?: number[] | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray; tension?: number; closed?: boolean; bezier?: boolean;