-
Notifications
You must be signed in to change notification settings - Fork 113
Description
when text on the path is centered it is using this part of the code:
/* Center text according to the path's bounding box */ if (options.center) { var textLength = textNode.getComputedTextLength(); var pathLength = this._path.getTotalLength(); /* Set the position for the left side of the textNode */ textNode.setAttribute('dx', ((pathLength / 2) - (textLength / 2))); }
the getComputedTextLength() & getTotalLength() cause reflows in the browser and are very slow when a lot of text is added. I've tried replacing this and came up with adding these attributes to the path-element and remove the above code:
textPath.setAttribute('text-anchor', 'middle'); textPath.setAttribute('startOffset', '50%');
Maybe someone could check and (when it's ok) add it to the code.