export to file

This commit is contained in:
jdescottes 2014-07-13 01:02:45 +02:00
parent ef6d253896
commit d7102ae0bd
5 changed files with 13 additions and 4 deletions

View File

@ -621,6 +621,7 @@ body {
} }
.png-export-preview img { .png-export-preview img {
max-height:32px;
float: left; float: left;
} }

View File

@ -12693,9 +12693,17 @@ if (typeof Function.prototype.bind !== "function") {
var ns = $.namespace('pskl.utils'); var ns = $.namespace('pskl.utils');
ns.PiskelFileUtils = { ns.PiskelFileUtils = {
/**
* Load a piskel from a piskel file.
* After deserialization is successful, the provided success callback will be called.
* Success callback is expected to handle 3 arguments : (piskel:Piskel, descriptor:PiskelDescriptor, fps:Number)
* @param {File} file the .piskel file to load
* @param {Function} onSuccess Called if the deserialization of the piskel is successful
* @param {Function} onError NOT USED YET
*/
loadFromFile : function (file, onSuccess, onError) { loadFromFile : function (file, onSuccess, onError) {
pskl.utils.FileUtils.readFile(file, function (content) { pskl.utils.FileUtils.readFile(file, function (content) {
var rawPiskel = window.atob(content.replace('data:;base64,','')); var rawPiskel = window.atob(content.replace(/data\:.*?\;base64\,/,''));
var serializedPiskel = JSON.parse(rawPiskel); var serializedPiskel = JSON.parse(rawPiskel);
var fps = serializedPiskel.piskel.fps; var fps = serializedPiskel.piskel.fps;
var descriptor = new pskl.model.piskel.Descriptor(serializedPiskel.piskel.name, serializedPiskel.piskel.description, true); var descriptor = new pskl.model.piskel.Descriptor(serializedPiskel.piskel.name, serializedPiskel.piskel.description, true);

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
(function () { (function () {
var version = '-2014-07-13-12-45'; var version = '-2014-07-13-01-02';
var versionHasNotBeenReplaced = version.indexOf('@@') === 0; var versionHasNotBeenReplaced = version.indexOf('@@') === 0;
if (versionHasNotBeenReplaced) { if (versionHasNotBeenReplaced) {
version = ''; version = '';