Fix flickering of point texts on resize
This commit is contained in:
parent
217caf532b
commit
e6ed706163
@ -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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user