UNPKG

@nativescript-community/ui-htmlcanvasapi

Version:

An HTML Canvas API implementation on top of android and iOS native APIs

142 lines 2.94 kB
const matrixDefaults = [1, 0, 0, 0, 1, 0, 0, 0, 1]; class NSDOMMatrix { constructor(init) { /** * Not supported */ this.m13 = 0; this.m14 = 0; this.m23 = 0; this.m24 = 0; this.m31 = 0; this.m32 = 0; this.m33 = 1; this.m34 = 0; this.m43 = 0; this.m44 = 1; this._values = new Float32Array(matrixDefaults.length); this._reset(); if (init) { this.a = init[0]; this.b = init[1]; this.c = init[2]; this.d = init[3]; this.e = init[4]; this.f = init[5]; } } _getValues() { return this._values; } _reset() { for (let i = 0, length = matrixDefaults.length; i < length; i++) { this._values[i] = matrixDefaults[i]; } } get is2D() { return true; } get isIdentity() { return this.a === 1 && this.b === 0 && this.c === 0 && this.d === 1 && this.e === 0 && this.f === 0; } get a() { return this._values[0]; } set a(val) { this._values[0] = val; } get m11() { return this.a; } set m11(val) { this.a = val; } get b() { return this._values[3]; } set b(val) { this._values[3] = val; } get m12() { return this.b; } set m12(val) { this.b = val; } get c() { return this._values[1]; } set c(val) { this._values[1] = val; } get m21() { return this.c; } set m21(val) { this.c = val; } get d() { return this._values[4]; } set d(val) { this._values[4] = val; } get m22() { return this.d; } set m22(val) { this.d = val; } get e() { return this._values[2]; } set e(val) { this._values[2] = val; } get m41() { return this.e; } set m41(val) { this.e = val; } get f() { return this._values[5]; } set f(val) { this._values[5] = val; } get m42() { return this.f; } set m42(val) { this.f = val; } toJSON() { return { a: this.a, b: this.b, c: this.c, d: this.d, e: this.e, f: this.f, m11: this.m11, m12: this.m12, m13: this.m13, m14: this.m14, m21: this.m21, m22: this.m22, m23: this.m23, m24: this.m24, m31: this.m31, m32: this.m32, m33: this.m33, m34: this.m34, m41: this.m41, m42: this.m42, m43: this.m43, m44: this.m44, }; } } export { NSDOMMatrix as DOMMatrix }; //# sourceMappingURL=DOMMatrix.js.map