/// <summary> /// /// </summary> /// <param name="a"></param> /// <param name="b"></param> public Interval(Interval a, Interval b) { Start = a.Start; End = a.End; Add(b.Start); Add(b.End); }
/// <summary> /// returns true if and only if two intervals are intersecting /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Intersects(Interval other) { if (other.Start > End + ApproximateComparer.DistanceEpsilon) return false; return !(other.End < Start - ApproximateComparer.DistanceEpsilon); }
double PositionHighThumb(double del) { var range = new Interval(minButton.Width+lowThumb.Width, canvas.Width - maxButton.Width - highThumb.Width); var x = GetVisualX(highThumb); var nx = range.GetInRange(x + del); del = nx - x; if (del == 0) return 0; MoveVisualX(highThumb, del); return del; }
void MediumThumbDragDelta(object sender, DragDeltaEventArgs e) { var del = e.HorizontalChange; var x = GetVisualX(highThumb); var range = new Interval(minButton.Width + lowThumb.Width, canvas.Width - maxButton.Width - highThumb.Width); var nx = range.GetInRange(x + del); del = nx - x; if (del == 0) return; MoveVisualX(lowThumb, del); MoveVisualX(mediumThumb, del); MoveVisualX(highThumb, del); RaiseEvent(); }