diff --git a/css/pixel-editor.scss b/css/pixel-editor.scss index 2a0b4e3..a6345d8 100644 --- a/css/pixel-editor.scss +++ b/css/pixel-editor.scss @@ -1118,8 +1118,8 @@ svg { } option:checked, option:hover { - background-color: $basehovericon; - color:$basehovericonhover; + box-shadow: 0 0 10px 100px $basehovericon inset; + color: $basehovericonhover; } } } diff --git a/js/_history.js b/js/_history.js index ab69648..132e7f3 100644 --- a/js/_history.js +++ b/js/_history.js @@ -3,6 +3,22 @@ var redoStates = []; const undoLogStyle = 'background: #87ff1c; color: black; padding: 5px;'; +function HistoryStateResizeSprite(newPercs, oldPercs, algo) { + this.newPercs = newPercs; + this.oldPercs = oldPercs; + this.algo = algo; + + this.undo = function() { + + }; + + this.redo = function() { + + }; + + saveHistoryState(this); +} + function HistoryStateResizeCanvas(newSize, oldSize, imageDatas) { this.oldSize = oldSize; this.newSize = newSize; diff --git a/js/_resizeSprite.js b/js/_resizeSprite.js index 3086b8a..0180413 100644 --- a/js/_resizeSprite.js +++ b/js/_resizeSprite.js @@ -1,22 +1,22 @@ -let resizeSpriteInitialized = false; + let keepRatio = true; let currentRatio; +let currentAlgo = 'nearest-neighbor'; let data = {width: 0, height: 0, widthPercentage: 100, heightPercentage: 100}; let startData = {width: 0, height:0, widthPercentage: 100, heightPercentage: 100}; function openResizeSpriteWindow() { - if (!resizeSpriteInitialized) { - resizeSpriteInitialized = true; - initResizeSpriteInputs(); - } + initResizeSpriteInputs(); currentRatio = layers[0].canvasSize[0] / layers[0].canvasSize[1]; data.width = layers[0].canvasSize[0]; data.height = layers[1].canvasSize[1]; - startData.width = data.width; - startData.height = data.height; + startData.width = parseInt(data.width); + startData.height = parseInt(data.height); + startData.heightPercentage = 100; + startData.widthPercentage = 100; showDialogue('resize-sprite'); } @@ -37,6 +37,7 @@ function initResizeSpriteInputs() { document.getElementById("resize-sprite-confirm").addEventListener("click", resizeSprite); document.getElementById("rs-keep-ratio").addEventListener("click", toggleRatio); + document.getElementById("resize-algorithm-combobox").addEventListener("change", changedAlgorithm); } function resizeSprite() { @@ -85,11 +86,19 @@ function resizeSprite() { for (let i=0; iEdit @@ -257,7 +257,7 @@
-

Resize sprite

+

Scale sprite

New size

@@ -292,14 +292,14 @@ Keep current ratio - Resizing algorithm: -
- +