Fixing remove and duplicate actions from previewfilm

This commit is contained in:
Vince 2012-09-08 19:00:03 +02:00
parent 6e8142bb3a
commit 2cda69b000
2 changed files with 8 additions and 1 deletions

View File

@ -178,6 +178,7 @@
canvasPreviewDuplicateAction.addEventListener('click', function(evt) { canvasPreviewDuplicateAction.addEventListener('click', function(evt) {
framesheet.duplicateFrameByIndex(tileNumber); framesheet.duplicateFrameByIndex(tileNumber);
$.publish(Events.LOCALSTORAGE_REQUEST); // Should come from model
$.publish('SET_ACTIVE_FRAME', [tileNumber + 1]); $.publish('SET_ACTIVE_FRAME', [tileNumber + 1]);
}); });
@ -197,7 +198,9 @@
canvasPreviewDeleteAction.className = "tile-action" canvasPreviewDeleteAction.className = "tile-action"
canvasPreviewDeleteAction.innerHTML = "del" canvasPreviewDeleteAction.innerHTML = "del"
canvasPreviewDeleteAction.addEventListener('click', function(evt) { 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); previewTileRoot.appendChild(canvasPreviewDeleteAction);
} }

View File

@ -80,6 +80,10 @@ $.namespace("pskl");
$.subscribe('SET_ACTIVE_FRAME', function(evt, frameId) { $.subscribe('SET_ACTIVE_FRAME', function(evt, frameId) {
piskel.setActiveFrameAndRedraw(frameId); piskel.setActiveFrameAndRedraw(frameId);
}); });
$.subscribe('FRAMESHEET_RESET', function(evt, frameId) {
piskel.redraw();
});
}, },
/** /**