Пример #1
0
 public void gestureOccurs(GestureEvent e)
 {
     if (lookup.ContainsKey(e.GetType()))
     {
         WindowsInput.VirtualKeyCode ekey = lookup[e.GetType()];
         //InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.RMENU, ekey);
         InputSimulator.SimulateKeyPress(ekey);
     }
 }
Пример #2
0
        private void HandleGestureEvent(ARFrame arFrame, ARCamera arCamera, float[] projectionMatrix, float[] viewMatrix)
        {
            GestureEvent mEvent = mQueuedSingleTaps.Poll().JavaCast <GestureEvent>();

            if (mEvent == null)
            {
                return;
            }

            // Do not perform anything when the object is not tracked.
            if (arCamera.TrackingState != ARTrackableTrackingState.Tracking)
            {
                return;
            }
            int eventType = mEvent.GetType();

            switch (eventType)
            {
            case GestureEvent.GESTURE_EVENT_TYPE_DOUBLETAP:
                DoWhenEventTypeDoubleTap(viewMatrix, projectionMatrix, mEvent);
                break;

            case GestureEvent.GESTURE_EVENT_TYPE_SCROLL:
            {
                if (mSelectedObj == null)
                {
                    break;
                }
                ARHitResult hitResult = HitTest4Result(arFrame, arCamera, mEvent.GetEventSecond());
                if (hitResult != null)
                {
                    mSelectedObj.SetAnchor(hitResult.CreateAnchor());
                }
                break;
            }

            case GestureEvent.GESTURE_EVENT_TYPE_SINGLETAPCONFIRMED:
            {
                // Do not perform anything when an object is selected.
                if (mSelectedObj != null)
                {
                    mSelectedObj.SetIsSelected(false);
                    mSelectedObj = null;
                }
                MotionEvent tap       = mEvent.GetEventFirst();
                ARHitResult hitResult = null;

                hitResult = HitTest4Result(arFrame, arCamera, tap);

                if (hitResult == null)
                {
                    break;
                }
                DoWhenEventTypeSingleTap(hitResult);
                break;
            }

            default:
                Log.Info(TAG, "Unknown motion event type, and do nothing.");
                break;
            }
        }