summaryrefslogtreecommitdiffstats
path: root/src/elements
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2023-09-02 21:23:53 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2023-09-02 21:23:53 +0200
commit8fa0873a632f828ed1ad85aa30dee97bc585d32f (patch)
treeadf24490470a8863ca86dafb7d127c4e63148837 /src/elements
parentb30f0d691dfec74bc855e5550970d0fb35931881 (diff)
downloadsvg.js-8fa0873a632f828ed1ad85aa30dee97bc585d32f.tar.gz
svg.js-8fa0873a632f828ed1ad85aa30dee97bc585d32f.zip
skip descriptive elements on rebuild and toParent
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/Text.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/elements/Text.js b/src/elements/Text.js
index 39371f6..0c5815d 100644
--- a/src/elements/Text.js
+++ b/src/elements/Text.js
@@ -10,6 +10,7 @@ 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'
export default class Text extends Shape {
// Initialize node
@@ -48,6 +49,8 @@ export default class Text extends Shape {
const leading = this.dom.leading
this.each(function (i) {
+ if (isDescriptive(this.node)) return
+
const fontSize = globals.window
.getComputedStyle(this.node)
.getPropertyValue('font-size')
@@ -89,8 +92,8 @@ export default class Text extends Shape {
for (let i = 0, len = children.length; i < len; ++i) {
// skip textPaths - they are no lines
- if (children[i].nodeName === 'textPath') {
- if (i === 0) firstLine = 1
+ if (children[i].nodeName === 'textPath' || isDescriptive(children[i])) {
+ if (i === 0) firstLine = i + 1
continue
}