public static bool TryRemoveItem(DragDropItem item, DragDropTarget target) { if (item.attachedTarget == target && target.HasItemAttached(item)) { DragDropEventData eventData = new DragDropEventData(); eventData.Reset(); eventData.external = true; eventData.target = target; eventData.item = item; target.OnItemDetach(eventData); item.OnItemDetach(eventData); target.OnItemExit(eventData); item.OnItemExit(eventData); item.OnSetFree(eventData); return(true); } else { return(false); } }
public static bool TryRemoveItem(DragDropItem item, DragDropTarget target, bool sendCallback = true) { if (item == null || target == null) { return(false); } if (item.attachedTarget == target && target.HasItemAttached(item)) { DragDropEventData eventData = new DragDropEventData(!sendCallback); eventData.Reset(); eventData.target = target; eventData.item = item; target.OnItemDetach(eventData); item.OnItemDetach(eventData); item.OnSetFree(eventData); return(true); } else { return(false); } }