From 614c8fafef2ee849b03a127c470f4960cf1465e8 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Thu, 29 Jul 2021 18:43:42 -0400 Subject: [PATCH] Restored centering logic. viewBox screws scale up a little and ultimately does not do what I hoped it would. --- numbers/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/numbers/index.js b/numbers/index.js index cae553d..b31bb48 100644 --- a/numbers/index.js +++ b/numbers/index.js @@ -22,7 +22,7 @@ version="1.1">`; let options = { font : 'ems_nixish', scale : 0.005, - weight : 5 + weight : 1 }; async function loadFont (fontPath) { @@ -41,12 +41,12 @@ async function loadFont (fontPath) { } function textPos (str) { + const UNIT = 21000 / W; const len = str.length; const w = len * charW; const h = charH; - const x = (W - w) / 2.0; - const y = 1; - //console.log(w); + const x = ((W - w) / 2.0) * UNIT; + const y = 1 * UNIT; return { x, y }; }