Fix : layer manager was broken

This commit is contained in:
juliandescottes 2014-04-19 20:19:24 +02:00
parent b8ef570077
commit 8335c07519
2 changed files with 56 additions and 55 deletions

View File

@ -22,54 +22,6 @@
});
};
ns.PublicPiskelController.prototype.getHeight = function () {
return this.piskelController.getHeight();
};
ns.PublicPiskelController.prototype.getWidth = function () {
return this.piskelController.getWidth();
};
ns.PublicPiskelController.prototype.getFPS = function () {
return this.piskelController.getFPS();
};
ns.PublicPiskelController.prototype.getLayers = function () {
return this.piskelController.getLayers();
};
ns.PublicPiskelController.prototype.getCurrentLayer = function () {
return this.piskelController.getCurrentLayer();
};
ns.PublicPiskelController.prototype.getCurrentLayerIndex = function () {
return this.piskelController.currentLayerIndex;
};
ns.PublicPiskelController.prototype.getLayerAt = function (index) {
return this.piskelController.getLayerAt(index);
};
ns.PublicPiskelController.prototype.getCurrentFrame = function () {
return this.piskelController.getCurrentFrame();
};
ns.PublicPiskelController.prototype.getCurrentFrameIndex = function () {
return this.piskelController.currentFrameIndex;
};
ns.PublicPiskelController.prototype.getPiskel = function () {
return this.piskelController.piskel;
};
ns.PublicPiskelController.prototype.getFrameAt = function (index) {
return this.piskelController.getFrameAt(index);
};
ns.PublicPiskelController.prototype.hasFrameAt = function (index) {
return this.piskelController.hasFrameAt(index);
};
ns.PublicPiskelController.prototype.addFrame = function () {
this.addFrameAt(this.piskelController.getFrameCount());
};
@ -173,6 +125,7 @@
type : 'CREATE_LAYER',
name : name
});
$.publish(Events.PISKEL_RESET);
};
ns.PublicPiskelController.prototype.moveLayerUp = function () {
@ -180,24 +133,75 @@
$.publish(Events.PISKEL_SAVE_STATE, {
type : 'LAYER_UP'
});
$.publish(Events.PISKEL_RESET);
};
ns.PublicPiskelController.prototype.moveLayerDown = function () {
this.piskelController.removeCurrentLayer();
this.piskelController.moveLayerDown();
$.publish(Events.PISKEL_SAVE_STATE, {
type : 'LAYER_DOWN'
});
$.publish(Events.PISKEL_RESET);
};
ns.PublicPiskelController.prototype.removeCurrentLayer = function () {
this.piskelController.moveLayerDown();
this.piskelController.removeCurrentLayer();
$.publish(Events.PISKEL_SAVE_STATE, {
type : 'REMOVE_LAYER'
});
$.publish(Events.PISKEL_RESET);
};
ns.PublicPiskelController.prototype.serialize = function (compressed) {
return this.piskelController.serialize(compressed);
};
ns.PublicPiskelController.prototype.getHeight = function () {
return this.piskelController.getHeight();
};
ns.PublicPiskelController.prototype.getWidth = function () {
return this.piskelController.getWidth();
};
ns.PublicPiskelController.prototype.getFPS = function () {
return this.piskelController.getFPS();
};
ns.PublicPiskelController.prototype.getLayers = function () {
return this.piskelController.getLayers();
};
ns.PublicPiskelController.prototype.getCurrentLayer = function () {
return this.piskelController.getCurrentLayer();
};
ns.PublicPiskelController.prototype.getCurrentLayerIndex = function () {
return this.piskelController.currentLayerIndex;
};
ns.PublicPiskelController.prototype.getLayerAt = function (index) {
return this.piskelController.getLayerAt(index);
};
ns.PublicPiskelController.prototype.getCurrentFrame = function () {
return this.piskelController.getCurrentFrame();
};
ns.PublicPiskelController.prototype.getCurrentFrameIndex = function () {
return this.piskelController.currentFrameIndex;
};
ns.PublicPiskelController.prototype.getPiskel = function () {
return this.piskelController.piskel;
};
ns.PublicPiskelController.prototype.getFrameAt = function (index) {
return this.piskelController.getFrameAt(index);
};
ns.PublicPiskelController.prototype.hasFrameAt = function (index) {
return this.piskelController.hasFrameAt(index);
};
})();

View File

@ -56,8 +56,6 @@
};
ns.HistoryService.prototype.loadState = function (index) {
$.unsubscribe(Events.PISKEL_SAVE_STATE, this.saveState__b);
// get nearest snaphot index
var snapshotIndex = -1;
for (var i = index ; i >= 0 ; i--) {
@ -92,7 +90,6 @@
var lastState = this.stateQueue[index];
this.setupState(lastState);
$.subscribe(Events.PISKEL_SAVE_STATE, this.saveState__b);
$.publish(Events.PISKEL_RESET);
};
@ -105,9 +102,9 @@
var descriptor = this.piskelController.piskel.getDescriptor();
pskl.utils.serialization.Deserializer.deserialize(piskel, function (piskel) {
piskel.setDescriptor(descriptor);
pskl.app.piskelController.setPiskel(piskel);
this.piskelController.setPiskel(piskel);
callback(piskel);
});
}.bind(this));
};
ns.HistoryService.prototype.replayState = function (state) {