Merge pull request #57 from grosbouddha/fix-dnd-canvas

Fixing DnD when dragging from canvas elements
This commit is contained in:
Vincent 2012-09-08 07:58:24 -07:00
commit bcd8cf07e6

View File

@ -92,7 +92,10 @@
*/
ns.PreviewFilmController.prototype.onDrop_ = function( event, ui ) {
var activeFrame;
var originFrameId = parseInt($(event.srcElement).data("tile-number"), 10);
// When we drag from an element, the drag could start from a nested DOM element
// inside the drag target. We normalize that by taking the correct ancestor:
var originTile = $(event.srcElement).closest(".preview-tile");
var originFrameId = parseInt(originTile.data("tile-number"), 10);
var dropTarget = $(event.target);
if(dropTarget.data("tile-type") == "interstitial") {
@ -101,7 +104,7 @@
if(isNaN(originFrameId) || isNaN(targetInsertionId)) {
return;
}
console.log("origin-frame: "+originFrameId+" - targetInsertionId: "+ targetInsertionId)
//console.log("origin-frame: "+originFrameId+" - targetInsertionId: "+ targetInsertionId)
this.framesheet.moveFrame(originFrameId, targetInsertionId);
activeFrame = targetInsertionId;
@ -119,7 +122,7 @@
if(isNaN(originFrameId) || isNaN(targetSwapId)) {
return;
}
console.log("origin-frame: "+originFrameId+" - targetSwapId: "+ targetSwapId)
//console.log("origin-frame: "+originFrameId+" - targetSwapId: "+ targetSwapId)
this.framesheet.swapFrames(originFrameId, targetSwapId);
activeFrame = targetSwapId;
}