Example #1
0
        void timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            clickNo++;

            if (InertiaMove != null)
            {
                InertiaMove(this, new HandMovedEventArgs(scrollDirection, MovementType.inertia, handType));
            }
            int interval = timeInterval();

            //Debug
            //Console.WriteLine("interval: {0}\n", interval);
            if (interval < maxInterval)
            {
                timer.Interval = interval;
                timer.Start();
            }
            else
            {
                status = ScrollStatus.stop;
            }
        }
Example #2
0
        public void keepScrolling(double speed, InteractionHandType handType, ScrollType type)
        {
            //determine hand movement direction
            switch (type)
            {
            case ScrollType.vertical:
                scrollDirection = speed > 0 ? HandMovedDirection.down : HandMovedDirection.up;
                break;

            case ScrollType.horizontal:
                scrollDirection = speed > 0 ? HandMovedDirection.right : HandMovedDirection.left;
                break;

            case ScrollType.none:
                return;

            default:
                break;
            }

            //make sure speed is in bounds
            speed = Math.Abs(speed);
            if (speed < minSpeed || speed > maxSpeed)
            {
                return;
            }

            //reset params and start timer
            this.handType  = handType;
            clickNo        = 1;
            totalClicks    = (int)(speed * speedToClickConst);
            tau            = minInterval / (Math.Log((double)totalClicks / (double)(totalClicks - 1)));
            timer.Interval = minInterval;
            status         = ScrollStatus.scrolling;
            timer.Start();
        }
Example #3
0
 public void stopScrolling()
 {
     status = ScrollStatus.stop;
     timer.Stop();
 }