예제 #1
0
        public ReadOnlyCollection <IFigure> HitTestMany(Point point)
        {
            List <IFigure> result = new List <IFigure>();

            // Changed to use reverse so that more recently added figures appear earlier in the result. - D.H. 6/29/2011
            var reverse = this.Reverse();

            foreach (var item in reverse)
            {
                IFigure found = item.HitTest(point);
                if (found != null && found.Visible && found.IsHitTestVisible)
                {
                    result.Add(found);
                }
            }

            if (result.Count > 0)
            {
                // Use a stable sorting method.  Higher zIndexes should occur earlier in results.  - D.H. 6/29/2011
                FigureList.StableSort(result, (f1, f2) => f2.ZIndex.CompareTo(f1.ZIndex));

                // .NET collections sort is unstable (does not preserve order if comparison value is the same).
                //result.Sort((f1, f2) => f1.ZIndex.CompareTo(f2.ZIndex));
            }

            return(result.AsReadOnly());
        }
예제 #2
0
 public FigureCreator()
 {
     FoundDependencies    = new FigureList();
     ExpectedDependencies = InitExpectedDependencies();
 }
예제 #3
0
 protected override void Reset()
 {
     base.Reset();
     FoundDependencies = new FigureList();
     RemoveTempPoint();
 }