/// <summary> /// Handler for controller trigger up /// </summary> /// <param name="controllerId">Controller ID</param> /// <param name="triggerValue">Trigger Value (unused)</param> private void HandleTriggerUp(byte controllerId, float triggerValue) { if (_controllerConnectionHandler.IsControllerValid(controllerId)) { _isDragging = false; OnEndDrag?.Invoke(); } }
/// <param name="onBeginDrag"><see cref="OnBeginDrag"/></param> /// <param name="onContinueDrag"><see cref="OnContinueDrag"/></param> /// <param name="onEndDrag"><see cref="OnEndDrag"/></param> /// <param name="deadzone">drag will be triggered when mouse leaves /// this deadzone around the mousedown position</param> public DragDropHelper(OnBeginDrag onBeginDrag, OnContinueDrag onContinueDrag, OnEndDrag onEndDrag) { _inputManager = IoCManager.Resolve <IInputManager>(); _onBeginDrag = onBeginDrag; _onEndDrag = onEndDrag; _onContinueDrag = onContinueDrag; }
/// <param name="onBeginDrag"><see cref="OnBeginDrag"/></param> /// <param name="onContinueDrag"><see cref="OnContinueDrag"/></param> /// <param name="onEndDrag"><see cref="OnEndDrag"/></param> /// <param name="deadzone">drag will be triggered when mouse leaves /// this deadzone around the mousedown position</param> public DragDropHelper(OnBeginDrag onBeginDrag, OnContinueDrag onContinueDrag, OnEndDrag onEndDrag, float deadzone = DefaultDragDeadzone) { _deadzone = deadzone; _inputManager = IoCManager.Resolve <IInputManager>(); _onBeginDrag = onBeginDrag; _onEndDrag = onEndDrag; _onContinueDrag = onContinueDrag; }
void IPointerUpHandler.OnPointerUp(PointerEventData eventData) { start = Vector2.zero; current = Vector2.zero; delta = Vector2.zero; holding = false; if (OnEndDrag != null) { OnEndDrag.Invoke(); } }
private void EndDrag() { lineRenderer.enabled = false; lineRenderer.positionCount = 0; dragging = false; rb.velocity = Vector2.zero; rb.gravityScale = normalGravity; rb.AddForce(-direction, ForceMode2D.Impulse); AudioManager.Play(impulseSound); endDrag = false; OnEndDrag?.Invoke(); }
public static Result <bool> EndDrag(PointerEventData eventData) { if (currentDragModel == null) { throw new ArgumentException("Can not end drag, BeginDrag() was never called."); } var result = handler.EndDrag(currentDragModel, eventData); OnEndDrag?.Invoke(currentDragModel, eventData); Clean(); return(result); }
private void StopDragging() { SetPhysicsActive(true); OnEndDrag?.Invoke(this); }