commit 1644fda532cd6fddce69acc33fe525ea3a0fe5af
parent e425ae1370bf8f722559b659da61d5429418e7d3
Author: Milan Pässler <milan@petabyte.dev>
Date: Fri, 11 Sep 2020 15:13:47 +0200
parent e425ae1370bf8f722559b659da61d5429418e7d3
Author: Milan Pässler <milan@petabyte.dev>
Date: Fri, 11 Sep 2020 15:13:47 +0200
canvas: fix rendering of RJ labels
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/js/canvas.js b/client/js/canvas.js @@ -89,7 +89,7 @@ const addTextToCache = (text, color, fixedHeight) => { } canvas.width = width * dpr; - canvas.height = (Math.ceil(height) + 1) * dpr; + canvas.height = Math.ceil(height * 1.5) * dpr; ctx.scale(dpr, dpr); ctx.font = `${height}px sans-serif`; @@ -212,7 +212,7 @@ const renderJourneys = () => { let preRenderedText = textCache[textFor(leg)]; if ((preRenderedText.height / dpr) < duration - 5) { 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); }