mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
fix : reduce piskel model size : ImportController
+ ImportController is no longer relying on the deserializer to build a piskel instance + Static builders have been added to Piskel and Layer to help easily create new instances from existing elements
This commit is contained in:
@ -153,15 +153,12 @@
|
||||
var image = pskl.utils.ImageResizer.resize(this.importedImage_, w, h, smoothing);
|
||||
var frame = pskl.utils.FrameUtils.createFromImage(image);
|
||||
|
||||
// TODO : juliandescottes : here we only want to create a layer from an array of frames, and create a new piskel using this layer
|
||||
// we shouldn't use the deserializer for this ... it's only working because it's falling back to the old implementation
|
||||
// bad, very bad
|
||||
var deserializer = new pskl.utils.Deserializer([frame], function (piskel) {
|
||||
pskl.app.piskelController.setPiskel(piskel);
|
||||
pskl.app.animationController.setFPS(Constants.DEFAULT.FPS);
|
||||
this.reset_();
|
||||
}.bind(this));
|
||||
deserializer.deserialize();
|
||||
var layer = pskl.model.Layer.fromFrames('Layer 1', [frame]);
|
||||
var piskel = pskl.model.Piskel.fromLayers([layer]);
|
||||
|
||||
pskl.app.piskelController.setPiskel(piskel);
|
||||
pskl.app.animationController.setFPS(Constants.DEFAULT.FPS);
|
||||
this.reset_();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user