fix: bind HeightmapGenerator methods for correct context in editHeightmap (#1281)

This commit is contained in:
Marc Emmanuel 2026-01-23 13:47:13 +01:00 committed by GitHub
parent 4b341a6590
commit 70ed9aec56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -675,7 +675,7 @@ function editHeightmap(options) {
if (power === 0) return tip("Power should not be zero", false, "error");
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);
operation("1", String(Math.abs(power)), null, null, fromCell, toCell);
const changedHeights = HeightmapGenerator.getHeights();