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 @@ -

Size

+
+

Size

+

Max canvas size is 3000 x 3000

+
Width: + value="{{#if border}}{{border}}{{else}}0{{/if}}" autocomplete="off" + class="size-input" type="number" min="0" max="5000"/> Height: + value="{{#if border}}{{border}}{{else}}0{{/if}}" autocomplete="off" + class="size-input" type="number" min="0" max="5000"/>
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 @@

Size

-

Max canvas size is 5000 x 5000

- {{svg "x.svg" width="16" height="16" class="dimentions-x"}} +

Max canvas size is 3000 x 3000

+ {{svg "x.svg" width="16" height="16" class="dimentions-x"}}

Palette

diff --git a/views/popups/splash-page.hbs b/views/popups/splash-page.hbs index 9a63ef5..e7b1bbf 100644 --- a/views/popups/splash-page.hbs +++ b/views/popups/splash-page.hbs @@ -24,9 +24,9 @@

New Custom Pixel

Size

-

Max canvas size is 5000 x 5000

+

Max canvas size is 3000 x 3000

- {{svg "x.svg" width="16" height="16" class="dimentions-x"}} + {{svg "x.svg" width="16" height="16" class="dimentions-x"}}

Palette

diff --git a/views/popups/sprite-resize.hbs b/views/popups/sprite-resize.hbs index 9172a2d..3a34686 100644 --- a/views/popups/sprite-resize.hbs +++ b/views/popups/sprite-resize.hbs @@ -4,16 +4,19 @@

Scale sprite

New size

+

Max canvas size is 3000 x 3000

Width: + value="{{#if border}}{{border}}{{else}}0{{/if}}" autocomplete="off" + class="size-input" type="number" min="0" max="5000"/> Height: + value="{{#if border}}{{border}}{{else}}0{{/if}}" autocomplete="off" + class="size-input" type="number" min="0" max="5000"/>