addMarkerText method
Adds a text to the polyline in the polyline's color
from attrPyA.MARKER_TEXT, if present, at the screen position
xs, ys
. If te text is appended tight of the polyline it requires that
the user extended polyAttrPyA.INSETX by the length of the text in pixels.
Implementation
void addMarkerText(int xs, int ys) {
if (polylineMarker != null) polylineMarker.remove();
if (attr[PyA.MARKER_TEXT] == null || attr[PyA.MARKER_TEXT].isEmpty) return;
polylineMarker = new TextElement();
polylineMarker.text = attr[PyA.MARKER_TEXT];
int fontsize = int.parse(attr[PyA.MARKER_FONTSIZE]);
SVG.setAttr(polylineMarker, {
"x": "${xs + 8}",
"y": "${ys + fontsize ~/ 4}",
SVG.FONT_SIZE: "${fontsize}",
SVG.FILL: attr[PyA.STROKE],
SVG.STROKE: "none",
});
polylineContainer.append(polylineMarker);
}