Exemplo n.º 1
0
        /// <summary>
        /// Update the mouse manager.
        /// </summary>
        public override void Update(bool isActive)
        {
            //clear out the taps & touches
            Clicks.Clear();
            Highlights.Clear();
            Drags.Clear();
            Drops.Clear();
            Flicks.Clear();
            Pinches.Clear();

            if (null != Pinch)
            {
                //reset the pinch delta
                Pinch.Delta = 0f;
            }

            if (isActive)
            {
                TouchCollection = TouchPanel.GetState();

                //get the new taps & touches
                GetGestures();
                GetTouches();
            }

            //Add the pinch event if there is an ongoing gesture
            if (null != Pinch)
            {
                Pinches.Add(new PinchEventArgs(Pinch.Delta));
            }
        }
Exemplo n.º 2
0
        private void AddFlickEvent(Vector2 delta)
        {
            //Was that gesture strong enough to register as a "flick"?
            var deltaLength = delta.Length();

            if (deltaLength < FlickMinLength)
            {
                return;
            }

            //go though the points that are being touched
            foreach (var touch in TouchCollection)
            {
                var touchIndex = touch.Id % _numTouches;

                //Sometimes TryGetPreviousLocation can fail.
                //Bail out early if this happened or if the last state didn't move
                TouchLocation prevLoc;
                if (!touch.TryGetPreviousLocation(out prevLoc) ||
                    TouchStartPosition[touchIndex].Id != touch.Id)
                {
                    continue;
                }

                //get the end of the event
                Flicks.Add(new FlickEventArgs()
                {
                    Position = ConvertCoordinate(touch.Position),
                    Delta    = delta,
                });
            }
        }
Exemplo n.º 3
0
        // POST: odata/Flicks
        public IHttpActionResult Post(Flicks flicks)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Flicks.Add(flicks);
            db.SaveChanges();

            return(Created(flicks));
        }
Exemplo n.º 4
0
        // DELETE: odata/Flicks(5)
        public IHttpActionResult Delete([FromODataUri] int key)
        {
            Flicks flicks = db.Flicks.Find(key);

            if (flicks == null)
            {
                return(NotFound());
            }

            db.Flicks.Remove(flicks);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Update the mouse manager.
        /// </summary>
        public override void Update(bool isActive)
        {
            //clear out the taps & touches
            Clicks.Clear();
            Highlights.Clear();
            Drags.Clear();
            Drops.Clear();
            Flicks.Clear();
            Pinches.Clear();
            Holds.Clear();

            if (null != Pinch)
            {
                //reset the pinch delta
                Pinch.Delta = 0f;
            }

            if (isActive && IsEnabled)
            {
                TouchCollection = TouchPanel.GetState();

                //get the new taps & touches
                GetGestures();
                GetTouches();
            }

            //Add the pinch event if there is an ongoing gesture
            if (null != Pinch)
            {
                if (Pinch.Finished)
                {
                    Pinches.Add(new PinchEventArgs(Pinch.First, Pinch.Second, Pinch.Delta)
                    {
                        Release = true
                    });
                    Pinch = null;
                }
                else
                {
                    Pinches.Add(new PinchEventArgs(Pinch.First, Pinch.Second, Pinch.Delta));
                }
            }
        }
Exemplo n.º 6
0
        public IHttpActionResult Patch([FromODataUri] int key, Delta <Flicks> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Flicks flicks = db.Flicks.Find(key);

            if (flicks == null)
            {
                return(NotFound());
            }

            patch.Patch(flicks);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FlicksExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(flicks));
        }