diff --git a/libpov.js b/libpov.js index a1cb7e1..add89c9 100644 --- a/libpov.js +++ b/libpov.js @@ -427,17 +427,17 @@ function putPointName(context, point) { if (he < limit_heat_min || he > limit_heat_max || hu < limit_humidity_min || hu > limit_humidity_max) { return; } + let heat_range = limit_heat_max - limit_heat_min; + let humidity_range = limit_humidity_max - limit_humidity_min; let [x, y] = biomeCoordsToCanvasPixelCoords(he, hu); - let w = voronoiCanvas.width; - let h = voronoiCanvas.height; - if (x > w/2) { + if (he > (limit_heat_min + heat_range/2)) { context.textAlign = "right"; x = x-5; } else { context.textAlign = "left"; x = x+5; } - if (y < h/2) { + if (hu > (limit_humidity_min + humidity_range/2)) { context.textBaseline = "top"; } else { context.textBaseline = "alphabetic";