- // After resize event: no need to destroy/recreate pieces
- rescale(self) {
- const container = document.getElementById(self.containerId);
- if (!container)
- return; //useful at initial loading
- let chessboard = container.querySelector(".chessboard");
- let r = chessboard.getBoundingClientRect();
- let [newWidth, newHeight] = [r.width, r.height];
+ // Resize board: no need to destroy/recreate pieces
+ rescale(mode) {
+ let chessboard =
+ document.getElementById(this.containerId).querySelector(".chessboard");
+ const r = chessboard.getBoundingClientRect();
+ const multFact = (mode == "up" ? 1.05 : 0.95);
+ let [newWidth, newHeight] = [multFact * r.width, multFact * r.height];