Beispiel #1
0
        public void AddSpan(Span span)
        {
            if (span.Min > span.Max)
            {
                int tmp = span.Min;
                span.Min = span.Max;
                span.Max = tmp;
            }
            MathHelper.Clamp(span.Min, 0, Height);
            MathHelper.Clamp(span.Max, 0, Height);
            for (int i = 0; i < Spans.Count; ++i)
            {
                Span cur = Spans[i];
                if (cur.Min > span.Max)
                {
                    Spans.Insert(i, span);
                    return;
                }
                else if (cur.Max >= span.Min)
                {
                    if (cur.Min < span.Min)
                    {
                        span.Min = cur.Min;
                    }

                    if (cur.Max > span.Max)
                    {
                        span.Max = cur.Max;
                    }
                    Spans.RemoveAt(i);
                    i--;
                }
            }
            Spans.Add(span);
        }
Beispiel #2
0
        public void AddSpanAfterSelectedSpan()
        {
            int      index   = Spans.IndexOf(_selectedSpan);
            UserSpan newSpan = new UserSpan();

            newSpan.PropertyChanged += OnUserSpanPropertyChanged;
            Spans.Insert(index + 1, newSpan);
            OrderingSection();
            SelectedUserSpan = Spans[index + 1];
        }