Closed Shiuyin closed 10 months ago
If your text elements are not multiline, you can use the following workaround:
textElement.rebuild(false)
This will prevent rebuilding (which seems to be only necessary for multiline support in text elements) and therefore prevent the NP.
I attempted to fix it here: https://github.com/svgdotjs/svg.js/commit/8fa0873a632f828ed1ad85aa30dee97bc585d32f
Please test and report back if it works for you. Sorry for the long wait!
@Fuzzyma Thank you for your work. It works as intended now. When can we get a new build in order to profit from these fixes?
I am sorry, I somehow forgot to publish all the fixes I made. I just released it: https://github.com/svgdotjs/svg.js/releases/tag/3.2.1
If you have a text element with a title element inside, moving that text element will fail with:
Uncaught TypeError: Cannot read properties of undefined (reading 'newLined') at Dom.<anonymous> (Text.js:56:22) at Text.each (Dom.js:84:13) at Text.rebuild (Text.js:50:12) at Text.attr (attr.js:79:12) at Text.ax (textable.js:68:15)
DOM:
<text x="200" y="294">row10<title>row10</title></text>
Reason: .ax() is leading to a rebuild of the text element. Rebuilding the text element will also go through all children. When reaching the title child element, there is no this.dom.