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/elements/Tspan.js | |
parent | 8e18b4698edd00f83af0be05bb3374f92fecaeb9 (diff) | |
download | svg.js-03322672782a6318b019eff33fe44ec800d6f12c.tar.gz svg.js-03322672782a6318b019eff33fe44ec800d6f12c.zip |
dependency updates, easier formatting
Diffstat (limited to 'src/elements/Tspan.js')
-rw-r--r-- | src/elements/Tspan.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/elements/Tspan.js b/src/elements/Tspan.js index 73cd52d..12b49f8 100644 --- a/src/elements/Tspan.js +++ b/src/elements/Tspan.js @@ -13,23 +13,23 @@ import * as textable from '../modules/core/textable.js' export default class Tspan extends Shape { // Initialize node - constructor (node, attrs = node) { + constructor(node, attrs = node) { super(nodeOrNew('tspan', node), attrs) this._build = false // disable build mode for adding multiple lines } // Shortcut dx - dx (dx) { + dx(dx) { return this.attr('dx', dx) } // Shortcut dy - dy (dy) { + dy(dy) { return this.attr('dy', dy) } // Create new line - newLine () { + newLine() { // mark new line this.dom.newLined = true @@ -43,7 +43,8 @@ export default class Tspan extends Shape { const i = text.index(this) - const fontSize = globals.window.getComputedStyle(this.node) + const fontSize = globals.window + .getComputedStyle(this.node) .getPropertyValue('font-size') const dy = text.dom.leading * new SVGNumber(fontSize) @@ -52,8 +53,9 @@ export default class Tspan extends Shape { } // Set text content - text (text) { - if (text == null) return this.node.textContent + (this.dom.newLined ? '\n' : '') + text(text) { + if (text == null) + return this.node.textContent + (this.dom.newLined ? '\n' : '') if (typeof text === 'function') { this.clear().build(true) @@ -65,7 +67,6 @@ export default class Tspan extends Shape { return this } - } extend(Tspan, textable) |