mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
ad3dd935e0
Image import is now triggering a popup after selecting the file. Same for local saves. Drag and drop of .piskel files opens the piskel immediately ! Remains to do : - redesign the dialog for import image and browse local - create dialog for recover session - improve recover session to handle more than the last session
17 lines
686 B
JavaScript
17 lines
686 B
JavaScript
(function () {
|
|
var ns = $.namespace('pskl.utils');
|
|
|
|
ns.PiskelFileUtils = {
|
|
loadFromFile : function (file, onSuccess, onError) {
|
|
pskl.utils.FileUtils.readFile(file, function (content) {
|
|
var rawPiskel = window.atob(content.replace('data:;base64,',''));
|
|
var serializedPiskel = JSON.parse(rawPiskel);
|
|
var fps = serializedPiskel.piskel.fps;
|
|
var descriptor = new pskl.model.piskel.Descriptor(serializedPiskel.piskel.name, serializedPiskel.piskel.description, true);
|
|
pskl.utils.serialization.Deserializer.deserialize(serializedPiskel, function (piskel) {
|
|
onSuccess(piskel, descriptor, fps);
|
|
});
|
|
});
|
|
}
|
|
};
|
|
})(); |