- document.getElementById("boardSize").value =
- (boardSize * 100) / (window.innerWidth - movesWidth);
- window.addEventListener("resize", this.adjustBoard);
- // TODO: find sometjhing better than next height adjustment...
- // maybe each variant could give its ratio (?!)
- setTimeout( () => { this.adjustBoard("vertical"); }, 1000);
+ const maxWidth =
+ Math.min(window.innerHeight, window.innerWidth - movesWidth);
+ document.getElementById("boardSize").value = (boardSize * 100) / maxWidth;
+ window.addEventListener("resize", () => this.adjustBoard());