private void SetInitalDrawLocation() { if (CellMode) { var rect = _startPoint.CellDesiredSzie(Interval, AxisXConverter, RenderSize, VerticalOffset, HorizontalOffset, AxisPanel.ViewportRangeY.ViewMax); if (rect != null) { InitalDrawLocation = rect.Value; } } else { if (PointOutBlock == null) { InitalDrawLocation = default(Rect); } else { var top = LayerContainer.PointOutDataRowTop + BlockConverter.GetHeight(PointOutBlock); var left = _startPoint.X; InitalDrawLocation = new Rect(left, top, 0, 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); }