コード例 #1
0
ファイル: InternalSpinBox.cs プロジェクト: weimingtom/Sakura
            private void FlickEventHandler(object sender, FlickEventArgs e)
            {
                this.animationState = InternalSpinBox.SpinList.AnimationState.Flick;
                float virtualVec = this.GetVirtualVec(e.Speed);

                this.flickDistance = virtualVec * this.flickSpeedCoeff;
                if (this.IsItemFit)
                {
                    if (this.flickDistance > 0f)
                    {
                        if ((double)this.ItemGapLine * 2.0 - (double)this.ScrollAreaPixelOffset - (double)(this.flickDistance / this.flickInterpRate) > 0.0)
                        {
                            this.animationState = InternalSpinBox.SpinList.AnimationState.Fit;
                            this.fitInterpRate  = this.flickDistance / (this.ItemGapLine - this.ScrollAreaPixelOffset);
                            if (this.ScrollAreaFirstLine >= this.CalcMaxLineIndex() && !this.IsLoop)
                            {
                                this.fitTargetIndex = this.ScrollAreaFirstLine;
                            }
                            else
                            {
                                this.fitTargetIndex = this.ScrollAreaFirstLine + 1;
                            }
                            this.fitTargetOffsetPixel = 0f;
                            return;
                        }
                    }
                    else if ((double)(this.ItemGapLine + this.ScrollAreaPixelOffset + this.flickDistance / this.flickInterpRate) > 0.0)
                    {
                        this.animationState       = InternalSpinBox.SpinList.AnimationState.Fit;
                        this.fitInterpRate        = -this.flickDistance / this.ScrollAreaPixelOffset;
                        this.fitTargetIndex       = this.ScrollAreaFirstLine;
                        this.fitTargetOffsetPixel = 0f;
                    }
                }
            }
コード例 #2
0
 private void FlickEventHandler(object sender, FlickEventArgs e)
 {
     base.ResetState(false);
     this.animationState = LiveScrollPanel.AnimationState.Up;
     this.isFlick        = true;
     this.touchVelocity  = e.Speed / 1000f * this.flickCoeff;
     this.panelVelocity += e.Speed / 1000f * this.flickCoeff;
 }
コード例 #3
0
        private void FlickEventHandler(object sender, FlickEventArgs e)
        {
            int   num  = 1;
            int   num2 = this.flipCount;
            float num3 = (float)(num2 - num) / ((this.flickGesture.MaxSpeed - this.flickGesture.MinSpeed) * (this.flickGesture.MaxSpeed - this.flickGesture.MinSpeed));
            float num4 = num3 * (Math.Abs(e.Speed.X) - this.flickGesture.MinSpeed) * (Math.Abs(e.Speed.X) - this.flickGesture.MinSpeed) + (float)num;

            this.Start((e.Speed.X > 0f) ? (-(int)num4) : ((int)num4), true);
        }
コード例 #4
0
ファイル: PagePanel.cs プロジェクト: weimingtom/Sakura
        private void FlickEventHandler(object sender, FlickEventArgs e)
        {
            base.ResetState(false);
            this.state = PagePanel.AnimationState.Flick;
            int num = -(int)(this.panelContainer.X / this.Width);

            if (e.Speed.X < 0f)
            {
                this.ScrollTo(num + 1, true);
            }
            else
            {
                this.ScrollTo(num, true);
            }
            this.animation = true;
        }
コード例 #5
0
        private void FlickEventHandler(object sender, FlickEventArgs e)
        {
            if (this.IsScrollable())
            {
                base.ResetState(false);
                this.animationState = ListPanel.AnimationState.Flick;
                this.animation      = true;
                switch (this.terminalState)
                {
                case ListPanel.TerminalState.Top:
                case ListPanel.TerminalState.Bottom:
                    this.scrollVelocity = 0f;
                    return;

                default:
                    this.scrollVelocity = e.Speed.Y * this.flickStartRatio;
                    break;
                }
            }
        }
コード例 #6
0
 private void FlickEventHandler(object sender, FlickEventArgs e)
 {
     if (e.Speed.Y == 0f)
     {
         return;
     }
     this.animationState = LiveListPanel.AnimationState.Flick;
     if (e.Speed.Y > 0f)
     {
         this.scrollDirection = FourWayDirection.Down;
     }
     else
     {
         this.scrollDirection = FourWayDirection.Up;
     }
     this.flickDistance      = e.Speed.Y * 0.015f;
     this.flickStartDistance = this.flickDistance;
     this.flickElapsedTime   = 0f;
     this.ScrollOffset(this.flickDistance);
     this.UpdateListItemData();
 }
コード例 #7
0
ファイル: ScrollPanel.cs プロジェクト: weimingtom/Sakura
 private void FlickEventHandler(object sender, FlickEventArgs e)
 {
     base.ResetState(false);
     this.animationState = ScrollPanel.AnimationState.Flick;
     if (this.ScrollBarVisibility == ScrollBarVisibility.ScrollingVisible)
     {
         this.scrollBarH.Visible = this.isHorizontalScrollable();
         this.scrollBarV.Visible = this.isVerticalScrollable();
     }
     if (this.isHorizontalScrollable())
     {
         this.flickDistance.X = e.Speed.X * 0.03f;
     }
     if (this.isVerticalScrollable())
     {
         this.flickDistance.Y = e.Speed.Y * 0.03f;
     }
     this.startFlickDistance   = this.flickDistance;
     this.startPanelPos.X      = this.panel.X;
     this.startPanelPos.Y      = this.panel.Y;
     this.animationElapsedTime = 0f;
     this.animation            = true;
 }
コード例 #8
0
        private void FlickEventHandler(object sender, FlickEventArgs e)
        {
            if (this.toggleEnabled)
            {
                if (e.Speed.X > 0f && !this.FrontFace)
                {
                    this.Start(-1, true);
                }
                else if (e.Speed.X < 0f && this.FrontFace)
                {
                    this.Start(1, true);
                }
            }
            else
            {
                int revo = -(int)(e.Speed.X * (float)Math.Cos((double)this.zAxis) / (float)this.flick + e.Speed.Y * (float)Math.Sin((double)this.zAxis) / (float)this.flick);
                this.Start(revo, true);
            }
            Matrix4 transform3D = this.spherePrim.Transform3D;

            transform3D.M43             = 0f;
            this.spherePrim.Transform3D = transform3D;
        }
コード例 #9
0
        protected internal override GestureDetectorResponse OnTouchEvent(TouchEventCollection touchEvents)
        {
            GestureDetectorResponse result = base.State;
            TouchEvent primaryTouchEvent   = touchEvents.PrimaryTouchEvent;

            if (base.State != GestureDetectorResponse.None && this.downID != primaryTouchEvent.FingerID)
            {
                return(result);
            }
            switch (primaryTouchEvent.Type)
            {
            case TouchEventType.Up:
            {
                Vector2 vector = primaryTouchEvent.WorldPosition - this.previousWorldPosition[1];
                float   num    = (float)(primaryTouchEvent.Time - this.previousTime[1]).TotalMilliseconds;
                Vector2 zero   = Vector2.Zero;
                if (this.Direction != FlickDirection.Virtical)
                {
                    zero.X = vector.X / num * 1000f;
                    if (zero.X < -this.MaxSpeed)
                    {
                        zero.X = -this.MaxSpeed;
                    }
                    else if (zero.X > this.MaxSpeed)
                    {
                        zero.X = this.MaxSpeed;
                    }
                    else if (Math.Abs(zero.X) < this.MinSpeed)
                    {
                        zero.X = 0f;
                    }
                }
                if (this.Direction != FlickDirection.Horizontal)
                {
                    zero.Y = vector.Y / num * 1000f;
                    if (zero.Y < -this.MaxSpeed)
                    {
                        zero.Y = -this.MaxSpeed;
                    }
                    else if (this.MaxSpeed < zero.Y)
                    {
                        zero.Y = this.MaxSpeed;
                    }
                    else if (Math.Abs(zero.Y) < this.MinSpeed)
                    {
                        zero.Y = 0f;
                    }
                }
                if (zero.X != 0f || zero.Y != 0f)
                {
                    if (this.FlickDetected != null)
                    {
                        FlickEventArgs flickEventArgs = new FlickEventArgs(base.TargetWidget, primaryTouchEvent.WorldPosition, primaryTouchEvent.LocalPosition, zero);
                        this.FlickDetected.Invoke(this, flickEventArgs);
                    }
                    result = GestureDetectorResponse.DetectedAndStop;
                }
                else
                {
                    result = GestureDetectorResponse.FailedAndStop;
                }
                break;
            }

            case TouchEventType.Down:
                this.downID = primaryTouchEvent.FingerID;
                for (int i = 0; i < 2; i++)
                {
                    this.previousWorldPosition[i] = primaryTouchEvent.WorldPosition;
                    this.previousTime[i]          = primaryTouchEvent.Time;
                }
                result = GestureDetectorResponse.UndetectedAndContinue;
                break;

            case TouchEventType.Move:
                if ((primaryTouchEvent.Time - this.previousTime[0]).TotalMilliseconds > (double)this.pollingMilliseconds)
                {
                    this.previousWorldPosition[1] = this.previousWorldPosition[0];
                    this.previousTime[1]          = this.previousTime[0];
                    this.previousWorldPosition[0] = primaryTouchEvent.WorldPosition;
                    this.previousTime[0]          = primaryTouchEvent.Time;
                    result = GestureDetectorResponse.UndetectedAndContinue;
                }
                break;
            }
            return(result);
        }