mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Merge pull request #57 from grosbouddha/fix-dnd-canvas
Fixing DnD when dragging from canvas elements
This commit is contained in:
commit
bcd8cf07e6
@ -92,7 +92,10 @@
|
|||||||
*/
|
*/
|
||||||
ns.PreviewFilmController.prototype.onDrop_ = function( event, ui ) {
|
ns.PreviewFilmController.prototype.onDrop_ = function( event, ui ) {
|
||||||
var activeFrame;
|
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);
|
var dropTarget = $(event.target);
|
||||||
|
|
||||||
if(dropTarget.data("tile-type") == "interstitial") {
|
if(dropTarget.data("tile-type") == "interstitial") {
|
||||||
@ -101,7 +104,7 @@
|
|||||||
if(isNaN(originFrameId) || isNaN(targetInsertionId)) {
|
if(isNaN(originFrameId) || isNaN(targetInsertionId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("origin-frame: "+originFrameId+" - targetInsertionId: "+ targetInsertionId)
|
//console.log("origin-frame: "+originFrameId+" - targetInsertionId: "+ targetInsertionId)
|
||||||
this.framesheet.moveFrame(originFrameId, targetInsertionId);
|
this.framesheet.moveFrame(originFrameId, targetInsertionId);
|
||||||
|
|
||||||
activeFrame = targetInsertionId;
|
activeFrame = targetInsertionId;
|
||||||
@ -119,7 +122,7 @@
|
|||||||
if(isNaN(originFrameId) || isNaN(targetSwapId)) {
|
if(isNaN(originFrameId) || isNaN(targetSwapId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("origin-frame: "+originFrameId+" - targetSwapId: "+ targetSwapId)
|
//console.log("origin-frame: "+originFrameId+" - targetSwapId: "+ targetSwapId)
|
||||||
this.framesheet.swapFrames(originFrameId, targetSwapId);
|
this.framesheet.swapFrames(originFrameId, targetSwapId);
|
||||||
activeFrame = targetSwapId;
|
activeFrame = targetSwapId;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user