Drag and drop functionality vastly improved in usability.
This commit is contained in:
parent
ef548cbfee
commit
6720ce5efb
1 changed files with 7 additions and 23 deletions
|
|
@ -5,6 +5,8 @@ var Dom = YAHOO.util.Dom;
|
||||||
var Event = YAHOO.util.Event;
|
var Event = YAHOO.util.Event;
|
||||||
var DDM = YAHOO.util.DragDropMgr;
|
var DDM = YAHOO.util.DragDropMgr;
|
||||||
|
|
||||||
|
var currentDest;
|
||||||
|
|
||||||
Survey.DDList = function(id, sGroup, config) {
|
Survey.DDList = function(id, sGroup, config) {
|
||||||
|
|
||||||
Survey.DDList.superclass.constructor.call(this, id, sGroup, config);
|
Survey.DDList.superclass.constructor.call(this, id, sGroup, config);
|
||||||
|
|
@ -61,30 +63,10 @@ YAHOO.extend(Survey.DDList, YAHOO.util.DDProxy, {
|
||||||
a.animate();
|
a.animate();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onInvalidDrop: function(e, id) {
|
||||||
|
Survey.Data.dragDrop(this.getEl());
|
||||||
|
},
|
||||||
onDragDrop: function(e, id) {
|
onDragDrop: function(e, id) {
|
||||||
|
|
||||||
// If there is one drop interaction, the li was dropped either on the list,
|
|
||||||
// or it was dropped on the current location of the source element.
|
|
||||||
if (DDM.interactionInfo.drop.length === 1) {
|
|
||||||
|
|
||||||
// The position of the cursor at the time of the drop (YAHOO.util.Point)
|
|
||||||
var pt = DDM.interactionInfo.point;
|
|
||||||
|
|
||||||
// The region occupied by the source element at the time of the drop
|
|
||||||
var region = DDM.interactionInfo.sourceRegion;
|
|
||||||
|
|
||||||
// Check to see if we are over the source element's location. We will
|
|
||||||
// append to the bottom of the list once we are sure it was a drop in
|
|
||||||
// the negative space (the area of the list without any list items)
|
|
||||||
if (!region.intersect(pt)) {
|
|
||||||
var destEl = Dom.get(id);
|
|
||||||
var destDD = DDM.getDDById(id);
|
|
||||||
destEl.appendChild(this.getEl());
|
|
||||||
destDD.isEmpty = false;
|
|
||||||
DDM.refreshCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Survey.Data.dragDrop(this.getEl());
|
Survey.Data.dragDrop(this.getEl());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -110,6 +92,8 @@ YAHOO.extend(Survey.DDList, YAHOO.util.DDProxy, {
|
||||||
// We are only concerned with list items, we ignore the dragover
|
// We are only concerned with list items, we ignore the dragover
|
||||||
// notifications for the list.
|
// notifications for the list.
|
||||||
if (destEl.nodeName.toLowerCase() == "li") {
|
if (destEl.nodeName.toLowerCase() == "li") {
|
||||||
|
currentDest = destEl;
|
||||||
|
console.log(destEl);
|
||||||
var orig_p = srcEl.parentNode;
|
var orig_p = srcEl.parentNode;
|
||||||
var p = destEl.parentNode;
|
var p = destEl.parentNode;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue