From e213acea7673b4bee0e8f5cfcac6fe0bcbb018e7 Mon Sep 17 00:00:00 2001 From: unsettledgames <47360416+unsettledgames@users.noreply.github.com> Date: Fri, 18 Sep 2020 15:22:10 +0200 Subject: [PATCH] Added resize sprite window opening --- js/_resizeSprite.js | 30 +++++++++++++++++++++++++- views/pixel-editor.hbs | 49 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/js/_resizeSprite.js b/js/_resizeSprite.js index 2a02ed7..b5cf030 100644 --- a/js/_resizeSprite.js +++ b/js/_resizeSprite.js @@ -1,6 +1,34 @@ +let resizeSpriteInitialized = false; + // Function to show dialogue // New size // Percentage change // Keep ratio checkbox // Choose resize algorithm - // Confirm \ No newline at end of file + // Confirm + + function openResizeSpriteWindow() { + if (!resizeSpriteInitialized) { + resizeSpriteInitialized = true; + initResizeSpriteInputs(); + } + showDialogue('resize-sprite'); + } + + function initResizeSpriteInputs() { + /* + document.getElementById("rc-width").value = layers[0].canvasSize[0]; + document.getElementById("rc-height").value = layers[0].canvasSize[1]; + + document.getElementById("rc-border-left").addEventListener("change", changedBorder); + document.getElementById("rc-border-right").addEventListener("change", changedBorder); + document.getElementById("rc-border-top").addEventListener("change", changedBorder); + document.getElementById("rc-border-bottom").addEventListener("change", changedBorder); + + document.getElementById("rc-width").addEventListener("change", changedSize); + document.getElementById("rc-height").addEventListener("change", changedSize); + + document.getElementById("resize-canvas-confirm").addEventListener("click", resizeCanvas); + console.log("Pivot selezionato: " + currentPivotObject); + */ + } \ No newline at end of file diff --git a/views/pixel-editor.hbs b/views/pixel-editor.hbs index 1d560b0..6d35be9 100644 --- a/views/pixel-editor.hbs +++ b/views/pixel-editor.hbs @@ -53,7 +53,7 @@ @@ -253,6 +253,53 @@ + +
+ +

Resize sprite

+ + +

New size

+
+ + Width: + + + + Height: + +
+
+ + +

Resize percentages

+
+ + Left: + + + + Right: + + + + Top: + + + + Bottom: + +
+ +
+
+