list-dragon
Advanced tools
Comparing version 1.3.2 to 1.3.3
17
index.js
// list-dragon node module | ||
// https://github.com/openfin/list-dragon | ||
// https://github.com/joneit/list-dragon | ||
@@ -431,6 +431,17 @@ /* eslint-env node, browser */ | ||
var model = dragon.modelLists[dragon.origin.list].splice(dragon.origin.item, 1)[0]; | ||
var originList = dragon.modelLists[dragon.origin.list]; | ||
var model = originList.splice(dragon.origin.item, 1)[0]; | ||
var destination = dragon.itemCoordinates(this); | ||
dragon.modelLists[destination.list].splice(destination.item, 0, model); | ||
var destinationList = dragon.modelLists[destination.list]; | ||
var interListDrop = originList !== destinationList; | ||
var listChanged = interListDrop || dragon.origin.item !== destination.item; | ||
destinationList.splice(destination.item, 0, model); | ||
if (listChanged) { | ||
originList.element.dispatchEvent(new CustomEvent('listchanged')); | ||
if (interListDrop) { | ||
destinationList.element.dispatchEvent(new CustomEvent('listchanged')); | ||
} | ||
} | ||
if (dragon.callback.dropped) { | ||
@@ -437,0 +448,0 @@ dragon.callback.dropped.call(this, dragon); |
{ | ||
"name": "list-dragon", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"main": "./index.js", | ||
@@ -5,0 +5,0 @@ "description": "Drag and drop items between lists.", |
26266
499