Spaces:
Running
Running
fix
Browse files- 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.
|
| 224 |
|
| 225 |
-
const newWidth = bgWidth *
|
| 226 |
-
const newHeight = bgHeight *
|
| 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.
|
| 247 |
|
| 248 |
-
const newWidth = bgWidth *
|
| 249 |
-
const newHeight = bgHeight *
|
| 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;
|