private void OnTouchEvent(TouchActivityEvent ev) { for (int i = 0; i < ev.Pointers.Count; ++i) { TouchActivityEvent.PointerInfo pointer = ev.Pointers[i]; switch (ev.Action) { case MotionEventActions.Down: case MotionEventActions.PointerDown: { TouchDown?.Invoke(this, pointer.X, pointer.Y, pointer.Id); break; } case MotionEventActions.Up: case MotionEventActions.PointerUp: { TouchUp?.Invoke(this, pointer.X, pointer.Y, pointer.Id); break; } case MotionEventActions.Move: { TouchMove?.Invoke(this, pointer.X, pointer.Y, pointer.Id); break; } } } }
private void OnTouchUp(int touchId, Direction side, Vector2 point) { if (null != TouchUp) { TouchUp.Invoke(touchId, side, point); } }
public void InvokeTouchUp(double Pos) { TouchUp.Invoke(this, new SeekBarUpdateArgs() { Position = Pos }); }
public override void TouchesCancelled(NSSet touches, UIEvent?evt) { base.TouchesCancelled(touches, evt); var viewPoints = this.GetPointsInView(evt); PointF viewPoint = viewPoints.Length > 0 ? viewPoints[0] : PointF.Zero; var point = new Point(viewPoint.X, viewPoint.Y); TouchUp?.Invoke(this, new TouchEventArgs(point)); }
public PlatformSlider() { TouchDownEvent = delegate { TouchDown?.Invoke(this, EventArgs.Empty); }; TouchUpEvent = delegate { TouchUp?.Invoke(this, EventArgs.Empty); }; }
public Seeker() { TouchDownEvent = delegate { TouchDown?.Invoke(this, EventArgs.Empty); }; TouchUpEvent = delegate { TouchUp?.Invoke(this, EventArgs.Empty); }; }
internal void Internal_OnTouchUp(ref Vector2 pointerPosition, int pointerId) { Vector2 pos = pointerPosition / _dpiScale; bool handled = false; TouchUp?.Invoke(ref pos, pointerId, ref handled); if (handled) { return; } GUI.OnTouchUp(pos, pointerId); }
public MySlider() { TouchDownEvent = delegate { TouchDown?.Invoke(this, EventArgs.Empty); }; TouchUpEvent = delegate { TouchUp?.Invoke(this, EventArgs.Empty); }; TouchProgressChanged = delegate { TouchProgress?.Invoke(this, EventArgs.Empty); }; TouchUp = delegate { TouchProgress?.Invoke(this, EventArgs.Empty); }; }
internal void OnTouchUp(TouchEventArgs args) { _longPressTimer.Stop(); if (TouchState == TouchStates.Touched) { TouchState = TouchStates.Released; TouchUp?.Invoke(this, args); ChangeVisualState(); if (Click != null) { OnClick(); args.Handled = true; } } else { TouchUp?.Invoke(this, args); } }
internal void ProcessUp(int id, Vector2 position, DateTime time) { TouchElement element; if (!_elements.TryGetValue(id, out element)) { return; } Vector2 move = position - element.Position; element.Position = position; element.LockedListener = null; _elements.Remove(id); _gesture.GestureType = GestureType.Up; _gesture.Origin = element.Origin; _gesture.Position = position; _gesture.PointerCapturedBy = element.LockedListener; _gesture.TouchId = id; _gesture.Offset = move; _gesture.Time = time; OnGesture(); if (element.LockedGesture == GestureType.HoldStart) { _gesture.GestureType = GestureType.HoldCancel; OnGesture(); } if (!_gesture.Handled) { if (element.LockedGesture == GestureType.None) { if ((element.Origin - element.Position).Length() < MinDragSize && (DateTime.Now - element.DownTime).TotalMilliseconds < HoldStartTimeInMs) { bool doubleTap = false; if (_lastTap.HasValue) { if ((element.Position - _lastTap.Value.Position).Length() < DoubleTapSize) { _gesture.GestureType = GestureType.DoubleTap; OnGesture(); doubleTap = true; if (_gesture.Handled) { _lastTap = null; return; } } } _gesture.GestureType = GestureType.Tap; OnGesture(); Tap?.Invoke(_gesture.TouchId, _gesture.Position); if (!_gesture.Handled) { if (doubleTap) { _lastTap = null; } else { _lastTap = new LastTap() { Position = _gesture.Position, Time = 0 }; } } } } } TouchUp?.Invoke(id, position); }
public virtual void OnTouchUp() { IsTouchInside = false; TouchUp.Invoke(this); }
private void OnTouchUp(float x, float y, ulong id) { TouchUp?.Invoke(this, (int)(x * _width), (int)(y * _height), id); }
private void ProcessTouches(SensorDataEventArgs eventArgs) { List <EchoPoint> currPts = new List <EchoPoint>(); // first: calculate the new points for (int i = 0; i < eventArgs.Peaks.Length; i++) { double distance = GetDistance(eventArgs.Peaks[i]); double pressure = eventArgs.Amplitudes[i] / 1000.0; pressure = Math.Min(Math.Max(0.0, pressure), 1.0); EchoPoint echoPt = new EchoPoint(i, distance, pressure, eventArgs.Peaks[i], eventArgs.Amplitudes[i]); currPts.Add(echoPt); } // match the points if (m_prevPoints.Count == 0) { // we did not have previous points if (currPts.Count != 0) { // match those points to new points for (int i = 0; i < currPts.Count; i++) { m_prevPoints.Add(currPts[i]); TouchDown?.Invoke(this, new EchoPointEventArgs(currPts[i])); } } else { // nothing to do here } } else if (m_prevPoints.Count == 1) { // there was one previous point if (currPts.Count == 0) { // the point disappeared TouchUp?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0])); m_prevPoints.RemoveAt(0); } else if (currPts.Count == 1) { // this is the same point (double-check distance) m_prevPoints[0].Update(currPts[0]); TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0])); } else if (currPts.Count == 2) { // we added a point // find out which one was the original double distance1 = Math.Abs(currPts[0].Distance - m_prevPoints[0].Distance); double distance2 = Math.Abs(currPts[1].Distance - m_prevPoints[0].Distance); int correctId = m_prevPoints[0].Id == 0 ? 1 : 0; if (distance1 > distance2) { // the first point is new currPts[0].Id = correctId; m_prevPoints[0].Update(currPts[1]); TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0])); m_prevPoints.Add(currPts[0]); TouchDown?.Invoke(this, new EchoPointEventArgs(currPts[0])); } else { // the other one is new currPts[1].Id = correctId; m_prevPoints[0].Update(currPts[0]); TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0])); m_prevPoints.Add(currPts[1]); TouchDown?.Invoke(this, new EchoPointEventArgs(currPts[1])); } } } else if (m_prevPoints.Count == 2) { // there were two previous points if (currPts.Count == 0) { // the points disappeared TouchUp?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0])); TouchUp?.Invoke(this, new EchoPointEventArgs(m_prevPoints[1])); m_prevPoints.Clear(); } else if (currPts.Count == 1) { // we removed only one point // find out which one double distance1 = Math.Abs(currPts[0].Distance - m_prevPoints[0].Distance); double distance2 = Math.Abs(currPts[0].Distance - m_prevPoints[1].Distance); if (distance1 > distance2) { // the first previous is gone m_prevPoints[1].Update(currPts[0]); TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[1])); TouchUp?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0])); m_prevPoints.RemoveAt(0); } else { // the second previous is gone m_prevPoints[0].Update(currPts[0]); TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0])); TouchUp?.Invoke(this, new EchoPointEventArgs(m_prevPoints[1])); m_prevPoints.RemoveAt(1); } } else { // both are still here -> update them bool prevFlipped = m_prevPoints[0].Distance > m_prevPoints[1].Distance; bool currFlipped = currPts[0].Distance > currPts[1].Distance; if ((!prevFlipped && !currFlipped) || (prevFlipped && currFlipped)) { m_prevPoints[0].Update(currPts[0]); m_prevPoints[1].Update(currPts[1]); TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0])); TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[1])); } else if ((!prevFlipped && currFlipped) || (prevFlipped && !currFlipped)) { m_prevPoints[0].Update(currPts[1]); m_prevPoints[1].Update(currPts[0]); TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0])); TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[1])); } } } }
public void OnTouchUp() => TouchUp?.Invoke(this, null);
public virtual void OnTouchUp() { TouchUp.Invoke(this); }
public TouchEventSlider() { TouchDownEvent = (sender, args) => TouchDown?.Invoke(this, args); TouchUpEvent = (sender, args) => TouchUp?.Invoke(this, args); }
/// <summary> /// Raises the <see cref="TouchUp"/> event. /// </summary> /// <param name="touchID">The unique identifier of the touch input.</param> /// <param name="fingerID">The unique identifier of the finger which caused the touch.</param> protected virtual void OnTouchUp(Int64 touchID, Int64 fingerID) { TouchUp?.Invoke(this, touchID, fingerID); }
public void OnTouchUp(int x, int y, ulong id) { TouchUp?.Invoke(this, x, y, id); }
public virtual void OnTouchUp(Point point) { TouchUp?.Invoke(this, EventArgs.Empty); }
public virtual void OnTouchUp() { _startPos = null; IsTouchInside = false; TouchUp.Invoke(this); }