protected override void DragEnd(InteractiveHandle target, DragEndInfo info) { if (target != ownerHandle) { return; } if (translationEnded != null) { translationEnded.Invoke(new TranslationEndInfo( //World new TranslationInfo( m_InitialPosWorld, Vector3.zero, m_TotalTranslation, Vector3.zero), //Local new TranslationInfo( m_InitialPosLocal, Vector3.zero, Quaternion.Inverse(transform.rotation) * m_TotalTranslation, Vector3.zero))); } m_CurrentDirection = Vector3.zero; m_TotalTranslation = Vector3.zero; OnTranslationEnd(info.translation); }
public bool StopDrag() { if (m_State != State.Dragging) { return(false); } var eventData = new DragEndInfo(new DragTranslation( m_StartDragPosition, m_LastFramePosition, Vector3.zero)); foreach (var behaviour in TakeSnapshot(m_Context.GetHandleBehaviours())) { if (behaviour == null) { continue; } behaviour.DoDragEnd(m_ActiveHandle, eventData); } m_State = State.Hovering; if (m_HoverHandle != m_ActiveHandle) { SetHovered(m_HoverHandle); } return(true); }
protected override void DragEnd(InteractiveHandle target, DragEndInfo info) { if (target != ownerHandle) { return; } var worldToLocalRotation = transform.worldToLocalMatrix.rotation; if (rotationEnded != null) { rotationEnded.Invoke(new RotationEndInfo( new RotationInfo( // World m_TotalAngle, 0, m_Normal), new RotationInfo( // Local m_TotalAngle, 0, worldToLocalRotation * m_Normal))); } }