private void Drag(VIVE_Pointer pointer, List <RaycastResult> results) { pointer.pointerEventData.dragging = pointer.ButtonClick() && pointer.pointerEventData.delta != Vector2.zero; if (pointer.pointerEventData.pointerDrag) { if (pointer.pointerEventData.dragging) { if (IsHovering(pointer)) { ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.dragHandler); } } else { ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.dragHandler); ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.endDragHandler); foreach (RaycastResult raycast in results) { ExecuteEvents.ExecuteHierarchy(raycast.gameObject, pointer.pointerEventData, ExecuteEvents.dropHandler); } pointer.pointerEventData.pointerDrag = null; } } else if (pointer.pointerEventData.dragging) { foreach (var result in results) { ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.initializePotentialDrag); ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.beginDragHandler); var target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.dragHandler); if (target != null) { pointer.pointerEventData.pointerDrag = target; break; } } } }
private void Click(VIVE_Pointer pointer, List <RaycastResult> results) { pointer.pointerEventData.eligibleForClick = pointer.ButtonClick(); if (pointer.pointerEventData.pointerPress) { if (pointer.pointerEventData.eligibleForClick) { if (!IsHovering(pointer)) { ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerUpHandler); pointer.pointerEventData.pointerPress = null; } } else { ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerClickHandler); ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerUpHandler); pointer.pointerEventData.pointerPress = null; } } else if (pointer.pointerEventData.eligibleForClick) { foreach (var result in results) { var target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.pointerDownHandler); if (target != null) { pointer.pointerEventData.pressPosition = pointer.pointerEventData.position; pointer.pointerEventData.pointerPressRaycast = result; pointer.pointerEventData.pointerPress = target; break; } } } }