forked from vergnet/application-amicale
Adapt preview size to shape size
This commit is contained in:
parent
4bff6e15a8
commit
1780ab886e
3 changed files with 7 additions and 4 deletions
|
@ -53,8 +53,6 @@ export default class BaseShape {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets this object's current shape.
|
* Gets this object's current shape.
|
||||||
*
|
|
||||||
* Used by tests to read private fields
|
|
||||||
*/
|
*/
|
||||||
getCurrentShape(): Shape {
|
getCurrentShape(): Shape {
|
||||||
return this.#currentShape;
|
return this.#currentShape;
|
||||||
|
|
|
@ -166,7 +166,8 @@ export default class GameLogic {
|
||||||
getNextPiecesPreviews() {
|
getNextPiecesPreviews() {
|
||||||
let finalArray = [];
|
let finalArray = [];
|
||||||
for (let i = 0; i < this.#nextPieces.length; i++) {
|
for (let i = 0; i < this.#nextPieces.length; i++) {
|
||||||
finalArray.push(this.#gridManager.getEmptyGrid(4, 4));
|
const gridSize = this.#nextPieces[i].getCurrentShape().getCurrentShape()[0].length;
|
||||||
|
finalArray.push(this.#gridManager.getEmptyGrid(gridSize, gridSize));
|
||||||
this.#nextPieces[i].toGrid(finalArray[i], true);
|
this.#nextPieces[i].toGrid(finalArray[i], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,4 +165,8 @@ export default class Piece {
|
||||||
getCoordinates(): Array<Coordinates> {
|
getCoordinates(): Array<Coordinates> {
|
||||||
return this.#currentShape.getCellsCoordinates(true);
|
return this.#currentShape.getCellsCoordinates(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCurrentShape() {
|
||||||
|
return this.#currentShape;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue