mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-02-18 22:09:20 +00:00
Ensure that layerToMergeAt is not less than 0.
This commit is contained in:
parent
c05661ceb8
commit
36a4677c21
@ -536,7 +536,8 @@ export class ShapeDefinition extends BasicSerializableObject {
|
|||||||
gapsBetweenShapes.push(topShapeLowestLayerByQuad[quad] - bottomShapeHighestLayerByQuad[quad]);
|
gapsBetweenShapes.push(topShapeLowestLayerByQuad[quad] - bottomShapeHighestLayerByQuad[quad]);
|
||||||
}
|
}
|
||||||
const smallestGapBetweenShapes = Math.min(...gapsBetweenShapes);
|
const smallestGapBetweenShapes = Math.min(...gapsBetweenShapes);
|
||||||
const layerToMergeAt = 1 - smallestGapBetweenShapes;
|
// Can't merge at a layer lower than 0
|
||||||
|
const layerToMergeAt = Math.max(1 - smallestGapBetweenShapes, 0);
|
||||||
|
|
||||||
const mergedLayers = this.internalCloneLayers();
|
const mergedLayers = this.internalCloneLayers();
|
||||||
for (let layer = mergedLayers.length; layer < layerToMergeAt + topShapeLayers.length; ++layer) {
|
for (let layer = mergedLayers.length; layer < layerToMergeAt + topShapeLayers.length; ++layer) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user