this._list = list; this.bringToFront(); this.setX(xpos); this.setY(ypos); this.setWidth(itemwidth); this.datapath.setPointer(datanode); this._depth = depth; this._gm = new LzDelegate(this, "cancelFloater", LzGlobalMouse, "onmouseup"); this.setVisible(true); this.dragger.apply(); return this.getAttributeRelative("y", canvas) + this.getAttribute("height"); = i_top && reference_y <= i_bottom) { to = priority; drop_path = item.datapath; break; } } // get a reference to the dataset var dp = this.datapath.getDataset().getPointer(); // advance the pointer to the first child for (var i = 0; i < this._depth; i++) { dp.selectChild(); } // the node is being moved within the existing items var new_node = null; if (drop_path != null) { new_node = dp.p.insertBefore(this.datapath.p.cloneNode(), drop_path.p); this.datapath.deleteNode(); } else { // check if the drop was under the lowest node if (null == drop_path && reference_y > max_y) { to = parseInt(max_priority)+1; new_node = dp.addNodeFromPointer(this.datapath).p; this.datapath.deleteNode(); } } // if the drop matched, use the priority of the target node if (to != -1 && new_node != null) { // get the priority of the dragged node var from = this.datapath.getNodeAttribute("priority"); // and if it's different from the drop target's priority, // perform the reordering, also don't drop on the next sibling // node since that's a no-op if (from != to && from != to - 1) { var pn = this.datapath.p.parentNode; // make up a space in the priority series var child = pn.getFirstChild(); while (child) { if (child.hasAttr("priority")) { priority = parseInt(child.getAttr("priority")); if (priority >= to) { child.setAttr("priority", priority+1); } } child = child.getNextSibling(); } // set the priority of the moved item new_node.setAttr("priority", to); // redo the priority var priority = 0; var child = pn.getFirstChild(); while (child) { if (child.hasAttr("priority")) { priority = parseInt(child.getAttr("priority")); if (priority > from) { child.setAttr("priority", priority-1); } } child = child.getNextSibling(); } dropped(from, to); } } ]]>