Fix grid editor mutably changing grid state
This commit is contained in:
parent
833f0082ba
commit
3d74dfc88a
@ -77,7 +77,10 @@ function MapGridEditor({ map, onGridChange }) {
|
||||
Vector2.subtract(position, previousPosition)
|
||||
);
|
||||
|
||||
const inset = map.grid.inset;
|
||||
const inset = {
|
||||
topLeft: { ...map.grid.inset.topLeft },
|
||||
bottomRight: { ...map.grid.inset.bottomRight },
|
||||
};
|
||||
|
||||
if (direction.x === 0 && direction.y === 0) {
|
||||
return inset;
|
||||
|
@ -212,7 +212,10 @@ export function getGridDefaultInset(grid, mapWidth, mapHeight) {
|
||||
* @returns {GridInset}
|
||||
*/
|
||||
export function getGridUpdatedInset(grid, mapWidth, mapHeight) {
|
||||
let inset = grid.inset;
|
||||
let inset = {
|
||||
topLeft: { ...grid.inset.topLeft },
|
||||
bottomRight: { ...grid.inset.bottomRight },
|
||||
};
|
||||
// Take current inset width and use it to calculate the new height
|
||||
if (grid.size.x > 0 && grid.size.x > 0) {
|
||||
// Convert to px relative to map size
|
||||
|
Loading…
Reference in New Issue
Block a user