Skip to content

Commit e6008db

Browse files
committed
fix/bug the first next shape not drawn
1 parent 667d96b commit e6008db

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

client/src/components/game/scripts/canvas.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const drawShape = (ctx, state, opponent = false) => {
147147
drawCells(ctx, shapeToDraw, opponent);
148148
};
149149

150-
export const drawNextShape = (ctx, newShape, state) => {
150+
export const drawNextShape = async (ctx, newShape, state) => {
151151
clearCanvas(ctx, 'All', 'drawNextShape');
152152
const initiailizedShape = newShape;
153153
const canvasWidth = state.canvas.canvasMinor.width;
@@ -174,6 +174,7 @@ export const drawNextShape = (ctx, newShape, state) => {
174174
false,
175175
specialshapes,
176176
);
177+
await Promise.resolve()
177178
const canvasContext = ctx;
178179
canvasContext.beginPath();
179180
canvasContext.fillStyle = tetrisShapes[locatedShape.name].color;

0 commit comments

Comments
 (0)