mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
sort colors on image import for palette
This commit is contained in:
parent
a7ef57b6ee
commit
d805e13d57
@ -5,6 +5,8 @@
|
|||||||
this.file = file;
|
this.file = file;
|
||||||
this.onSuccess = onSuccess;
|
this.onSuccess = onSuccess;
|
||||||
this.onError = onError;
|
this.onError = onError;
|
||||||
|
|
||||||
|
this.colorSorter_ = new pskl.service.color.ColorSorter();
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.PaletteImageReader.prototype.read = function () {
|
ns.PaletteImageReader.prototype.read = function () {
|
||||||
@ -33,7 +35,8 @@
|
|||||||
this.onError('Too many colors : ' + colors.length);
|
this.onError('Too many colors : ' + colors.length);
|
||||||
} else {
|
} else {
|
||||||
var uuid = pskl.utils.Uuid.generate();
|
var uuid = pskl.utils.Uuid.generate();
|
||||||
var palette = new pskl.model.Palette(uuid, this.file.name + ' palette', colors);
|
var sortedColors = this.colorSorter_.sort(colors);
|
||||||
|
var palette = new pskl.model.Palette(uuid, this.file.name + ' palette', sortedColors);
|
||||||
|
|
||||||
this.onSuccess(palette);
|
this.onSuccess(palette);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user