예제 #1
0
        internal override double GetPointOutY()
        {
            if (!AxisYConverter.IsInViewRagne(PointOutDataRowIndex))
            {
                if (PointOutDataRowIndex < 0)
                {
                    PointOutDataRowIndex = 0;
                }
                else
                {
                    PointOutDataRowIndex = ItemsSource.Count - 1;
                }
            }
            var rowY = AxisYConverter.DataToScreen(PointOutDataRowIndex);
            var y    = rowY + BlockConverter.GetTop(PointOutBlock);

            return(y);
        }
예제 #2
0
        private object PointoutBlock(Point e)
        {
            var y = e.Y; //- GetHeaderHeight();

            //var y1 = AxisYConverter.ScreenToData(y);
            //var y2 = (int)(y / Interval) + AxisYConverter.ScreenToData(0);

            //if (y1 != y2)
            //    Debug.Print(string.Format("-------- ViewportToDataY called : y1 = {0}  y2 = {1}", y1, y2));

            // BMK Ambiguous getRowIndex
            PointOutDataRowIndex = AxisYConverter.ScreenToData(y);

            object fountBlock = null;

            if (ItemsSource != null && 0 <= PointOutDataRowIndex && PointOutDataRowIndex < ItemsSource.Count)
            {
                var dateTime  = AxisXConverter.ScreenToData(e.X); // current mouse moved postion
                var positionY = y % Interval;                     // for Top useage


                if (CellMode)
                {
                    var date = dateTime.Date;
                    ItemsSource[PointOutDataRowIndex].SaftyInvoke <IEnumerable>(
                        o =>
                    {
                        fountBlock = o.OfType <ITerm>().FirstOrDefault(t =>
                        {
                            //using HrDate
                            var blockStart = BlockConverter.GetStart(t);
                            return((date == blockStart) && !TryPrevent(t));
                        });
                    });

                    if (RecursivelyPointout)
                    {
                        ItemsSource[PointOutDataRowIndex].SaftyInvoke <IDateIndexer <DateTerm> >(o => o[date].SaftyInvoke(b => fountBlock = b));
                    }
                }
                else
                {
                    ItemsSource[PointOutDataRowIndex].SaftyInvoke <IEnumerable>(
                        o =>
                    {
                        fountBlock = o.OfType <ITerm>().LastOrDefault(block =>
                        {
                            var blockStart = BlockConverter.GetStart(block);
                            var blockTop   = BlockConverter.GetTop(block);
                            return((blockStart <= dateTime && dateTime < block.End &&
                                    blockTop <= positionY && (BlockConverter.GetHeight(block) + blockTop) >= positionY) && !TryPrevent(block));
                        });
                    });
                }
            }

            if (fountBlock != null)
            {
                PointOutDataRowTop = (e.Y - e.Y % Interval) + BlockConverter.GetTop(fountBlock);
            }

            return(fountBlock);
        }