This commit is contained in:
jdescottes
2013-12-06 18:04:04 +01:00
parent cecadf54e1
commit b11b16b427
10 changed files with 71 additions and 18 deletions

View File

@@ -15,6 +15,7 @@
var size = this.readSizeFromURL_();
var piskel = new pskl.model.Piskel(size.width, size.height);
piskel.setDescriptor("New Piskel", "Some text ...");
var layer = new pskl.model.Layer("Layer 1");
var frame = new pskl.model.Frame(size.width, size.height);

View File

@@ -0,0 +1,18 @@
(function () {
var ns = $.namespace("pskl.controller.settings");
ns.SaveController = function (piskelController) {
this.piskelController = piskelController;
};
/**
* @public
*/
ns.SaveController.prototype.init = function () {
this.titleInput = document.getElementById("save-title");
this.descriptionInput = document.getElementById("save-description");
this.titleInput.value = this.piskelController.piskel.getDescriptor().name;
this.descriptionInput.value = this.piskelController.piskel.getDescriptor().description;
};
})();

View File

@@ -13,6 +13,10 @@
'import' : {
template : 'templates/settings/import.html',
controller : ns.ImportController
},
'save' : {
template : 'templates/settings/save.html',
controller : ns.SaveController
}
};

View File

@@ -5,6 +5,8 @@
* @constructor
* @param {Number} width
* @param {Number} height
* @param {String} name
* @param {String} description
*/
ns.Piskel = function (width, height) {
if (width && height) {
@@ -16,6 +18,8 @@
/** @type {Number} */
this.height = height;
this.descriptor = null;
} else {
throw 'Missing arguments in Piskel constructor : ' + Array.prototype.join.call(arguments, ",");
}
@@ -96,4 +100,15 @@
this.layers.splice(index, 1);
};
ns.Piskel.prototype.getDescriptor = function () {
return this.descriptor;
};
ns.Piskel.prototype.setDescriptor = function (name, desc) {
this.descriptor = {
name : name,
description : desc
};
};
})();

View File