Add checks to stacking logic

This commit is contained in:
tobspr 2020-07-27 13:49:40 +02:00
parent 58a4543c29
commit 2d54b72882
1 changed files with 2 additions and 0 deletions

View File

@ -570,10 +570,12 @@ export class ShapeDefinition extends BasicSerializableObject {
const bottomShapeLayer = mergedLayers[layerMergingAt];
const topShapeLayer = topShapeLayers[layer];
for (let quad = 0; quad < 4; quad++) {
assert(!(bottomShapeLayer[quad] && topShapeLayer[quad]), "Shape merge: Sub shape got lost");
bottomShapeLayer[quad] = bottomShapeLayer[quad] || topShapeLayer[quad];
}
}
// Limit to 4 layers at max
mergedLayers.splice(4);
return new ShapeDefinition({ layers: mergedLayers });