コード例 #1
0
        public GestureHelper(UIElement uiElement, GestureMode gestureMode = GestureMode.UpDown)
        {
            Element     = uiElement;
            GestureMode = gestureMode;
            switch (gestureMode)
            {
            case GestureMode.All:
                Element.ManipulationMode = ManipulationModes.TranslateY |
                                           ManipulationModes.TranslateInertia |
                                           ManipulationModes.TranslateX |
                                           ManipulationModes.System;
                break;

            case GestureMode.LeftRight:
                Element.ManipulationMode = ManipulationModes.TranslateInertia |
                                           ManipulationModes.TranslateX |
                                           ManipulationModes.System;
                break;

            default:
            case GestureMode.UpDown:
                Element.ManipulationMode = ManipulationModes.TranslateY |
                                           ManipulationModes.TranslateInertia |
                                           ManipulationModes.System;
                break;
            }

            Element.ManipulationStarted   += UiManipulationStarted;
            Element.ManipulationDelta     += UiManipulationDelta;
            Element.ManipulationCompleted += UiManipulationCompleted;
        }
コード例 #2
0
 public void EnableZoomMode()
 {
     //UniversalPause = false;
     gestureMode = GestureMode.Zoom;
     btn_Rotate.GetComponent <Image>().color = Color.white;
     btn_Zoom.GetComponent <Image>().color   = Color.green;
     btn_Freeze.GetComponent <Image>().color = Color.white;
 }
コード例 #3
0
 public void PasueOrPlay()
 {
     UniversalPause = !UniversalPause;
     gestureMode    = GestureMode.Freeze;
     btn_Rotate.GetComponent <Image>().color = Color.white;
     btn_Zoom.GetComponent <Image>().color   = Color.white;
     btn_Freeze.GetComponent <Image>().color = Color.green;
 }
コード例 #4
0
ファイル: Gesture.cs プロジェクト: praveenv4k/indriya
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">Name of the gesture</param>
 /// <param name="mode">Mode of the gesture</param>
 public Gesture(string name, GestureMode mode)
 {
     //_currentLapse = 0;
     Name = name;
     Mode = mode;
     Active = false;
     Confidence = 0;
     Count = 0;
     Progress = 0;
     ConfidenceDict = new Dictionary<GestureConfidenceLevels, GestureConfidenceData>
     {
         {GestureConfidenceLevels.Low, new GestureConfidenceData(GestureConfidenceLevels.Low)},
         {GestureConfidenceLevels.Average, new GestureConfidenceData(GestureConfidenceLevels.Average)},
         {GestureConfidenceLevels.Good, new GestureConfidenceData(GestureConfidenceLevels.Good)},
         {GestureConfidenceLevels.Better, new GestureConfidenceData(GestureConfidenceLevels.Better)},
         {GestureConfidenceLevels.Best, new GestureConfidenceData(GestureConfidenceLevels.Best)},
     };
     _gestureSeries = new SeriesBuilder<long, int>();
 }
コード例 #5
0
        protected bool IsGesture(List <QuickHandGestureKey> gKeys, GestureMode gMode)
        {
            if (gKeys.Count == 0)
            {
                return(false);
            }

            bool isPressed = gKeys[0].IsPressed();

            for (int i = 1; i < gKeys.Count; i++)
            {
                if (gMode == GestureMode.AllKeys)
                {
                    isPressed &= gKeys[i].IsPressed();
                }
                else
                {
                    isPressed |= gKeys[i].IsPressed();
                }
            }

            return(isPressed);
        }
コード例 #6
0
        public override bool OnTouch(View v, MotionEvent e)
        {
            // double tap, pan, pinch, single tap features from android source code and MPChartAndroid

            bool handled = true;
            var  x       = e.GetX();
            var  y       = e.GetY();

            switch (e.ActionMasked)
            {
            case MotionEventActions.Down:
                touchEvent.state = tapEvent.state = TouchState.Begin;
                touchEvent.x     = tapEvent.x = x;
                touchEvent.y     = tapEvent.y = y;
                touchEvent.state = TouchState.Begin;
                if (lastState == GestureMode.None)
                {
                    alwaysInTapRegion = true;
                }
                OnTap(tapEvent);
                OnTouch(touchEvent);
                break;

            case MotionEventActions.Move:
                touchEvent.state = TouchState.Changed;
                touchEvent.x     = x;
                touchEvent.y     = y;
                OnTouch(touchEvent);
                if (lastState == GestureMode.None && touchEvent.mode == GestureMode.Rotate)
                {
                    DisableScroll(v);
                    // clear the tap action
                    alwaysInTapRegion = false;
                }
                lastState = touchEvent.mode;
                break;

            case MotionEventActions.PointerDown:
                alwaysInTapRegion = false;
                break;

            case MotionEventActions.Up:
                if (alwaysInTapRegion)
                {
                    handled = OnSingleTapUp(e);
                }
                else
                {
                    touchEvent.state = TouchState.Ended;
                    touchEvent.x     = x;
                    touchEvent.y     = y;
                    OnTouch(touchEvent);
                }
                touchEvent.mode = GestureMode.None;
                lastState       = GestureMode.None;
                EnableScroll(v);
                break;

            case MotionEventActions.Cancel:
                alwaysInTapRegion = false;
                break;
            }
            return(handled);
        }
コード例 #7
0
ファイル: MainPage.xaml.cs プロジェクト: bytetrail/Hexiverse
 private void ToolPalette_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     GestureMode newGestureMode;
     if (e.PropertyName == "SelectedTool")
         newGestureMode = (GestureMode)Enum.Parse(typeof(GestureMode), ToolPalette.SelectedTool);
     else
         return;
     // clear the active text block
     if (gestureMode == GestureMode.Text && newGestureMode != GestureMode.Text)
     {
         LabelTextBox.Visibility = Visibility.Collapsed;
         AddTextItem();
     }
     else
     {
         // get the current font
         activeTextFormat = new CanvasTextFormat();
         activeTextFormat.FontFamily = "Segeo UI";
         activeTextFormat.FontSize = 22.0F;
         mapView.TextFormat = activeTextFormat;
     }
     gestureMode = newGestureMode;
     if (gestureMode == GestureMode.Navigate)
     {
         MapCanvas.ManipulationMode = ManipulationModes.All;
         MapCanvas.PointerMoved -= MapCanvas_PointerMoved;
     }
     else
     {
         MapCanvas.ManipulationMode = ManipulationModes.None;
         MapCanvas.PointerMoved += MapCanvas_PointerMoved;
     }
 }