aboutsummaryrefslogtreecommitdiffstats
path: root/src/elements/Text.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/elements/Text.js')
-rw-r--r--src/elements/Text.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/elements/Text.js b/src/elements/Text.js
index 0c5815d..c703e3b 100644
--- a/src/elements/Text.js
+++ b/src/elements/Text.js
@@ -10,14 +10,14 @@ import SVGNumber from '../types/SVGNumber.js'
import Shape from './Shape.js'
import { globals } from '../utils/window.js'
import * as textable from '../modules/core/textable.js'
-import { isDescriptive } from '../utils/utils.js'
+import { isDescriptive, writeDataToDom } from '../utils/utils.js'
export default class Text extends Shape {
// Initialize node
constructor(node, attrs = node) {
super(nodeOrNew('text', node), attrs)
- this.dom.leading = new SVGNumber(1.3) // store leading value for rebuilding
+ this.dom.leading = this.dom.leading ?? new SVGNumber(1.3) // store leading value for rebuilding
this._rebuild = true // enable automatic updating of dy values
this._build = false // disable build mode for adding multiple lines
}
@@ -82,6 +82,11 @@ export default class Text extends Shape {
return this
}
+ writeDataToDom() {
+ writeDataToDom(this, this.dom, { leading: 1.3 })
+ return this
+ }
+
// Set the text content
text(text) {
// act as getter