mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
Merge pull request #1384 from Reggino/allow-typed-points-array
Allow line points to be of type TypedArray.
This commit is contained in:
commit
baf8780b26
@ -142,6 +142,12 @@ export function getFunctionValidator() {
|
||||
export function getNumberArrayValidator() {
|
||||
if (Konva.isUnminified) {
|
||||
return function (val: any, attr: string) {
|
||||
// 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)) {
|
||||
Util.warn(
|
||||
_formatValue(val) +
|
||||
|
@ -51,7 +51,7 @@ function expandPoints(p, tension) {
|
||||
}
|
||||
|
||||
export interface LineConfig extends ShapeConfig {
|
||||
points?: number[];
|
||||
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