void IMixedRealityPointerHandler.OnPointerDragged(MixedRealityPointerEventData eventData)
 {
     if (!eventData.used)
     {
         OnPointerDragged.Invoke(eventData);
         if (MarkEventsAsUsed)
         {
             eventData.Use();
         }
     }
 }
 void IMixedRealityPointerHandler.OnPointerDown(MixedRealityPointerEventData eventData)
 {
     Debug.Log("Pointer down event " + eventData);
     if (!eventData.used)
     {
         OnPointerDown.Invoke(eventData);
         if (MarkEventsAsUsed)
         {
             eventData.Use();
         }
     }
 }
Ejemplo n.º 3
0
        void IMixedRealityPointerHandler.OnPointerUp(MixedRealityPointerEventData eventData)
        {
            if (!isDraggingEnabled || !isDragging || eventData.MixedRealityInputAction != dragAction || eventData.SourceId != currentInputSource?.SourceId)
            {
                // If we're not handling drag input or we're not releasing the right action, don't try to end a drag operation.
                return;
            }

            eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.

            StopDragging();
        }
Ejemplo n.º 4
0
        void IMixedRealityPointerHandler.OnPointerDown(MixedRealityPointerEventData eventData)
        {
            if (!isDraggingEnabled || isDragging || eventData.MixedRealityInputAction != dragAction)
            {
                // If we're already handling drag input or we're not grabbing, don't start a new drag operation.
                return;
            }

            eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.

            currentInputSource = eventData.InputSource;
            currentPointer     = eventData.Pointer;

            FocusDetails focusDetails;
            Vector3      initialDraggingPosition = MixedRealityToolkit.InputSystem.FocusProvider.TryGetFocusDetails(currentPointer, out focusDetails)
                    ? focusDetails.Point
                    : hostTransform.position;

            isDraggingWithSourcePose = currentPointer == MixedRealityToolkit.InputSystem.GazeProvider.GazePointer;

            StartDragging(initialDraggingPosition);
        }