public void TouchMoved(int touchId, PointF p, TouchProperties prop) { if (Touches.ContainsKey(touchId)) { Touch curTouch = Touches[touchId].Touch; curTouch.SetNewTouchPoint(p); curTouch.Properties = prop; curTouch.SetMoving(); } }
/// <summary> /// Updates a touch position. Does not change the object the touch is related to by doing a hittest. /// </summary> /// <remarks> /// Touch is fixed to one element when added, and should never change. This /// gives the best responsiveness for resizing and rotating, as the fingers move outside of the /// element area. /// </remarks> /// <param name="touchId">Unique ID for the touch.</param> /// <param name="touchPoint">The coordinates of the touch in screen space.</param> /// <param name="props">Extended properties of the touch.</param> protected void TouchUpdated(int touchId, PointF touchPoint, TouchProperties props) { CheckConfigured(); // Potential to be called from another thread, so need to lock lock (syncRoot) { Assigner.TouchMoved(touchId, touchPoint, props); if (AllTouches.ContainsKey(touchId)) { AllTouches[touchId].TouchPoint = touchPoint; } } }
Touch buildTouch(ITouchData rawTouch) { TouchProperties prop=new TouchProperties(); prop.Acceleration = rawTouch.Acceleration; prop.VelocityX = rawTouch.VelocityX; prop.VelocityY = rawTouch.VelocityY; PointF p = getTouchPoint(rawTouch); Touch t = new Touch(rawTouch.Id, p); t.Properties = prop; return t; }
void EventWindow_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { System.Windows.Point pos = e.GetPosition(mouseConfig.EventWindow); PointF p = new PointF((float)pos.X, (float)pos.Y); moveTid++; int id = moveTid; old = p; var prop=new TouchProperties(); prop.Acceleration = 1.0; prop.VelocityX = 1.0; prop.VelocityY = 1.0; Touch t = new Touch(id, p); t.Properties = prop; t.SetHeld(); this.TouchAdded(t); this.ProcessUpdates(); }
void EventWindow_MouseMove(object sender, MouseEventArgs e) { if (!(e.LeftButton == MouseButtonState.Pressed)) return; System.Windows.Point pos = e.GetPosition(mouseConfig.EventWindow); PointF p = new PointF((float)pos.X, (float)pos.Y); int id = moveTid; var prop=new TouchProperties(); prop.Acceleration = 1.0; prop.VelocityX = old.X / p.X; prop.VelocityY = old.Y / p.Y; if (double.IsNaN(prop.VelocityX)) prop.VelocityX = 0.0; if (double.IsNaN(prop.VelocityY)) prop.VelocityY = 0.0; if (p != old) { this.TouchUpdated(id, p, prop); } else { this.TouchHeld(id); } this.ProcessUpdates(); old = p; }