Add better ticks in v6

This commit is contained in:
Wuzzy 2023-10-27 18:47:31 +02:00
parent 6d58284119
commit e575801481

View File

@ -594,8 +594,14 @@ function putAxes(context) {
context.lineWidth = 2; context.lineWidth = 2;
context.strokeStyle = AXIS_COLOR; context.strokeStyle = AXIS_COLOR;
let [x0, y0] = biomeCoordsToCanvasPixelCoords(0, 0); let [x0, y0] = biomeCoordsToCanvasPixelCoords(0, 0);
let tick_heat = (limit_heat_max - limit_heat_min) * (100/175); let tick_heat, tick_humidity;
let tick_humidity = (limit_humidity_max - limit_humidity_min) * (100/175); 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 [tx, ty] = biomeCoordsToCanvasPixelCoords(tick_heat, tick_humidity);
let w = voronoiCanvas.width; let w = voronoiCanvas.width;
let h = voronoiCanvas.height; let h = voronoiCanvas.height;
@ -686,7 +692,13 @@ function putAxes(context) {
context.fillText("heat", lx, ly); context.fillText("heat", lx, ly);
context.textAlign = "center"; 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 // humidity label
context.font = "100% sans-serif"; context.font = "100% sans-serif";
@ -713,7 +725,13 @@ function putAxes(context) {
ttx = x0 - AXIS_ARROW_SIZE-2; ttx = x0 - AXIS_ARROW_SIZE-2;
} }
context.textBaseline = "middle"; 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 // Cache diagram object for performance boost