mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00

- Added import button on create palette dialog - implemented import from images - missing limitation on color count when importing !! - should remove button when editing existing palette
26 lines
719 B
JavaScript
26 lines
719 B
JavaScript
(function () {
|
|
var ns = $.namespace('pskl.service.palette');
|
|
|
|
ns.PaletteImportService = function () {};
|
|
|
|
ns.PaletteImportService.prototype.read = function (file, onSuccess, onError) {
|
|
if (this.isImage_(file)){
|
|
var reader = new ns.PaletteImageReader(file, onSuccess, onError);
|
|
reader.read();
|
|
} else if (this.isSupportedFormat_(file)) {
|
|
this.importFile(file);
|
|
}
|
|
};
|
|
|
|
ns.PaletteImportService.prototype.importFile = function (file) {
|
|
|
|
};
|
|
|
|
ns.PaletteImportService.prototype.isImage_ = function (file) {
|
|
return file.type.indexOf('image') === 0;
|
|
};
|
|
|
|
ns.PaletteImportService.prototype.isSupportedFormat_ = function (file) {
|
|
return (/\.piskel$/).test(file.name);
|
|
};
|
|
})(); |