mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Fix currentcolors on sprites with many frames
This commit is contained in:
parent
ce8d71f47e
commit
ac9ccd04e2
@ -10,7 +10,7 @@ SETLOCAL
|
||||
|
||||
set MISC_FOLDER=%PISKEL_HOME%\misc
|
||||
set RELEASES_FOLDER=%PISKEL_HOME%\dest\desktop
|
||||
set DEST_FOLDER=%RELEASES_FOLDER%\piskel\win64
|
||||
set DEST_FOLDER=%RELEASES_FOLDER%\piskel\win32
|
||||
|
||||
ECHO "Updating Piskel icon -- Using Resource Hacker"
|
||||
%RESOURCE_HACKER_PATH%\ResHacker -addoverwrite "%DEST_FOLDER%\piskel.exe", "%DEST_FOLDER%\piskel-logo.exe", "%MISC_FOLDER%\desktop\logo.ico", ICONGROUP, IDR_MAINFRAME, 1033
|
||||
|
@ -48,15 +48,32 @@
|
||||
}
|
||||
};
|
||||
|
||||
var batchAll = function (frames, job) {
|
||||
var batches = [];
|
||||
frames = frames.slice(0);
|
||||
while (frames.length) {
|
||||
batches.push(frames.splice(0, 10));
|
||||
}
|
||||
var result = Q([]);
|
||||
batches.forEach(function (batch) {
|
||||
result = result.then(function (results) {
|
||||
return Q.all(batch.map(job)).then(function (partials) {
|
||||
return results.concat(partials);
|
||||
});
|
||||
});
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
ns.CurrentColorsService.prototype.updateCurrentColors_ = function () {
|
||||
var layers = this.piskelController.getLayers();
|
||||
var frames = layers.map(function (l) {return l.getFrames();}).reduce(function (p, n) {return p.concat(n);});
|
||||
|
||||
Q.all(
|
||||
frames.map(function (frame) {
|
||||
return this.cachedFrameProcessor.get(frame);
|
||||
}.bind(this))
|
||||
).done(function (results) {
|
||||
var job = function (frame) {
|
||||
return this.cachedFrameProcessor.get(frame);
|
||||
}.bind(this);
|
||||
|
||||
batchAll(frames, job).then(function (results) {
|
||||
var colors = {};
|
||||
results.forEach(function (result) {
|
||||
Object.keys(result).forEach(function (color) {
|
||||
|
Loading…
Reference in New Issue
Block a user