3 Commits

3 changed files with 13 additions and 9 deletions

View File

@ -3,7 +3,7 @@
"name": "piskel", "name": "piskel",
"main": "./dest/index.html", "main": "./dest/index.html",
"description": "Web based 2d animations editor", "description": "Web based 2d animations editor",
"version": "0.5.5-SNAPSHOT", "version": "0.6.0-SNAPSHOT",
"homepage": "http://github.com/juliandescottes/piskel", "homepage": "http://github.com/juliandescottes/piskel",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -56,8 +56,9 @@
}; };
ns.ColorSwap.prototype.applyToolOnFrame_ = function (frame, oldColor, newColor) { ns.ColorSwap.prototype.applyToolOnFrame_ = function (frame, oldColor, newColor) {
oldColor = oldColor.toUpperCase();
frame.forEachPixel(function (color, col, row) { frame.forEachPixel(function (color, col, row) {
if (color == oldColor) { if (color && color.toUpperCase() == oldColor) {
frame.pixels[col][row] = newColor; frame.pixels[col][row] = newColor;
} }
}); });

View File

@ -25,13 +25,16 @@
deferred.resolve(fileInputElement.value); deferred.resolve(fileInputElement.value);
}; };
fileInputElement.click(); // fix for issue #322 :
window.setTimeout(function () {
fileInputElement.addEventListener('change', changeListener); fileInputElement.click();
// there is no way to detect a cancelled fileInput popup fileInputElement.addEventListener('change', changeListener);
// as a crappy workaround we add a click listener on the document // there is no way to detect a cancelled fileInput popup
// on top the change event listener // as a crappy workaround we add a click listener on the document
document.addEventListener('click', changeListener); // on top the change event listener
// todo : listen to dirty check instead
document.addEventListener('mousedown', changeListener);
}, 50);
return deferred.promise; return deferred.promise;
}, },