Round coords when adding point

This commit is contained in:
Wuzzy 2023-10-27 18:41:03 +02:00
parent 1079a13836
commit 6d58284119

View File

@ -1452,8 +1452,8 @@ function updatePointWhenDragged(pointID) {
if (points[i].id === dragDropPointID) {
selectedPoint = points[i];
let [newHeat, newHumidity] = canvasPixelCoordsToBiomeCoords(event.offsetX, event.offsetY);
selectedPoint.heat = newHeat;
selectedPoint.humidity = newHumidity;
selectedPoint.heat = Math.round(newHeat);
selectedPoint.humidity = Math.round(newHumidity);
draw(true);
updateWidgetStates();
let [elemID, elem] = getSelectedBiomeIDAndElement();
@ -1763,6 +1763,8 @@ voronoiCanvas.ondblclick = function(event) {
return;
}
let [he, hu] = canvasPixelCoordsToBiomeCoords(event.offsetX, event.offsetY);
he = Math.round(he);
hu = Math.round(hu);
addBiome({name: generateBiomeName(lastBiomeID), heat:he, humidity: hu, min_y:MIN_Y_DEFAULT, max_y:MAX_Y_DEFAULT});
}
voronoiCanvas.onmouseup = function(event) {