pooyanrg commited on
Commit
3f7fcb1
·
1 Parent(s): 4c995b3
Files changed (1) hide show
  1. js/interactive_grid.js +6 -6
js/interactive_grid.js CHANGED
@@ -220,10 +220,10 @@ function drawBackgroundBefore() {
220
  const scaleX = canvasWidth / bgWidth;
221
  const scaleY = canvasHeight / bgHeight;
222
 
223
- const scale = Math.max(scaleX, scaleY);
224
 
225
- const newWidth = bgWidth * scaleX;
226
- const newHeight = bgHeight * scaleX;
227
 
228
  const xOffset = (canvasWidth - newWidth) / 2;
229
  const yOffset = (canvasHeight - newHeight) / 2;
@@ -243,10 +243,10 @@ function drawBackgroundAfter() {
243
  const scaleX = canvasWidth / bgWidth;
244
  const scaleY = canvasHeight / bgHeight;
245
 
246
- const scale = Math.max(scaleX, scaleY);
247
 
248
- const newWidth = bgWidth * scaleX;
249
- const newHeight = bgHeight * scaleX;
250
 
251
  const xOffset = (canvasWidth - newWidth) / 2;
252
  const yOffset = (canvasHeight - newHeight) / 2;
 
220
  const scaleX = canvasWidth / bgWidth;
221
  const scaleY = canvasHeight / bgHeight;
222
 
223
+ const scale = Math.min(scaleX, scaleY);
224
 
225
+ const newWidth = bgWidth * scale;
226
+ const newHeight = bgHeight * scale;
227
 
228
  const xOffset = (canvasWidth - newWidth) / 2;
229
  const yOffset = (canvasHeight - newHeight) / 2;
 
243
  const scaleX = canvasWidth / bgWidth;
244
  const scaleY = canvasHeight / bgHeight;
245
 
246
+ const scale = Math.min(scaleX, scaleY);
247
 
248
+ const newWidth = bgWidth * scale;
249
+ const newHeight = bgHeight * scale;
250
 
251
  const xOffset = (canvasWidth - newWidth) / 2;
252
  const yOffset = (canvasHeight - newHeight) / 2;