diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2023-06-13 01:43:37 +0200 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2023-06-13 01:43:37 +0200 |
commit | 03322672782a6318b019eff33fe44ec800d6f12c (patch) | |
tree | 9d807e1585cf28a1ea98e87b855932dba00f1880 /src/modules/core/containerGeometry.js | |
parent | 8e18b4698edd00f83af0be05bb3374f92fecaeb9 (diff) | |
download | svg.js-03322672782a6318b019eff33fe44ec800d6f12c.tar.gz svg.js-03322672782a6318b019eff33fe44ec800d6f12c.zip |
dependency updates, easier formatting
Diffstat (limited to 'src/modules/core/containerGeometry.js')
-rw-r--r-- | src/modules/core/containerGeometry.js | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/modules/core/containerGeometry.js b/src/modules/core/containerGeometry.js index 908bb27..21139e8 100644 --- a/src/modules/core/containerGeometry.js +++ b/src/modules/core/containerGeometry.js @@ -2,9 +2,8 @@ import Matrix from '../../types/Matrix.js' import Point from '../../types/Point.js' import { proportionalSize } from '../../utils/utils.js' -export function dmove (dx, dy) { - this.children().forEach((child, i) => { - +export function dmove(dx, dy) { + this.children().forEach((child) => { let bbox // We have to wrap this for elements that dont have a bbox @@ -30,32 +29,32 @@ export function dmove (dx, dy) { return this } -export function dx (dx) { +export function dx(dx) { return this.dmove(dx, 0) } -export function dy (dy) { +export function dy(dy) { return this.dmove(0, dy) } -export function height (height, box = this.bbox()) { +export function height(height, box = this.bbox()) { if (height == null) return box.height return this.size(box.width, height, box) } -export function move (x = 0, y = 0, box = this.bbox()) { +export function move(x = 0, y = 0, box = this.bbox()) { const dx = x - box.x const dy = y - box.y return this.dmove(dx, dy) } -export function size (width, height, box = this.bbox()) { +export function size(width, height, box = this.bbox()) { const p = proportionalSize(this, width, height, box) const scaleX = p.width / box.width const scaleY = p.height / box.height - this.children().forEach((child, i) => { + this.children().forEach((child) => { const o = new Point(box).transform(new Matrix(child).inverse()) child.scale(scaleX, scaleY, o.x, o.y) }) @@ -63,17 +62,17 @@ export function size (width, height, box = this.bbox()) { return this } -export function width (width, box = this.bbox()) { +export function width(width, box = this.bbox()) { if (width == null) return box.width return this.size(width, box.height, box) } -export function x (x, box = this.bbox()) { +export function x(x, box = this.bbox()) { if (x == null) return box.x return this.move(x, box.y, box) } -export function y (y, box = this.bbox()) { +export function y(y, box = this.bbox()) { if (y == null) return box.y return this.move(box.x, y, box) } |