public void OnEndDrag(PointerEventData eventData) { if (FindDragging(eventData.pointerId) == this) { dragging.Remove(this); this.pointerId = int.MinValue; if (IsHoveringOver == null) { if (!HasDropped) { foreach (var h in failedDropHandlers) { h.OnFailedDrop(); } } } else { DropOn(IsHoveringOver); } foreach (var h in moveableHandlers) { h.OnMoveEnd(eventData.position); } OnDragEnded.Invoke(this); } dragging.Remove(this); }
public void OnBeginDrag(PointerEventData eventData) { if (FindDragging(eventData.pointerId) == null && CanDrag(eventData)) { dragging.Add(this); this.pointerId = eventData.pointerId; IsHoveringOver = null; HasDropped = false; foreach (var h in moveableHandlers) { h.OnMoveBegin(eventData.position); } foreach (var h in startDragHandlers) { h.OnDragBegin(); } OnDragBegun.Invoke(this); } }