diff --git a/js/data/consts.js b/js/data/consts.js index c049d25..275578f 100644 --- a/js/data/consts.js +++ b/js/data/consts.js @@ -4,4 +4,7 @@ const MAX_Z_INDEX = 5000; // Index of the first layer the user can use in the layers array const firstUserLayerIndex = 2; -const MIN_ZOOM_LEVEL = 0.5; \ No newline at end of file +const MIN_ZOOM_LEVEL = 0.5; + +const MAX_CANVAS_SIZE = 3000; +const MIN_CANVAS_SIZE = 0; \ No newline at end of file diff --git a/js/pixel-editor.js b/js/pixel-editor.js index d0a9052..2ee7fcb 100644 --- a/js/pixel-editor.js +++ b/js/pixel-editor.js @@ -84,9 +84,11 @@ window.onload = function () { // apply a listener to each input for (let i = 0; i < canvasSizeInputs.length; i++) { canvasSizeInputs[i].addEventListener('keyup', e => { - const maxCanvasSize = 5000; - if (e.target.value > maxCanvasSize) { - e.target.value = maxCanvasSize; + + if (e.target.value > MAX_CANVAS_SIZE) { + e.target.value = MAX_CANVAS_SIZE; + } else if (e.target.value < MIN_CANVAS_SIZE) { + e.target.value = MIN_CANVAS_SIZE; } }, true); } @@ -163,10 +165,6 @@ window.onload = function () { } } -function validateInput(canvasSize) { - console.log(canvasSize); -} - //prevent user from leaving page with unsaved data // window.onbeforeunload = function() { // if (EditorState.documentCreated) diff --git a/views/popups/canvas-resize.hbs b/views/popups/canvas-resize.hbs index 0904bbb..2cc9705 100644 --- a/views/popups/canvas-resize.hbs +++ b/views/popups/canvas-resize.hbs @@ -17,16 +17,21 @@ diff --git a/views/popups/new-pixel.hbs b/views/popups/new-pixel.hbs index bdcc39f..a1ca3fc 100644 --- a/views/popups/new-pixel.hbs +++ b/views/popups/new-pixel.hbs @@ -9,8 +9,8 @@