private static PhysicalCharInfo BottomToTopLineHitTest(PhysicalLineInfo lineInfo, Point point, bool snapToNearest, TextPointer end) { Rect lineBounds; PhysicalCharInfo result = lineInfo.HitTest(point, snapToNearest, out lineBounds); if (result == null) { if (lineBounds.IsEmpty || point.Y > lineBounds.Bottom) { // The point is below the bottom of the current line // since lines are being scanned from bottom to top // no other line can contain the point. // snap to the end of the range if (snapToNearest) { result = new PhysicalCharInfo(end); } } } return(result); }
private static PhysicalCharInfo TopToBottomLineHitTest(PhysicalLineInfo lineInfo, Point point, bool snapToNearest, TextPointer start) { Rect lineBounds; PhysicalCharInfo result = lineInfo.HitTest(point, snapToNearest, out lineBounds); if (result == null) { if (lineBounds.IsEmpty || point.Y < lineBounds.Top) { // The point is above the top of the current line // since lines are being scanned from top to bottom // no other line can contain the point. // Snap to the beginning of the range if (snapToNearest) { result = new PhysicalCharInfo(start); } } } return(result); }