예제 #1
0
        private PictureTracker GetPictureTracker(int touchId)
        {
            PictureTracker pictureTracker = null;

            _pictureTrackerMap.TryGetValue(touchId, out pictureTracker);

            return(pictureTracker);
        }
예제 #2
0
 //We remove the touchID from the tracking map since the fingers are no longer touch
 //the picture
 public void InInertia(PictureTracker pictureTracker)
 {
     //remove all touch id from the map
     foreach (int id in
              (from KeyValuePair <int, PictureTracker> entry in _pictureTrackerMap
               where entry.Value == pictureTracker
               select entry.Key).ToList())
     {
         _pictureTrackerMap.Remove(id);
     }
 }
예제 #3
0
        public void ProcessUp(object sender, StylusEventArgs args)
        {
            Point          location       = args.GetPosition(_canvas);
            PictureTracker pictureTracker = GetPictureTracker(args.StylusDevice.Id, location);

            if (pictureTracker == null)
            {
                return;
            }

            pictureTracker.ProcessUp(args.StylusDevice.Id, location);
        }
예제 #4
0
        private PictureTracker GetPictureTracker(int touchId, Point location)
        {
            PictureTracker pictureTracker;

            //See if we already track the picture with the touchId
            if (_pictureTrackerMap.TryGetValue(touchId, out pictureTracker))
            {
                return(pictureTracker);
            }

            //Get the picture under the touch location
            Picture picture = FindPicture(location);

            if (picture == null)
            {
                return(null);
            }

            //See if we track the picture with other ID
            pictureTracker = (from KeyValuePair <int, PictureTracker> entry in _pictureTrackerMap
                              where entry.Value.Picture == picture
                              select entry.Value).FirstOrDefault();

            //First time
            if (pictureTracker == null)
            {
                //take from stack
                if (_pictureTrackers.Count > 0)
                {
                    pictureTracker = _pictureTrackers.Pop();
                }
                else //create new
                {
                    pictureTracker = new PictureTracker(this);
                }

                pictureTracker.Picture = picture;
                BringPictureToFront(picture);
            }

            //remember the corelation between the touch id and the picture
            _pictureTrackerMap[touchId] = pictureTracker;

            return(pictureTracker);
        }
예제 #5
0
        private PictureTracker GetPictureTracker(int touchId, Point location)
        {
            PictureTracker pictureTracker;

            //See if we already track the picture with the touchId
            if (_pictureTrackerMap.TryGetValue(touchId, out pictureTracker))
                return pictureTracker;

            //Get the picture under the touch location
            Picture picture = FindPicture(location);

            if (picture == null)
                return null;

            //See if we track the picture with other ID
            pictureTracker = (from KeyValuePair<int, PictureTracker> entry in _pictureTrackerMap
                              where entry.Value.Picture == picture
                              select entry.Value).FirstOrDefault();

            //First time
            if (pictureTracker == null)
            {
                //take from stack
                if (_pictureTrackers.Count > 0)
                    pictureTracker = _pictureTrackers.Pop();
                else //create new
                    pictureTracker = new PictureTracker(this);

                pictureTracker.Picture = picture;
                BringPictureToFront(picture);
            }

            //remember the corelation between the touch id and the picture
            _pictureTrackerMap[touchId] = pictureTracker;

            return pictureTracker;
        }
예제 #6
0
 //Inertia is completed, we can reuse the object
 public void Completed(PictureTracker pictureTracker)
 {
     pictureTracker.Picture = null;
     _pictureTrackers.Push(pictureTracker);
 }
예제 #7
0
 //We remove the touchID from the tracking map since the fingers are no longer touch
 //the picture
 public void InInertia(PictureTracker pictureTracker)
 {
     //remove all touch id from the map
     foreach (int id in
         (from KeyValuePair<int, PictureTracker> entry in _pictureTrackerMap
          where entry.Value == pictureTracker
          select entry.Key).ToList())
     {
         _pictureTrackerMap.Remove(id);
     }
 }
예제 #8
0
 //Inertia is completed, we can reuse the object
 public void Completed(PictureTracker pictureTracker)
 {
     pictureTracker.Picture = null;
     _pictureTrackers.Push(pictureTracker);
 }