diff --git a/index.html b/index.html index 4fa5c6b8..123dafbb 100644 --- a/index.html +++ b/index.html @@ -109,13 +109,10 @@ - - - - - + + diff --git a/js/piskel.js b/js/piskel.js index 3ebb6bc5..4ec3e406 100644 --- a/js/piskel.js +++ b/js/piskel.js @@ -66,8 +66,8 @@ $.namespace("pskl"); this.animationController.init(); this.previewsController.init(); - this.historyManager = new pskl.HistoryManager(frameSheet); - this.historyManager.init(); + this.historyService = new pskl.service.HistoryService(frameSheet); + this.historyService.init(); this.keyManager = new pskl.KeyManager(); diff --git a/js/HistoryManager.js b/js/service/HistoryService.js similarity index 62% rename from js/HistoryManager.js rename to js/service/HistoryService.js index e43c6157..a65815f2 100644 --- a/js/HistoryManager.js +++ b/js/service/HistoryService.js @@ -1,26 +1,26 @@ (function () { - var ns = $.namespace("pskl"); - ns.HistoryManager = function (framesheet) { + var ns = $.namespace("pskl.service"); + ns.HistoryService = function (framesheet) { this.framesheet = framesheet; }; - ns.HistoryManager.prototype.init = function () { + ns.HistoryService.prototype.init = function () { + $.subscribe(Events.TOOL_RELEASED, this.saveState.bind(this)); - $.subscribe(Events.UNDO, this.undo.bind(this)); $.subscribe(Events.REDO, this.redo.bind(this)); }; - ns.HistoryManager.prototype.saveState = function () { + ns.HistoryService.prototype.saveState = function () { this.framesheet.getCurrentFrame().saveState(); }; - ns.HistoryManager.prototype.undo = function () { + ns.HistoryService.prototype.undo = function () { this.framesheet.getCurrentFrame().loadPreviousState(); $.publish(Events.FRAMESHEET_RESET); }; - ns.HistoryManager.prototype.redo = function () { + ns.HistoryService.prototype.redo = function () { this.framesheet.getCurrentFrame().loadNextState(); $.publish(Events.FRAMESHEET_RESET); };