From 3cf72dd9280af10448ed2a8f89c7e3078db59f9f Mon Sep 17 00:00:00 2001 From: unsettledgames <47360416+unsettledgames@users.noreply.github.com> Date: Sun, 13 Sep 2020 11:58:46 +0200 Subject: [PATCH] Added input fetching and validation --- css/pixel-editor.scss | 14 +++++++++-- js/_resizeCanvas.js | 55 +++++++++++++++++++++++++++--------------- views/pixel-editor.hbs | 12 ++++++--- 3 files changed, 55 insertions(+), 26 deletions(-) diff --git a/css/pixel-editor.scss b/css/pixel-editor.scss index 8602d08..b0e05d1 100644 --- a/css/pixel-editor.scss +++ b/css/pixel-editor.scss @@ -1007,10 +1007,20 @@ svg { input { position:relative; margin-left:10px; - width:10px; - height:10px; + height:10px; + width:20px; } + input::-webkit-outer-spin-button, + input::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; + } + /* Firefox */ + input[type=number] { + -moz-appearance: textfield; + } + h2 { position:relative; display:inline-block; diff --git a/js/_resizeCanvas.js b/js/_resizeCanvas.js index a1eed54..7159d35 100644 --- a/js/_resizeCanvas.js +++ b/js/_resizeCanvas.js @@ -1,46 +1,61 @@ let resizeCanvasContainer = document.getElementById("resize-canvas"); +let pivot = "middle"; +let resizeCanvasInitialized = false; +let borders = {left: 0, right: 0, top: 0, bottom: 0}; function openResizeCanvasWindow() { + if (!resizeCanvasInitialized) { + resizeCanvasInitialized = true; + initResizeCanvasInputs(); + } showDialogue('resize-canvas'); - console.log("aperta"); - initButtons(); } -function initButtons() { +function initResizeCanvasInputs() { let buttons = document.getElementsByClassName("pivot-button"); - console.log("length: " + buttons.length); - for (let i=0; i - Left: + Left: - Right: + Right: - Top: + Top: - Bottom: + Bottom: