Layers : add layer icon. Position buttons on top of list. Fix name generation issue

This commit is contained in:
jdescottes
2013-09-25 22:43:21 +02:00
parent ff5f9273a8
commit 9395be3034
7 changed files with 98 additions and 17 deletions

View File

@ -10,6 +10,8 @@
this.currentLayerIndex = 0;
this.currentFrameIndex = 0;
this.layerIdCounter = 0;
$.publish(Events.FRAMESHEET_RESET);
$.publish(Events.FRAME_SIZE_CHANGED);
};
@ -118,9 +120,18 @@
}
};
ns.PiskelController.prototype.generateLayerName_ = function () {
var name = "Layer " + this.layerIdCounter;
while (this.hasLayerForName_(name)) {
this.layerIdCounter++;
name = "Layer " + this.layerIdCounter;
}
return name;
};
ns.PiskelController.prototype.createLayer = function (name) {
if (!name) {
name = "Layer " + (this.getLayers().length + 1);
name = this.generateLayerName_();
}
if (!this.hasLayerForName_(name)) {
var layer = new pskl.model.Layer(name);