Exemplo n.º 1
0
        private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
        {
            if (e.PanGesture.State == Gesture.StateType.Started)
            {
                mLayout.StopScroll(true);
            }
            else if (e.PanGesture.State == Gesture.StateType.Continuing)
            {
                if (mLayout.CanScrollVertically())
                {
                    mLayout.ScrollVerticallyBy(e.PanGesture.Displacement.Y, mRecycler, true);
                }
                else if (mLayout.CanScrollHorizontally())
                {
                    mLayout.ScrollHorizontallyBy(e.PanGesture.Displacement.X, mRecycler, true);
                }

                ShowScrollBar();
            }
            else if (e.PanGesture.State == Gesture.StateType.Finished)
            {
                if (mLayout.CanScrollVertically())
                {
                    mLayout.ScrollVerticallyBy(e.PanGesture.Velocity.Y * 600, mRecycler, false);
                }
                else if (mLayout.CanScrollHorizontally())
                {
                    mLayout.ScrollHorizontallyBy(e.PanGesture.Velocity.X * 600, mRecycler, false);
                }
                ShowScrollBar(1200, true);
            }
        }
Exemplo n.º 2
0
        private void PanDetector_Detected(object source, PanGestureDetector.DetectedEventArgs e)
        {
            if (mode == Mode.EditMode)
            {
                return;
            }
            switch (e.PanGesture.State)
            {
            case Gesture.StateType.Finished:
            {
                int mouse_nextX = (int)e.PanGesture.ScreenPosition.X;
                int distance    = mouse_nextX - panScreenPosition;
                if (distance > DRAG_DISTANCE)
                {
                    rotarySelectorManager.NextPage();
                }
                else if (distance < -DRAG_DISTANCE)
                {
                    rotarySelectorManager.PrevPage();
                }

                panScreenPosition = 0;
                break;
            }

            case Gesture.StateType.Continuing:
                break;

            case Gesture.StateType.Started:
            {
                panScreenPosition = (int)e.PanGesture.ScreenPosition.X;
                break;
            }
            }
        }
Exemplo n.º 3
0
        private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
        {
            switch (e.PanGesture.State)
            {
            case Gesture.StateType.Finished:
            {
                if (e.PanGesture.Velocity.Y > 0)
                {
                    EventAction(Action.ShowList);
                }
                else if (e.PanGesture.Velocity.Y < 0)
                {
                    EventAction(Action.ShowContent);
                }

                if (e.PanGesture.Velocity.X > 0)
                {
                    EventAction(Action.ScrollRight);
                }
                else if (e.PanGesture.Velocity.X < 0)
                {
                    EventAction(Action.ScrollLeft);
                }
            }
            break;

            case Gesture.StateType.Continuing:
            case Gesture.StateType.Started:
            {
                // fall through
            }
            break;
            }
        }
Exemplo n.º 4
0
        private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
        {
            if (e.PanGesture.State == Gesture.StateType.Started)
            {
                if (direction == DirectionType.Horizontal)
                {
                    currentSlidedOffset = slidedTrackImage.SizeWidth;
                }
                else if (direction == DirectionType.Vertical)
                {
                    currentSlidedOffset = slidedTrackImage.SizeHeight;
                }

                if (isValueShown)
                {
                    valueIndicatorImage.Show();
                }

                if (null != sliderSlidingStartedHandler)
                {
                    SliderSlidingStartedEventArgs args = new SliderSlidingStartedEventArgs();
                    args.CurrentValue = curValue;
                    sliderSlidingStartedHandler(this, args);
                }
                UpdateState(isFocused, true);
            }

            if (e.PanGesture.State == Gesture.StateType.Continuing || e.PanGesture.State == Gesture.StateType.Started)
            {
                if (direction == DirectionType.Horizontal)
                {
                    CalculateCurrentValueByGesture(e.PanGesture.Displacement.X);
                }
                else if (direction == DirectionType.Vertical)
                {
                    CalculateCurrentValueByGesture(-e.PanGesture.Displacement.Y);
                }
                UpdateState(isFocused, true);
                UpdateValue();
            }

            if (e.PanGesture.State == Gesture.StateType.Finished)
            {
                if (isValueShown)
                {
                    valueIndicatorImage.Hide();
                }

                if (null != sliderSlidingFinishedHandler)
                {
                    SliderSlidingFinishedEventArgs args = new SliderSlidingFinishedEventArgs();
                    args.CurrentValue = curValue;
                    sliderSlidingFinishedHandler(this, args);
                }

                UpdateState(isFocused, false);
            }
        }
Exemplo n.º 5
0
        private void OnDetected(object obj, PanGestureDetector.DetectedEventArgs e)
        {
            View v1 = e.View;

            e.View = v1;

            PanGesture p1 = e.PanGesture;

            e.PanGesture = p1;
        }
Exemplo n.º 6
0
        private void OnDetected(object obj, PanGestureDetector.DetectedEventArgs e)
        {
            View view = e.View;

            e.View = view;

            PanGesture gesture = e.PanGesture;

            e.PanGesture = gesture;

            tlog.Debug(tag, "Handled : " + e.Handled);
        }
Exemplo n.º 7
0
        private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
        {
            if (e.PanGesture.State == Gesture.StateType.Started)
            {
                Add(mInterruptTouchingChild);
                Debug.WriteLineIf(LayoutDebugScrollableBase, "Gesture Start");
                if (scrolling && !SnapToPage)
                {
                    StopScroll();
                }
                maxScrollDistance = CalculateMaximumScrollDistance();
                totalDisplacementForPan = 0.0f;
                OnScrollDragStart();
            }
            else if (e.PanGesture.State == Gesture.StateType.Continuing)
            {
                if (ScrollingDirection == Direction.Horizontal)
                {
                    ScrollBy(e.PanGesture.Displacement.X, false);
                    totalDisplacementForPan += e.PanGesture.Displacement.X;
                }
                else
                {
                    ScrollBy(e.PanGesture.Displacement.Y, false);
                    totalDisplacementForPan += e.PanGesture.Displacement.Y;
                }
                Debug.WriteLineIf(LayoutDebugScrollableBase, "OnPanGestureDetected Continue totalDisplacementForPan:" + totalDisplacementForPan);
            }
            else if (e.PanGesture.State == Gesture.StateType.Finished)
            {
                float axisVelocity = (ScrollingDirection == Direction.Horizontal) ? e.PanGesture.Velocity.X : e.PanGesture.Velocity.Y;
                float flickDisplacement = CalculateDisplacementFromVelocity(axisVelocity);

                Debug.WriteLineIf(LayoutDebugScrollableBase, "FlickDisplacement:" + flickDisplacement + "TotalDisplacementForPan:" + totalDisplacementForPan);
                OnScrollDragEnd();

                if (flickDisplacement > 0 | flickDisplacement < 0)// Flick detected
                {
                    Flick(flickDisplacement);
                }
                else
                {
                    // End of panning gesture but was not a flick
                    if (SnapToPage)
                    {
                        PageSnap();
                    }
                }
                totalDisplacementForPan = 0;

                Remove(mInterruptTouchingChild);
            }
        }
Exemplo n.º 8
0
        private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
        {
            Tizen.Log.Debug("rkdehdrud", $"state is {e.PanGesture.State}");
            Tizen.Log.Debug("rkdehdrud", $"X is {e.PanGesture.Displacement.X}");
            Tizen.Log.Debug("rkdehdrud", $"Y is {e.PanGesture.Displacement.Y}");

            if (focusedView == e.View)
            {
                e.View.PositionX += e.PanGesture.Displacement.X;
                e.View.PositionY += e.PanGesture.Displacement.Y;
            }
        }
Exemplo n.º 9
0
        private void PanDetector_Detected(object source, PanGestureDetector.DetectedEventArgs e)
        {
            RotaryTouchController controller = rotarySelectorManager.GetRotaryTouchController();

            if (mode == Mode.EditMode && controller.SelectedItem != null)
            {
                panScreenPosition = 0;
                rotarySelectorManager.IsPaging = false;
                return;
            }

            if (controller.IsProcessing || rotarySelectorManager.isAnimating() || !rotarySelectorManager.isDetector())
            {
                panScreenPosition = 0;
                rotarySelectorManager.IsPaging = false;
                rotarySelectorManager.SetPanDetector();
                return;
            }
            switch (e.PanGesture.State)
            {
            case Gesture.StateType.Finished:
            {
                int mouse_nextX = (int)e.PanGesture.ScreenPosition.X;
                int distance    = mouse_nextX - panScreenPosition;
                if (distance > DRAG_DISTANCE)
                {
                    rotarySelectorManager.NextPage();
                }
                else if (distance < -DRAG_DISTANCE)
                {
                    rotarySelectorManager.PrevPage();
                }

                panScreenPosition = 0;
                rotarySelectorManager.IsPaging = false;
                break;
            }

            case Gesture.StateType.Continuing:

                break;

            case Gesture.StateType.Started:
            {
                rotarySelectorManager.IsPaging = true;
                panScreenPosition = (int)e.PanGesture.ScreenPosition.X;
                break;
            }
            }
        }
Exemplo n.º 10
0
        private void PanDetector_Detected(object source, PanGestureDetector.DetectedEventArgs e)
        {
            int mouse_nextX = (int)e.PanGesture.ScreenPosition.X;
            int distance    = mouse_nextX - firstScreenPosition;
            int panning     = mouse_nextX - panScreenPosition;

            switch (e.PanGesture.State)
            {
            case Gesture.StateType.Finished:
            {
                blockTouchView.Unparent();
                if (distance > TOUCH_RANGE)
                {
                    Prev();
                }
                else if (distance < -TOUCH_RANGE)
                {
                    Next();
                }
                else
                {
                    layoutManager.CancelPage(this);
                }
                break;
            }

            case Gesture.StateType.Continuing:
            {
                if (thisMode != Mode.WIDGET_LAST && panning < 0)
                {
                    layoutManager.DragPage(this, panning);
                }
                else if (thisMode != Mode.NOITIFY_LAST && panning > 0)
                {
                    layoutManager.DragPage(this, panning);
                }
                panScreenPosition = mouse_nextX;
                break;
            }

            case Gesture.StateType.Started:
            {
                this.Add(blockTouchView);
                panScreenPosition   = (int)e.PanGesture.ScreenPosition.X;
                firstScreenPosition = panScreenPosition;
                break;
            }
            }
        }
Exemplo n.º 11
0
        public void PanGestureDetectorDetected()
        {
            tlog.Debug(tag, $"PanGestureDetectorDetected START");
            PanGestureDetector a1 = new PanGestureDetector();

            a1.Detected += OnDetected;
            a1.Detected -= OnDetected;

            PanGestureDetector.DetectedEventArgs e = new PanGestureDetector.DetectedEventArgs();
            object o = new object();

            OnDetected(o, e);

            a1.Dispose();

            tlog.Debug(tag, $"PanGestureDetectorDetected END (OK)");
            Assert.Pass("PanGestureDetectorDetected");
        }
Exemplo n.º 12
0
        private void PanDetector_Detected(object source, PanGestureDetector.DetectedEventArgs e)
        {
            int mouse_nextX = (int)e.PanGesture.ScreenPosition.X;
            int distance    = mouse_nextX - firstScreenPosition;

            switch (e.PanGesture.State)
            {
            case Gesture.StateType.Finished:
            {
                isAnimateProcessing = true;

                if (distance > TOUCH_RANGE)
                {
                    Prev();
                }
                else if (distance < -TOUCH_RANGE)
                {
                    Next();
                }
                else
                {
                    layoutManager.CancelPage(this);
                }
                break;
            }

            case Gesture.StateType.Continuing:
            {
                isPagingProcessing = true;
                layoutManager.DragPage(this, mouse_nextX - panScreenPosition);
                panScreenPosition = mouse_nextX;
                break;
            }

            case Gesture.StateType.Started:
            {
                panScreenPosition   = (int)e.PanGesture.ScreenPosition.X;
                firstScreenPosition = panScreenPosition;
                break;
            }
            }
        }
Exemplo n.º 13
0
        private void OnPanGesture(object sender, PanGestureDetector.DetectedEventArgs gesture)
        {
            // does not response when the transition has not finished
            if (mIsImageLoading || mCubeWaveEffect.IsTransitioning() || mCubeCrossEffect.IsTransitioning() || mCubeFoldEffect.IsTransitioning() || mSlideshow)
            {
                return;
            }

            if (gesture.PanGesture.State == Gesture.StateType.Continuing)
            {
                if (gesture.PanGesture.Displacement.X < 0)
                {
                    mIndex = (mIndex + 1) % NUM_IMAGES;
                }
                else
                {
                    mIndex = (mIndex + NUM_IMAGES - 1) % NUM_IMAGES;
                }

                mPanPosition     = gesture.PanGesture.Position;
                mPanDisplacement = gesture.PanGesture.Displacement;
                GoToNextImage();
            }
        }
Exemplo n.º 14
0
 private void OnDetected(object obj, PanGestureDetector.DetectedEventArgs e)
 {
 }
Exemplo n.º 15
0
 public override void OnPan(object sender, PanGestureDetector.DetectedEventArgs e, object userData)
 {
     Tizen.Log.Error("NUI", $"OnPan \n");
 }
Exemplo n.º 16
0
 private void InternalOnPan(object sender, PanGestureDetector.DetectedEventArgs e)
 {
     mListener.OnPan(sender, e, mUserData);
     mPanGestureDetector.Detected -= InternalOnPan;
 }
Exemplo n.º 17
0
 public virtual void OnPan(object sender, PanGestureDetector.DetectedEventArgs e, object userData)
 {
 }
Exemplo n.º 18
0
        private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
        {
            if (panControlAnimating)
            {
                return; // Ignore pan gestures whilst PanControl is animating back.
            }

            Animation animationController = Window.Instance.LayoutController.GetCoreAnimation();

            // Prevent Layouting system animating the layout change automatically.
            Window.Instance.LayoutController.OverrideCoreAnimation = true;

            Animation panControlAnimation = new Animation();

            panControlAnimation.Finished += PanControlAnimationFinished;

            switch (e.PanGesture.State)
            {
            case Gesture.StateType.Finished:
            {
                if (true != panningStarted)
                {
                    // Don't run finish operations if never started.
                    // (If user tried to pan whilst the pan control was animating back)
                    return;
                }

                if (animationController.CurrentProgress > RatioToScreenWidthToCompleteScroll)
                {
                    // Panned enough to allow auto completion of animation.
                    animationController.SpeedFactor = 1;
                    animationController.EndAction   = Animation.EndActions.StopFinal;
                }
                else
                {
                    LinearLayout layout = view.Layout as LinearLayout;
                    if (layout.LinearOrientation == LinearLayout.Orientation.Horizontal)
                    {
                        layout.LinearOrientation = LinearLayout.Orientation.Vertical;
                    }
                    else
                    {
                        layout.LinearOrientation = LinearLayout.Orientation.Horizontal;
                    }
                    animationController.SpeedFactor = 1;
                    animationController.EndAction   = Animation.EndActions.StopFinal;
                }

                panControlAnimation.AnimateTo(panControl, "SizeWidth",
                                              panControlOriginalWidth,
                                              0,
                                              512,
                                              new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutBack));

                panControlAnimating = true;
                panControlAnimation.Play();
                animationController.Play();

                // Return control of the layout animations to the Layouting system.
                Window.Instance.LayoutController.OverrideCoreAnimation = false;
                panningStarted = false;
            }
            break;

            case Gesture.StateType.Continuing:
            {
                if (true == panningStarted)
                {
                    PanGestureDisplacementX += e.PanGesture.ScreenDisplacement.X;
                    float progress = PanGestureDisplacementX / windowWidth * 1.2f;
                    animationController.CurrentProgress = progress;
                    panControl.Size2D.Width             = panControlOriginalWidth + (int)PanGestureDisplacementX;
                }
            }
            break;

            case Gesture.StateType.Started:
            {
                panningStarted = true;
                LinearLayout layout = view.Layout as LinearLayout;
                if (layout.LinearOrientation == LinearLayout.Orientation.Horizontal)
                {
                    layout.LinearOrientation = LinearLayout.Orientation.Vertical;
                }
                else
                {
                    layout.LinearOrientation = LinearLayout.Orientation.Horizontal;
                }

                // Start Layouting animations and pause instantly, this also the use of CurrentProgress
                // to control the animation with the gesture displacement.
                animationController.Play();
                animationController.Pause();

                PanGestureDisplacementX = 0;
            }
            break;
            }
        }