UNPKG

image-in-browser

Version:

Package for encoding / decoding images, transforming images, applying filters, drawing primitives on images on the client side (no need for server Node.js)

40 lines 873 B
export class Point { get x() { return this._x; } get y() { return this._y; } get xt() { return Math.trunc(this.x); } get yt() { return Math.trunc(this.y); } constructor(x, y) { this._x = x; this._y = y; } static from(other) { return new Point(other._x, other._y); } move(x, y) { return new Point(x, y); } offset(dx, dy) { return this.move(this._x + dx, this._y + dy); } mul(n) { return this.move(this._x * n, this._y * n); } add(p) { return this.move(this._x + p._x, this._y + p._y); } equals(other) { return this._x === other._x && this._y === other._y; } toString() { return `${this.constructor.name} (x: ${this._x}, y: ${this._y})`; } } //# sourceMappingURL=point.js.map