private void EnableDroppable(bool enable) { var el = jQuery.FromElement(GetElement()); if (enable) { el.Droppable(new DroppableOptions { Tolerance = "pointer", Greedy = true, OnOver = (_1, _2) => { itemHeight = (invisibleRoot.children.Count > 0 ? jQuery.FromElement(GetNodeElement(invisibleRoot.children[0]).Children[0]).GetOuterHeight() : 1); currentDropTarget = null; jQuery.Document.MouseMove(dragFeedbackHandler); }, OnOut = (_1, _2) => DragEnded(), OnDrop = Element_Drop }); } else ((DroppableObject)el).Destroy(); }
private void ChangeDropTarget(TreeDropTarget newTarget) { if ((newTarget == null && currentDropTarget == null) || (newTarget != null && currentDropTarget != null && newTarget.node == currentDropTarget.node && newTarget.above == currentDropTarget.above)) return; if (currentDropTarget != null) jQuery.FromElement(GetNodeElement(currentDropTarget.node).Children[0]).RemoveClass(DropIntoClass).RemoveClass(DropAboveClass); if (newTarget != null) jQuery.FromElement(GetNodeElement(newTarget.node).Children[0]).AddClass(newTarget.above ? DropAboveClass : DropIntoClass); currentDropTarget = newTarget; }