/// <summary>
        ///
        /// </summary>
        /// <param name="text"></param>
        /// <param name="rect"></param>
        /// <param name="selected"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <returns></returns>
        public static bool HitTestText(XText text, Rect2 rect, ISet <BaseShape> selected, double dx, double dy)
        {
            if (RectangleBounds.GetTextBounds(text, dx, dy).IntersectsWith(rect))
            {
                if (selected != null)
                {
                    selected.Add(text);
                    return(false);
                }
                else
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="text"></param>
        /// <param name="v"></param>
        /// <param name="threshold"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <returns></returns>
        public static BaseShape HitTestText(XText text, Vector2 v, double threshold, double dx, double dy)
        {
            if (RectangleBounds.GetPointBounds(text.TopLeft, threshold, dx, dy).Contains(v))
            {
                return(text.TopLeft);
            }

            if (RectangleBounds.GetPointBounds(text.BottomRight, threshold, dx, dy).Contains(v))
            {
                return(text.BottomRight);
            }

            if (RectangleBounds.GetTextBounds(text, dx, dy).Contains(v))
            {
                return(text);
            }

            return(null);
        }