From 03322672782a6318b019eff33fe44ec800d6f12c Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Tue, 13 Jun 2023 01:43:37 +0200 Subject: dependency updates, easier formatting --- src/types/Point.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/types/Point.js') diff --git a/src/types/Point.js b/src/types/Point.js index 76fd985..5d44733 100644 --- a/src/types/Point.js +++ b/src/types/Point.js @@ -2,24 +2,24 @@ import Matrix from './Matrix.js' export default class Point { // Initialize - constructor (...args) { + constructor(...args) { this.init(...args) } // Clone point - clone () { + clone() { return new Point(this) } - init (x, y) { + init(x, y) { const base = { x: 0, y: 0 } // ensure source as object const source = Array.isArray(x) ? { x: x[0], y: x[1] } : typeof x === 'object' - ? { x: x.x, y: x.y } - : { x: x, y: y } + ? { x: x.x, y: x.y } + : { x: x, y: y } // merge source this.x = source.x == null ? base.x : source.x @@ -28,16 +28,16 @@ export default class Point { return this } - toArray () { - return [ this.x, this.y ] + toArray() { + return [this.x, this.y] } - transform (m) { + transform(m) { return this.clone().transformO(m) } // Transform point with matrix - transformO (m) { + transformO(m) { if (!Matrix.isMatrixLike(m)) { m = new Matrix(m) } @@ -50,9 +50,8 @@ export default class Point { return this } - } -export function point (x, y) { +export function point(x, y) { return new Point(x, y).transformO(this.screenCTM().inverseO()) } -- cgit v1.2.3