fib label
This commit is contained in:
parent
ac2943f248
commit
b932fa2d75
1 changed files with 8 additions and 0 deletions
|
|
@ -157,6 +157,7 @@ class FibLevelsPrimitive {
|
||||||
for (const item of this._items) {
|
for (const item of this._items) {
|
||||||
if (item.kind === 'rail') {
|
if (item.kind === 'rail') {
|
||||||
ctx.strokeStyle = item.color;
|
ctx.strokeStyle = item.color;
|
||||||
|
ctx.fillStyle = item.color;
|
||||||
ctx.lineWidth = item.width;
|
ctx.lineWidth = item.width;
|
||||||
ctx.setLineDash([]);
|
ctx.setLineDash([]);
|
||||||
ctx.globalAlpha = 0.85;
|
ctx.globalAlpha = 0.85;
|
||||||
|
|
@ -164,6 +165,13 @@ class FibLevelsPrimitive {
|
||||||
ctx.moveTo(item.x + 0.5, item.y0);
|
ctx.moveTo(item.x + 0.5, item.y0);
|
||||||
ctx.lineTo(item.x + 0.5, item.y1);
|
ctx.lineTo(item.x + 0.5, item.y1);
|
||||||
ctx.stroke();
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
const start = item.x0 == null ? 0 : Math.max(0, item.x0);
|
const start = item.x0 == null ? 0 : Math.max(0, item.x0);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue