From 2cda69b000e0819890f7845aa1212e89989592ca Mon Sep 17 00:00:00 2001 From: Vince Date: Sat, 8 Sep 2012 19:00:03 +0200 Subject: [PATCH] Fixing remove and duplicate actions from previewfilm --- js/controller/PreviewFilmController.js | 5 ++++- js/piskel.js | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/js/controller/PreviewFilmController.js b/js/controller/PreviewFilmController.js index 12710341..7db43364 100644 --- a/js/controller/PreviewFilmController.js +++ b/js/controller/PreviewFilmController.js @@ -178,6 +178,7 @@ canvasPreviewDuplicateAction.addEventListener('click', function(evt) { framesheet.duplicateFrameByIndex(tileNumber); + $.publish(Events.LOCALSTORAGE_REQUEST); // Should come from model $.publish('SET_ACTIVE_FRAME', [tileNumber + 1]); }); @@ -197,7 +198,9 @@ canvasPreviewDeleteAction.className = "tile-action" canvasPreviewDeleteAction.innerHTML = "del" canvasPreviewDeleteAction.addEventListener('click', function(evt) { - piskel.removeFrame(tileNumber); + framesheet.removeFrameByIndex(tileNumber); + $.publish(Events.FRAMESHEET_RESET); + $.publish(Events.LOCALSTORAGE_REQUEST); // Should come from model }); previewTileRoot.appendChild(canvasPreviewDeleteAction); } diff --git a/js/piskel.js b/js/piskel.js index fde522b4..157a4673 100644 --- a/js/piskel.js +++ b/js/piskel.js @@ -80,6 +80,10 @@ $.namespace("pskl"); $.subscribe('SET_ACTIVE_FRAME', function(evt, frameId) { piskel.setActiveFrameAndRedraw(frameId); }); + + $.subscribe('FRAMESHEET_RESET', function(evt, frameId) { + piskel.redraw(); + }); }, /**