()
| 79 | } |
| 80 | |
| 81 | function setPixelToWorldScale() { |
| 82 | let worldToPixelScale |
| 83 | if (window.innerWidth / window.innerHeight < WORLD_WIDTH / WORLD_HEIGHT) { |
| 84 | worldToPixelScale = window.innerWidth / WORLD_WIDTH |
| 85 | } else { |
| 86 | worldToPixelScale = window.innerHeight / WORLD_HEIGHT |
| 87 | } |
| 88 | |
| 89 | worldElem.style.width = `${WORLD_WIDTH * worldToPixelScale}px` |
| 90 | worldElem.style.height = `${WORLD_HEIGHT * worldToPixelScale}px` |
| 91 | } |