aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2024-06-18 11:01:45 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2024-06-18 11:01:45 +0200
commita1c23d3838f6551f01894be40c8894398467c541 (patch)
treedeb1ff485284dd0040dc50aec4f8df2c129bc22c /src
parent3b47e461f0773e619619f1bc838234fdd9920d90 (diff)
downloadsvg.js-a1c23d3838f6551f01894be40c8894398467c541.tar.gz
svg.js-a1c23d3838f6551f01894be40c8894398467c541.zip
update dependencies
Diffstat (limited to 'src')
-rw-r--r--src/animation/Morphable.js19
-rw-r--r--src/animation/Runner.js8
-rw-r--r--src/modules/core/attr.js4
-rw-r--r--src/modules/optional/data.js4
-rw-r--r--src/modules/optional/sugar.js18
-rw-r--r--src/types/Box.js22
-rw-r--r--src/types/Color.js56
-rw-r--r--src/types/Matrix.js56
-rw-r--r--src/types/Point.js4
-rw-r--r--src/types/SVGNumber.js12
-rw-r--r--src/utils/utils.js12
11 files changed, 108 insertions, 107 deletions
diff --git a/src/animation/Morphable.js b/src/animation/Morphable.js
index 240ca7b..9ce05d6 100644
--- a/src/animation/Morphable.js
+++ b/src/animation/Morphable.js
@@ -58,11 +58,12 @@ export default class Morphable {
}
done() {
- const complete = this._context
- .map(this._stepper.done)
- .reduce(function (last, curr) {
- return last && curr
- }, true)
+ const complete = this._context.map(this._stepper.done).reduce(function (
+ last,
+ curr
+ ) {
+ return last && curr
+ }, true)
return complete
}
@@ -111,16 +112,16 @@ export default class Morphable {
result = this._to
? result[this._to[4]]()
: this._from
- ? result[this._from[4]]()
- : result
+ ? result[this._from[4]]()
+ : result
}
if (this._type === ObjectBag) {
result = this._to
? result.align(this._to)
: this._from
- ? result.align(this._from)
- : result
+ ? result.align(this._from)
+ : result
}
result = result.toConsumable()
diff --git a/src/animation/Runner.js b/src/animation/Runner.js
index 8fd4b8b..be74c7a 100644
--- a/src/animation/Runner.js
+++ b/src/animation/Runner.js
@@ -251,8 +251,8 @@ export default class Runner extends EventTarget {
x <= 0
? Math.round(f(1e-5))
: x < endTime
- ? f(x)
- : Math.round(f(endTime - 1e-5))
+ ? f(x)
+ : Math.round(f(endTime - 1e-5))
return position
}
@@ -790,8 +790,8 @@ extend(Runner, {
transforms.affine != null
? transforms.affine
: affine != null
- ? affine
- : !isMatrix
+ ? affine
+ : !isMatrix
// Create a morpher and set its type
const morpher = new Morphable(this._stepper).type(
diff --git a/src/modules/core/attr.js b/src/modules/core/attr.js
index 36b331b..8875c41 100644
--- a/src/modules/core/attr.js
+++ b/src/modules/core/attr.js
@@ -52,8 +52,8 @@ export default function attr(attr, val, ns) {
return val == null
? defaults[attr]
: isNumber.test(val)
- ? parseFloat(val)
- : val
+ ? parseFloat(val)
+ : val
} else {
// Loop through hooks and execute them to convert value
val = hooks.reduce((_val, hook) => {
diff --git a/src/modules/optional/data.js b/src/modules/optional/data.js
index 9655048..a9d7ac7 100644
--- a/src/modules/optional/data.js
+++ b/src/modules/optional/data.js
@@ -36,8 +36,8 @@ export function data(a, v, r) {
v === null
? null
: r === true || typeof v === 'string' || typeof v === 'number'
- ? v
- : JSON.stringify(v)
+ ? v
+ : JSON.stringify(v)
)
}
diff --git a/src/modules/optional/sugar.js b/src/modules/optional/sugar.js
index 7ce3bd4..2ee8c96 100644
--- a/src/modules/optional/sugar.js
+++ b/src/modules/optional/sugar.js
@@ -147,15 +147,15 @@ registerMethods(['Element', 'Runner'], {
return a === 'leading'
? this.leading(v)
: a === 'anchor'
- ? this.attr('text-anchor', v)
- : a === 'size' ||
- a === 'family' ||
- a === 'weight' ||
- a === 'stretch' ||
- a === 'variant' ||
- a === 'style'
- ? this.attr('font-' + a, v)
- : this.attr(a, v)
+ ? this.attr('text-anchor', v)
+ : a === 'size' ||
+ a === 'family' ||
+ a === 'weight' ||
+ a === 'stretch' ||
+ a === 'variant' ||
+ a === 'style'
+ ? this.attr('font-' + a, v)
+ : this.attr(a, v)
}
})
diff --git a/src/types/Box.js b/src/types/Box.js
index cd441ac..4e90acf 100644
--- a/src/types/Box.js
+++ b/src/types/Box.js
@@ -44,17 +44,17 @@ export default class Box {
typeof source === 'string'
? source.split(delimiter).map(parseFloat)
: Array.isArray(source)
- ? source
- : typeof source === 'object'
- ? [
- source.left != null ? source.left : source.x,
- source.top != null ? source.top : source.y,
- source.width,
- source.height
- ]
- : arguments.length === 4
- ? [].slice.call(arguments)
- : base
+ ? source
+ : typeof source === 'object'
+ ? [
+ source.left != null ? source.left : source.x,
+ source.top != null ? source.top : source.y,
+ source.width,
+ source.height
+ ]
+ : arguments.length === 4
+ ? [].slice.call(arguments)
+ : base
this.x = source[0] || 0
this.y = source[1] || 0
diff --git a/src/types/Color.js b/src/types/Color.js
index 79fa24e..2f61b5a 100644
--- a/src/types/Color.js
+++ b/src/types/Color.js
@@ -34,16 +34,16 @@ function getParameters(a, b) {
const params = is(a, 'rgb')
? { _a: a.r, _b: a.g, _c: a.b, _d: 0, space: 'rgb' }
: is(a, 'xyz')
- ? { _a: a.x, _b: a.y, _c: a.z, _d: 0, space: 'xyz' }
- : is(a, 'hsl')
- ? { _a: a.h, _b: a.s, _c: a.l, _d: 0, space: 'hsl' }
- : is(a, 'lab')
- ? { _a: a.l, _b: a.a, _c: a.b, _d: 0, space: 'lab' }
- : is(a, 'lch')
- ? { _a: a.l, _b: a.c, _c: a.h, _d: 0, space: 'lch' }
- : is(a, 'cmyk')
- ? { _a: a.c, _b: a.m, _c: a.y, _d: a.k, space: 'cmyk' }
- : { _a: 0, _b: 0, _c: 0, space: 'rgb' }
+ ? { _a: a.x, _b: a.y, _c: a.z, _d: 0, space: 'xyz' }
+ : is(a, 'hsl')
+ ? { _a: a.h, _b: a.s, _c: a.l, _d: 0, space: 'hsl' }
+ : is(a, 'lab')
+ ? { _a: a.l, _b: a.a, _c: a.b, _d: 0, space: 'lab' }
+ : is(a, 'lch')
+ ? { _a: a.l, _b: a.c, _c: a.h, _d: 0, space: 'lch' }
+ : is(a, 'cmyk')
+ ? { _a: a.c, _b: a.m, _c: a.y, _d: a.k, space: 'cmyk' }
+ : { _a: 0, _b: 0, _c: 0, space: 'rgb' }
params.space = b || params.space
return params
@@ -187,17 +187,17 @@ export default class Color {
const s = isGrey
? 0
: l > 0.5
- ? delta / (2 - max - min)
- : delta / (max + min)
+ ? delta / (2 - max - min)
+ : delta / (max + min)
const h = isGrey
? 0
: max === r
- ? ((g - b) / delta + (g < b ? 6 : 0)) / 6
- : max === g
- ? ((b - r) / delta + 2) / 6
- : max === b
- ? ((r - g) / delta + 4) / 6
- : 0
+ ? ((g - b) / delta + (g < b ? 6 : 0)) / 6
+ : max === g
+ ? ((b - r) / delta + 2) / 6
+ : max === b
+ ? ((r - g) / delta + 4) / 6
+ : 0
// Construct and return the new color
const color = new Color(360 * h, 100 * s, 100 * l, 'hsl')
@@ -251,16 +251,16 @@ export default class Color {
this.space === 'rgb'
? { r: _a, g: _b, b: _c }
: this.space === 'xyz'
- ? { x: _a, y: _b, z: _c }
- : this.space === 'hsl'
- ? { h: _a, s: _b, l: _c }
- : this.space === 'lab'
- ? { l: _a, a: _b, b: _c }
- : this.space === 'lch'
- ? { l: _a, c: _b, h: _c }
- : this.space === 'cmyk'
- ? { c: _a, m: _b, y: _c, k: _d }
- : {}
+ ? { x: _a, y: _b, z: _c }
+ : this.space === 'hsl'
+ ? { h: _a, s: _b, l: _c }
+ : this.space === 'lab'
+ ? { l: _a, a: _b, b: _c }
+ : this.space === 'lch'
+ ? { l: _a, c: _b, h: _c }
+ : this.space === 'cmyk'
+ ? { c: _a, m: _b, y: _c, k: _d }
+ : {}
Object.assign(this, components)
}
diff --git a/src/types/Matrix.js b/src/types/Matrix.js
index f409a50..803ec37 100644
--- a/src/types/Matrix.js
+++ b/src/types/Matrix.js
@@ -22,34 +22,34 @@ export default class Matrix {
o.skew && o.skew.length
? o.skew[0]
: isFinite(o.skew)
- ? o.skew
- : isFinite(o.skewX)
- ? o.skewX
- : 0
+ ? o.skew
+ : isFinite(o.skewX)
+ ? o.skewX
+ : 0
const skewY =
o.skew && o.skew.length
? o.skew[1]
: isFinite(o.skew)
- ? o.skew
- : isFinite(o.skewY)
- ? o.skewY
- : 0
+ ? o.skew
+ : isFinite(o.skewY)
+ ? o.skewY
+ : 0
const scaleX =
o.scale && o.scale.length
? o.scale[0] * flipX
: isFinite(o.scale)
- ? o.scale * flipX
- : isFinite(o.scaleX)
- ? o.scaleX * flipX
- : flipX
+ ? o.scale * flipX
+ : isFinite(o.scaleX)
+ ? o.scaleX * flipX
+ : flipX
const scaleY =
o.scale && o.scale.length
? o.scale[1] * flipY
: isFinite(o.scale)
- ? o.scale * flipY
- : isFinite(o.scaleY)
- ? o.scaleY * flipY
- : flipY
+ ? o.scale * flipY
+ : isFinite(o.scaleY)
+ ? o.scaleY * flipY
+ : flipY
const shear = o.shear || 0
const theta = o.rotate || o.theta || 0
const origin = new Point(
@@ -225,8 +225,8 @@ export default class Matrix {
return axis === 'x'
? this.scaleO(-1, 1, around, 0)
: axis === 'y'
- ? this.scaleO(1, -1, 0, around)
- : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point
+ ? this.scaleO(1, -1, 0, around)
+ : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point
}
// Initialize
@@ -238,16 +238,16 @@ export default class Matrix {
source instanceof Element
? source.matrixify()
: typeof source === 'string'
- ? Matrix.fromArray(source.split(delimiter).map(parseFloat))
- : Array.isArray(source)
- ? Matrix.fromArray(source)
- : typeof source === 'object' && Matrix.isMatrixLike(source)
- ? source
- : typeof source === 'object'
- ? new Matrix().transform(source)
- : arguments.length === 6
- ? Matrix.fromArray([].slice.call(arguments))
- : base
+ ? Matrix.fromArray(source.split(delimiter).map(parseFloat))
+ : Array.isArray(source)
+ ? Matrix.fromArray(source)
+ : typeof source === 'object' && Matrix.isMatrixLike(source)
+ ? source
+ : typeof source === 'object'
+ ? new Matrix().transform(source)
+ : arguments.length === 6
+ ? Matrix.fromArray([].slice.call(arguments))
+ : base
// Merge the source matrix with the base matrix
this.a = source.a != null ? source.a : base.a
diff --git a/src/types/Point.js b/src/types/Point.js
index 5d44733..cfd204e 100644
--- a/src/types/Point.js
+++ b/src/types/Point.js
@@ -18,8 +18,8 @@ export default class Point {
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
diff --git a/src/types/SVGNumber.js b/src/types/SVGNumber.js
index 5945341..2770f67 100644
--- a/src/types/SVGNumber.js
+++ b/src/types/SVGNumber.js
@@ -31,10 +31,10 @@ export default class SVGNumber {
this.value = isNaN(value)
? 0
: !isFinite(value)
- ? value < 0
- ? -3.4e38
- : +3.4e38
- : value
+ ? value < 0
+ ? -3.4e38
+ : +3.4e38
+ : value
} else if (typeof value === 'string') {
unit = value.match(numberAndUnit)
@@ -93,8 +93,8 @@ export default class SVGNumber {
(this.unit === '%'
? ~~(this.value * 1e8) / 1e6
: this.unit === 's'
- ? this.value / 1e3
- : this.value) + this.unit
+ ? this.value / 1e3
+ : this.value) + this.unit
)
}
diff --git a/src/utils/utils.js b/src/utils/utils.js
index edd98b6..ab0fda0 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -82,8 +82,8 @@ export function getOrigin(o, element) {
;[ox, oy] = Array.isArray(origin)
? origin
: typeof origin === 'object'
- ? [origin.x, origin.y]
- : [origin, origin]
+ ? [origin.x, origin.y]
+ : [origin, origin]
}
// Make sure to only call bbox when actually needed
@@ -97,16 +97,16 @@ export function getOrigin(o, element) {
ox = ox.includes('left')
? x
: ox.includes('right')
- ? x + width
- : x + width / 2
+ ? x + width
+ : x + width / 2
}
if (condY) {
oy = oy.includes('top')
? y
: oy.includes('bottom')
- ? y + height
- : y + height / 2
+ ? y + height
+ : y + height / 2
}
}