Added resize sprite window opening

This commit is contained in:
unsettledgames 2020-09-18 15:22:10 +02:00
parent 09c68fd847
commit e213acea76
2 changed files with 77 additions and 2 deletions

View File

@ -1,6 +1,34 @@
let resizeSpriteInitialized = false;
// Function to show dialogue
// New size
// Percentage change
// Keep ratio checkbox
// Choose resize algorithm
// Confirm
// 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);
*/
}

View File

@ -53,7 +53,7 @@
<button>Edit</button>
<ul>
<li><button id="resize-canvas-button" onclick = "openResizeCanvasWindow()">Resize canvas</button></li>
<li><button id="resize-sprite-button">Resize sprite</button></li>
<li><button id="resize-sprite-button" onclick = "openResizeSpriteWindow()">Resize sprite</button></li>
<li><button id="undo-button" class="disabled">Undo</button></li>
<li><button id="redo-button" class="disabled">Redo</button></li>
</ul>
@ -253,6 +253,53 @@
<button id="create-button" class="default">Create</button>
</div>
</div>
<!--SPRITE RESIZE-->
<div id = "resize-sprite">
<button class="close-button">{{svg "x.svg" width="20" height="20"}}</button>
<h1>Resize sprite</h1>
<!-- SIZE-->
<span id = "rc-size-menu">
<h2>New size</h2>
<div>
<span>
Width: <input id="rs-width" type="number" default="0" step="1"
value="{{#if border}}{{border}}{{else}}0{{/if}}" autocomplete="off"/>
</span>
<span>
Height: <input id="rs-height" default="0" step="1" type="number"
value="{{#if border}}{{border}}{{else}}0{{/if}}" autocomplete="off"/>
</span>
</div>
</span>
<!--BORDERS-->
<span id = "borders-menu">
<h2>Resize percentages</h2>
<div>
<span>
Left: <input id="rs-border-left" type="number" default="0" step="1"
value="{{#if border}}{{border}}{{else}}0{{/if}}" autocomplete="off"/>
</span>
<span>
Right: <input id="rs-border-right" type="number" default="0" step="1"
value="{{#if border}}{{border}}{{else}}0{{/if}}" autocomplete="off"/>
</span>
<span>
Top: <input id="rs-border-top" type="number" default="0" step="1"
value="{{#if border}}{{border}}{{else}}0{{/if}}" autocomplete="off"/>
</span>
<span>
Bottom: <input id="rs-border-bottom" default="0" step="1" type="number"
value="{{#if border}}{{border}}{{else}}0{{/if}}" autocomplete="off"/>
</span>
</div>
<button id = "resize-sprite-confirm">Resize sprite</button>
</span>
</div>
<!--CANVAS RESIZE-->
<div id = "resize-canvas">
<button class="close-button">{{svg "x.svg" width="20" height="20"}}</button>