fib label

This commit is contained in:
Chris Amow 2026-08-19 09:43:08 +00:00
parent ac2943f248
commit b932fa2d75

View file

@ -157,6 +157,7 @@ class FibLevelsPrimitive {
for (const item of this._items) {
if (item.kind === 'rail') {
ctx.strokeStyle = item.color;
ctx.fillStyle = item.color;
ctx.lineWidth = item.width;
ctx.setLineDash([]);
ctx.globalAlpha = 0.85;
@ -164,6 +165,13 @@ class FibLevelsPrimitive {
ctx.moveTo(item.x + 0.5, item.y0);
ctx.lineTo(item.x + 0.5, item.y1);
ctx.stroke();
ctx.save();
ctx.translate(item.x, (item.y0 + item.y1) / 2);
ctx.rotate(-Math.PI / 2);
ctx.textAlign = 'center';
ctx.textBaseline = item.x > 14 ? 'bottom' : 'top';
ctx.fillText('fibonacci', 0, item.x > 14 ? -2 : 2);
ctx.restore();
continue;
}
const start = item.x0 == null ? 0 : Math.max(0, item.x0);