mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Merged
This commit is contained in:
@ -8,8 +8,8 @@
|
||||
* @param {String} name
|
||||
* @param {String} description
|
||||
*/
|
||||
ns.Piskel = function (width, height) {
|
||||
if (width && height) {
|
||||
ns.Piskel = function (width, height, descriptor) {
|
||||
if (width && height && descriptor) {
|
||||
/** @type {Array} */
|
||||
this.layers = [];
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
/** @type {Number} */
|
||||
this.height = height;
|
||||
|
||||
this.descriptor = null;
|
||||
this.descriptor = descriptor;
|
||||
} else {
|
||||
throw 'Missing arguments in Piskel constructor : ' + Array.prototype.join.call(arguments, ",");
|
||||
}
|
||||
@ -31,11 +31,11 @@
|
||||
* @param {Array<pskl.model.Layer>} layers
|
||||
* @return {pskl.model.Piskel}
|
||||
*/
|
||||
ns.Piskel.fromLayers = function (layers) {
|
||||
ns.Piskel.fromLayers = function (layers, descriptor) {
|
||||
var piskel = null;
|
||||
if (layers.length > 0 && layers[0].length() > 0) {
|
||||
var sampleFrame = layers[0].getFrameAt(0);
|
||||
piskel = new pskl.model.Piskel(sampleFrame.getWidth(), sampleFrame.getHeight());
|
||||
piskel = new pskl.model.Piskel(sampleFrame.getWidth(), sampleFrame.getHeight(), descriptor);
|
||||
layers.forEach(piskel.addLayer.bind(piskel));
|
||||
} else {
|
||||
throw 'Piskel.fromLayers expects array of non empty pskl.model.Layer as first argument';
|
||||
@ -104,11 +104,9 @@
|
||||
return this.descriptor;
|
||||
};
|
||||
|
||||
ns.Piskel.prototype.setDescriptor = function (name, desc) {
|
||||
this.descriptor = {
|
||||
name : name,
|
||||
description : desc
|
||||
};
|
||||
ns.Piskel.prototype.setDescriptor = function (descriptor) {
|
||||
this.descriptor = descriptor;
|
||||
var appEngineEditorHeader = $('.piskel-name').html(this.descriptor.name);
|
||||
};
|
||||
|
||||
})();
|
9
js/model/piskel/Descriptor.js
Normal file
9
js/model/piskel/Descriptor.js
Normal file
@ -0,0 +1,9 @@
|
||||
(function () {
|
||||
var ns = $.namespace('pskl.model.piskel');
|
||||
|
||||
ns.Descriptor = function (name, description, isPublic) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.isPublic = isPublic;
|
||||
};
|
||||
})();
|
Reference in New Issue
Block a user