コード例 #1
0
 public void ReSetState()
 {
     if (STK_MainStk_Mouse != null && TTF_transform != null)
     {
         TTF_transform.BeginAnimation(TranslateTransform.YProperty, null);
         TTF_transform.Y = 0;
     }
 }
コード例 #2
0
        private void ReleaseMouse(Point p)
        {
            isdrag_Mouse = false;
            timer_Mouse.Stop();
            double nowoffset = p.Y;

            if (counttime_Mouse == 0)
            {
                return;
            }
            if (Math.Abs((nowoffset - startOffset_Mouse) / counttime_Mouse) >= BoundSpeed)
            {
                if ((nowoffset - startOffset_Mouse) / counttime_Mouse > 0)
                {
                    double offset = GetSpeedRateOffset(Math.Abs((nowoffset - startOffset_Mouse) / counttime_Mouse));
                    if (TTF_transform.Y + offset > 0)//(Canvas.GetTop(STK_MainStk_Mouse) + offset > 0)
                    {
                        InertiaAnimation_Mouse.By = null;
                        InertiaAnimation_Mouse.To = 0;
                        TTF_transform.BeginAnimation(TranslateTransform.YProperty, InertiaAnimation_Mouse);
                        //STK_MainStk_Mouse.BeginAnimation(Canvas.TopProperty, InertiaAnimation_Mouse);
                    }
                    else
                    {
                        InertiaAnimation_Mouse.To = null;
                        InertiaAnimation_Mouse.By = offset;
                        TTF_transform.BeginAnimation(TranslateTransform.YProperty, InertiaAnimation_Mouse);
                        //STK_MainStk_Mouse.BeginAnimation(Canvas.TopProperty, InertiaAnimation_Mouse);
                    }
                }
                if ((nowoffset - startOffset_Mouse) / counttime_Mouse < 0)
                {
                    double offset = -GetSpeedRateOffset(Math.Abs((nowoffset - startOffset_Mouse) / counttime_Mouse));
                    if (TTF_transform.Y + offset < -MaxTop) //(Canvas.GetTop(STK_MainStk_Mouse) + offset < -MaxTop)
                    {
                        InertiaAnimation_Mouse.To = -MaxTop;
                        InertiaAnimation_Mouse.By = null;
                        TTF_transform.BeginAnimation(TranslateTransform.YProperty, InertiaAnimation_Mouse);
                        //STK_MainStk_Mouse.BeginAnimation(Canvas.TopProperty, InertiaAnimation_Mouse);
                    }
                    else
                    {
                        InertiaAnimation_Mouse.To = null;
                        InertiaAnimation_Mouse.By = offset;
                        TTF_transform.BeginAnimation(TranslateTransform.YProperty, InertiaAnimation_Mouse);
                        //STK_MainStk_Mouse.BeginAnimation(Canvas.TopProperty, InertiaAnimation_Mouse);
                    }
                }
            }
            if (counttime_Mouse > 0 && Math.Abs((nowoffset - startOffset_Mouse) / counttime_Mouse) < BoundSpeed)
            {
                EnsureBack();
            }
            counttime_Mouse = 0;
        }
コード例 #3
0
 private void EnsureBack(bool leftright)
 {
     if (MaxTop > 0)
     {
         if (TTF_transform.X < -((PageNumber - 1) * SegmentLength))
         {
             InertiaAnimationBack_Mouse.To = -((PageNumber - 1) * SegmentLength);
             TTF_transform.BeginAnimation(TranslateTransform.XProperty, InertiaAnimationBack_Mouse);
         }
         else if (TTF_transform.X > 0)
         {
             InertiaAnimationBack_Mouse.To = 0;
             TTF_transform.BeginAnimation(TranslateTransform.XProperty, InertiaAnimationBack_Mouse);
         }
         else
         {
             if (!AtSteadyPoint())
             {
                 double targetX = GetSteadyPoint(TTF_transform.X, leftright);
                 InertiaAnimationBack_Mouse.By = null;
                 InertiaAnimationBack_Mouse.To = targetX;
                 TTF_transform.BeginAnimation(TranslateTransform.XProperty, InertiaAnimationBack_Mouse);
             }
             if (EndOperation != null)
             {
                 EndOperation();
             }
         }
     }
     else
     {
         if (TTF_transform.X != 0)
         {
             InertiaAnimationBack_Mouse.To = 0;
             TTF_transform.BeginAnimation(TranslateTransform.XProperty, InertiaAnimationBack_Mouse);
         }
         else
         {
             if (EndOperation != null)
             {
                 EndOperation();
             }
         }
     }
 }
コード例 #4
0
 private void EnsureBack()
 {
     if (MaxTop > 0)
     {
         if (TTF_transform.Y < -MaxTop)//Canvas.GetTop(STK_MainStk_Mouse) < -MaxTop)
         {
             InertiaAnimationBack_Mouse.To = -MaxTop;
             TTF_transform.BeginAnimation(TranslateTransform.YProperty, InertiaAnimationBack_Mouse);
             //STK_MainStk_Mouse.BeginAnimation(Canvas.TopProperty, InertiaAnimationBack_Mouse);
         }
         else if (TTF_transform.Y > 0)//Canvas.GetTop(STK_MainStk_Mouse) > 0)
         {
             InertiaAnimationBack_Mouse.To = 0;
             TTF_transform.BeginAnimation(TranslateTransform.YProperty, InertiaAnimationBack_Mouse);
             // STK_MainStk_Mouse.BeginAnimation(Canvas.TopProperty, InertiaAnimationBack_Mouse);
         }
         else
         {
             if (EndOperation != null)
             {
                 EndOperation();
             }
         }
     }
     else
     {
         if (TTF_transform.Y != 0)//Canvas.GetTop(STK_MainStk_Mouse) != 0)
         {
             InertiaAnimationBack_Mouse.To = 0;
             TTF_transform.BeginAnimation(TranslateTransform.YProperty, InertiaAnimationBack_Mouse);
             //STK_MainStk_Mouse.BeginAnimation(Canvas.TopProperty, InertiaAnimationBack_Mouse);
         }
         else
         {
             if (EndOperation != null)
             {
                 EndOperation();
             }
         }
     }
 }