diff --git a/client-data/js/board.js b/client-data/js/board.js index 660d5ea9..15468f3d 100644 --- a/client-data/js/board.js +++ b/client-data/js/board.js @@ -414,12 +414,11 @@ function updateDocumentTitle() { function resizeCanvas(m) { //Enlarge the canvas whenever something is drawn near its border var x = m.x | 0, y = m.y | 0 - var MAX_BOARD_SIZE = 65536; // Maximum value for any x or y on the board if (x > Tools.svg.width.baseVal.value - 2000) { - Tools.svg.width.baseVal.value = Math.min(x + 2000, MAX_BOARD_SIZE); + Tools.svg.width.baseVal.value = Math.min(x + 2000, Tools.server_config.MAX_BOARD_SIZE_X); } if (y > Tools.svg.height.baseVal.value - 2000) { - Tools.svg.height.baseVal.value = Math.min(y + 2000, MAX_BOARD_SIZE); + Tools.svg.height.baseVal.value = Math.min(y + 2000, Tools.server_config.MAX_BOARD_SIZE); } } @@ -436,6 +435,7 @@ var scaleTimeout = null; Tools.setScale = function setScale(scale) { if (isNaN(scale)) scale = 1; scale = Math.max(0.1, Math.min(10, scale)); + scale = Math.min(scale, document.documentElement.clientWidth/Tools.server_config.MAX_BOARD_SIZE_X); Tools.svg.style.willChange = 'transform'; Tools.svg.style.transform = 'scale(' + scale + ')'; clearTimeout(scaleTimeout); diff --git a/server/client_configuration.js b/server/client_configuration.js index 039992ed..9a9d479c 100644 --- a/server/client_configuration.js +++ b/server/client_configuration.js @@ -3,6 +3,7 @@ const config = require("./configuration"); /** Settings that should be handed through to the clients */ module.exports = { "MAX_BOARD_SIZE": config.MAX_BOARD_SIZE, + "MAX_BOARD_SIZE_X": config.MAX_BOARD_SIZE_X, "MAX_EMIT_COUNT": config.MAX_EMIT_COUNT, "MAX_EMIT_COUNT_PERIOD": config.MAX_EMIT_COUNT_PERIOD, "BLOCKED_TOOLS": config.BLOCKED_TOOLS, diff --git a/server/configuration.js b/server/configuration.js index f03e0c55..c2b07fe2 100644 --- a/server/configuration.js +++ b/server/configuration.js @@ -26,6 +26,9 @@ module.exports = { /** Maximum value for any x or y on the board */ MAX_BOARD_SIZE: parseInt(process.env['WBO_MAX_BOARD_SIZE']) || 65536, + /** Maximum value for any x on the board */ + MAX_BOARD_SIZE_X: parseInt(process.env['WBO_MAX_BOARD_SIZE_X']) || parseInt(process.env['WBO_MAX_BOARD_SIZE']) || 65536, + /** Maximum messages per user over the given time period before banning them */ MAX_EMIT_COUNT: parseInt(process.env['WBO_MAX_EMIT_COUNT']) || 192,