canvas: fix rendering of RJ labels
This commit is contained in:
parent
e425ae1370
commit
1644fda532
|
@ -89,7 +89,7 @@ const addTextToCache = (text, color, fixedHeight) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.width = width * dpr;
|
canvas.width = width * dpr;
|
||||||
canvas.height = (Math.ceil(height) + 1) * dpr;
|
canvas.height = Math.ceil(height * 1.5) * dpr;
|
||||||
ctx.scale(dpr, dpr);
|
ctx.scale(dpr, dpr);
|
||||||
|
|
||||||
ctx.font = `${height}px sans-serif`;
|
ctx.font = `${height}px sans-serif`;
|
||||||
|
@ -212,7 +212,7 @@ const renderJourneys = () => {
|
||||||
let preRenderedText = textCache[textFor(leg)];
|
let preRenderedText = textCache[textFor(leg)];
|
||||||
if ((preRenderedText.height / dpr) < duration - 5) {
|
if ((preRenderedText.height / dpr) < duration - 5) {
|
||||||
ctx.scale(1 / dpr, 1 / dpr);
|
ctx.scale(1 / dpr, 1 / dpr);
|
||||||
ctx.drawImage(preRenderedText, dpr * (x + 5), Math.floor(dpr * (y + duration / 2) - preRenderedText.height / 1.5));
|
ctx.drawImage(preRenderedText, dpr * (x + 5), Math.floor(dpr * (y + duration / 2) - preRenderedText.height / 2.3));
|
||||||
ctx.scale(dpr, dpr);
|
ctx.scale(dpr, dpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue