From e5758014816b5f14daa57b04e99ad0a0422fb4f2 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 27 Oct 2023 18:47:31 +0200 Subject: [PATCH] Add better ticks in v6 --- mibpov.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/mibpov.js b/mibpov.js index e3c5587..09055ff 100644 --- a/mibpov.js +++ b/mibpov.js @@ -594,8 +594,14 @@ function putAxes(context) { context.lineWidth = 2; context.strokeStyle = AXIS_COLOR; let [x0, y0] = biomeCoordsToCanvasPixelCoords(0, 0); - let tick_heat = (limit_heat_max - limit_heat_min) * (100/175); - let tick_humidity = (limit_humidity_max - limit_humidity_min) * (100/175); + let tick_heat, tick_humidity; + if (biomeMode === "v6") { + tick_heat = 1.0; + tick_humidity = 0.5; + } else { + tick_heat = (limit_heat_max - limit_heat_min) * (100/175); + tick_humidity = (limit_humidity_max - limit_humidity_min) * (100/175); + } let [tx, ty] = biomeCoordsToCanvasPixelCoords(tick_heat, tick_humidity); let w = voronoiCanvas.width; let h = voronoiCanvas.height; @@ -686,7 +692,13 @@ function putAxes(context) { context.fillText("heat", lx, ly); context.textAlign = "center"; - context.fillText(Math.round(tick_heat), tx, tty); + let str_tick_heat; + if (biomeMode === "v6") { + str_tick_heat = tick_heat.toFixed(1); + } else { + str_tick_heat = tick_heat.toFixed(0); + } + context.fillText(str_tick_heat, tx, tty); // humidity label context.font = "100% sans-serif"; @@ -713,7 +725,13 @@ function putAxes(context) { ttx = x0 - AXIS_ARROW_SIZE-2; } context.textBaseline = "middle"; - context.fillText(Math.round(tick_humidity), ttx, ty); + let str_tick_humidity; + if (biomeMode === "v6") { + str_tick_humidity = tick_humidity.toFixed(1); + } else { + str_tick_humidity = tick_humidity.toFixed(0); + } + context.fillText(str_tick_humidity, ttx, ty); } // Cache diagram object for performance boost