/// <summary> /// Updates properties from the values from another instance /// </summary> /// <param name="source"></param> public void ValueFrom(PanEventArgs source) { base.ValueFrom(source); DeltaDistance = source.DeltaDistance; TotalDistance = source.TotalDistance; Velocity = source.Velocity; }
/// <summary> /// constructs new PanEventArgs /// </summary> /// <param name="source"></param> /// <param name="newListener"></param> public PanEventArgs(PanEventArgs source = null, Listener newListener = null) : base(source, newListener) { if (source != null) { DeltaDistance = source.DeltaDistance; TotalDistance = source.TotalDistance; Velocity = source.Velocity; } }
internal PanEventArgs Diff(PanEventArgs lastArgs) { return(new PanEventArgs { Cancelled = Cancelled, Handled = Handled, ViewPosition = ViewPosition, Touches = Touches, Listener = Listener, Velocity = Velocity, TotalDistance = TotalDistance, DeltaDistance = TotalDistance.Subtract(lastArgs.TotalDistance) }); }
/// <summary> /// calculates the distance traversed since last sample /// </summary> /// <param name="previous"></param> protected void CalculateDistances(PanEventArgs previous) { if (previous == null) { DeltaDistance = new Point(0.0, 0.0); TotalDistance = new Point(0.0, 0.0); return; } if (Touches.Length != previous.Touches.Length) { DeltaDistance = new Point(0.0, 0.0); TotalDistance = previous.TotalDistance; return; } DeltaDistance = Center.Subtract(previous.Center); TotalDistance = previous.TotalDistance.Add(DeltaDistance); }
/// <summary> /// Equality test /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Equals(PanEventArgs other) { return(other != null && DeltaDistance.Equals(other.DeltaDistance) && TotalDistance.Equals(other.TotalDistance) && Velocity.Equals(other.Velocity) && base.Equals(other)); }