private double DownDistance(SpliterSpan dragedSpan, double deltaDis) { var rightSpan = _spanList.FirstOrDefault(s => DoubleUtil.GreaterThanOrClose(s.Start, dragedSpan.End)); return(Math.Min(deltaDis, (rightSpan == null ? (_maxLength - dragedSpan.End) : Math.Max(0, rightSpan.Start - dragedSpan.End)))); }
private double UpDistance(SpliterSpan dragedSpan, double deltaDis) { var leftSpan = _spanList.LastOrDefault(s => DoubleUtil.LessThanOrClose(s.End, dragedSpan.Start)); return(Math.Min(deltaDis, leftSpan == null ? dragedSpan.Start : (Math.Max(0, dragedSpan.Start - leftSpan.End)))); }