mirror of
https://github.com/lovasoa/whitebophir
synced 2024-11-10 06:24:17 +00:00
prevent zooming out further than the whole canvas
This commit is contained in:
parent
69db0af4c2
commit
a10347695b
1 changed files with 4 additions and 1 deletions
|
@ -451,8 +451,11 @@ Tools.messageHooks = [resizeCanvas, updateUnreadCount];
|
|||
Tools.scale = 1.0;
|
||||
var scaleTimeout = null;
|
||||
Tools.setScale = function setScale(scale) {
|
||||
var fullScale = Math.max(window.innerWidth, window.innerHeight) / Tools.server_config.MAX_BOARD_SIZE;
|
||||
var minScale = Math.max(0.1, fullScale);
|
||||
var maxScale = 10;
|
||||
if (isNaN(scale)) scale = 1;
|
||||
scale = Math.max(0.1, Math.min(10, scale));
|
||||
scale = Math.max(minScale, Math.min(maxScale, scale));
|
||||
Tools.svg.style.willChange = 'transform';
|
||||
Tools.svg.style.transform = 'scale(' + scale + ')';
|
||||
clearTimeout(scaleTimeout);
|
||||
|
|
Loading…
Reference in a new issue