fix: bind HeightmapGenerator methods for correct context in editHeightmap

This commit is contained in:
Marc Emmanuel 2026-01-23 09:21:08 +01:00
parent 4b341a6590
commit a07cd0e755

View file

@ -675,7 +675,7 @@ function editHeightmap(options) {
if (power === 0) return tip("Power should not be zero", false, "error"); if (power === 0) return tip("Power should not be zero", false, "error");
const heights = grid.cells.h; const heights = grid.cells.h;
const operation = power > 0 ? HeightmapGenerator.addRange : HeightmapGenerator.addTrough; const operation = power > 0 ? HeightmapGenerator.addRange.bind(HeightmapGenerator) : HeightmapGenerator.addTrough.bind(HeightmapGenerator);
HeightmapGenerator.setGraph(grid); HeightmapGenerator.setGraph(grid);
operation("1", String(Math.abs(power)), null, null, fromCell, toCell); operation("1", String(Math.abs(power)), null, null, fromCell, toCell);
const changedHeights = HeightmapGenerator.getHeights(); const changedHeights = HeightmapGenerator.getHeights();