mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Move HistoryManager to a service
This commit is contained in:
parent
b8eb3c9bd9
commit
7d529aeaaa
@ -109,13 +109,10 @@
|
||||
<script src="js/controller/ToolController.js"></script>
|
||||
<script src="js/Palette.js"></script>
|
||||
<script src="js/Notification.js"></script>
|
||||
|
||||
<!-- Services -->
|
||||
<script src="js/service/LocalStorageService.js"></script>
|
||||
<script src="js/HistoryManager.js"></script>
|
||||
<script src="js/service/HistoryService.js"></script>
|
||||
<script src="js/KeyManager.js"></script>
|
||||
|
||||
|
||||
<!-- Tools-->
|
||||
<script src="js/drawingtools/BaseTool.js"></script>
|
||||
<script src="js/drawingtools/SimplePen.js"></script>
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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 () {
|
||||
$.subscribe(Events.TOOL_RELEASED, this.saveState.bind(this));
|
||||
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);
|
||||
};
|
Loading…
Reference in New Issue
Block a user