laneya2

cave exploration game
git clone https://git.ce9e.org/laneya2.git

commit
6d55f2dfc36dcd3df82d2623cb06e4cdf4064459
parent
83064ec30d510d0e5427eb22054f3589ff346dd8
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-09-27 15:48
render on every resize

Diffstat

M static/main.js 13 +++----------

1 files changed, 3 insertions, 10 deletions


diff --git a/static/main.js b/static/main.js

@@ -170,11 +170,7 @@ var screen = {
  170   170             $pre.textContent = ' '.repeat(v);
  171   171             return document.body.scrollWidth - document.body.clientWidth;
  172   172         });
  173    -1     },
  174    -1 
  175    -1     invalidateSize() {
  176    -1         this.rows = null;
  177    -1         this.cols = null;
   -1   173         this.render();
  178   174     },
  179   175 
  180   176     commitSpan(text, color) {
@@ -224,10 +220,6 @@ var screen = {
  224   220     },
  225   221 
  226   222     render() {
  227    -1         if (!this.rows || !this.cols) {
  228    -1             this.updateSize();
  229    -1         }
  230    -1 
  231   223         $pre.innerHTML = '';
  232   224 
  233   225         this.renderHealth();
@@ -296,4 +288,5 @@ document.onkeydown = function(event) {
  296   288 
  297   289 onDPad(dir => send({action: 'move', dir: dir}));
  298   290 
  299    -1 window.addEventListener('resize', () => screen.invalidateSize());
   -1   291 screen.updateSize();
   -1   292 window.addEventListener('resize', () => screen.updateSize(), {passive: true});