function placeLengthSymbol(start, end, p, value, lengthText, lengthSymbolPath) {
let placeLengthTextLabel = function () {
if (lengthText) {
lengthText.content = "";
}
lengthText = new p.PointText({
point: lengthSymbolPath.segments[3].point.add(
delta.normalize(8).rotate(90).multiply(sign)
),
content: `${Math.trunc(delta.length * 1000) / 1000.0}`,
justification: "center"
});
return lengthText;
};
var delta = end.subtract(start);
var upDownSegLen = 5;
if (lengthSymbolPath) lengthSymbolPath.clear();
lengthSymbolPath = new p.Path();
var sign = delta.y > 0 ? 1 : -1;
var upSegment = delta.normalize(upDownSegLen).rotate(45 * sign);
var downSegment = upSegment.rotate(-90 * sign);
var lengthSegment = delta
.divide(2)
.subtract(delta.normalize((2 * upDownSegLen) / Math.sqrt(2)));
var startPoint = start.add(delta.normalize(8).rotate(90).multiply(sign));
lengthSymbolPath.add(startPoint);
lengthSymbolPath.lineBy(upSegment);
lengthSymbolPath.lineBy(lengthSegment);
lengthSymbolPath.lineBy(upSegment);
lengthSymbolPath.lineBy(downSegment);
lengthSymbolPath.lineBy(lengthSegment);
lengthSymbolPath.lineBy(downSegment);
lengthSymbolPath.dashArray = [1, 1];
lengthSymbolPath.strokeColor = "black";
if (value.drawLengthLabel) lengthText = placeLengthTextLabel();
return [lengthText, lengthSymbolPath];
}