private void GestureButton_TouchMove(object sender, TouchEventArgs e) { int id = e.TouchDevice.Id; Point position = PointToScreen(new Point(e.GetTouchPoint(this).Position.X, e.GetTouchPoint(this).Position.Y)); YTPoint point = new YTPoint(position.X, position.Y); if (finger1.ContainsKey(id)) { finger1[id].Add(point); var t0 = _watch2.ElapsedMilliseconds; // in seconds if (!_bSwipe1 && !_bManipulating1) { if (t0 < TIME_THRESHOLD) { if (point.GetDistance(finger1[id][0]) > RADIUS) { _bSwipe1 = true; } } else { if (point.GetDistance(finger1[id][0]) < RADIUS) { _bManipulating1 = true; } } } } else if (finger2.ContainsKey(id)) { finger2[id].Add(point); var t0 = _watch2.ElapsedMilliseconds; // in seconds if (!_bSwipe2 && !_bManipulating2) { if (t0 < TIME_THRESHOLD) { if (point.GetDistance(finger2[id][0]) > RADIUS) { _bSwipe2 = true; } } else { if (point.GetDistance(finger2[id][0]) < RADIUS) { _bManipulating2 = true; } } } //var xSpeed = (position.X - finger2[id][0].X) / watch.ElapsedMilliseconds; //var ySpeed = (position.Y - finger2[id][0].Y) / watch.ElapsedMilliseconds; //Console.WriteLine("id {0}, x diff {1}, y diff {2}", id, xSpeed, ySpeed); } }
public bool TopOf(YTPoint anotherPoint) { return(this.Y < anotherPoint.Y); }
public bool BottomOf(YTPoint anotherPoint) { return(this.Y > anotherPoint.Y); }
public bool RightOf(YTPoint anotherPoint) { return(this.X > anotherPoint.X); }
public bool LeftOf(YTPoint anotherPoint) { return(this.X < anotherPoint.X); }
public double GetHorozontalDistance(YTPoint anotherPoint) { return(Math.Abs(this.X - anotherPoint.X)); }
public double GetVerticalDistance(YTPoint anotherPoint) { return(Math.Abs(this.Y - anotherPoint.Y)); }
public double GetDistance(YTPoint anotherPoint) { return(Math.Sqrt(Math.Pow(this.Y - anotherPoint.Y, 2) + Math.Pow(this.X - anotherPoint.X, 2))); }