aboutsummaryrefslogtreecommitdiffstats
path: root/src/types/Point.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2023-06-13 01:43:37 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2023-06-13 01:43:37 +0200
commit03322672782a6318b019eff33fe44ec800d6f12c (patch)
tree9d807e1585cf28a1ea98e87b855932dba00f1880 /src/types/Point.js
parent8e18b4698edd00f83af0be05bb3374f92fecaeb9 (diff)
downloadsvg.js-03322672782a6318b019eff33fe44ec800d6f12c.tar.gz
svg.js-03322672782a6318b019eff33fe44ec800d6f12c.zip
dependency updates, easier formatting
Diffstat (limited to 'src/types/Point.js')
-rw-r--r--src/types/Point.js21
1 files changed, 10 insertions, 11 deletions
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())
}