示例#1
0
        internal bool HitTestCore(HitChain hitChain)
        {
            int testX;
            int testY;

            hitChain.GetTestPoint(out testX, out testY);
            if (this.RunCount == 0)
            {
                return(false);
            }
            else
            {
                LinkedListNode <EditableRun> cnode = this.First;
                int curLineTop = this.lineTop;
                hitChain.OffsetTestPoint(0, -curLineTop);
                while (cnode != null)
                {
                    if (cnode.Value.HitTestCore(hitChain))
                    {
                        hitChain.OffsetTestPoint(0, curLineTop);
                        return(true);
                    }
                    cnode = cnode.Next;
                }
                hitChain.OffsetTestPoint(0, curLineTop);
                return(false);
            }
        }
示例#2
0
        //==============================================================
        //hit test

        public bool HitTestCore(HitChain hitChain)
        {
            if ((propFlags & RenderElementConst.HIDDEN) != 0)
            {
                return(false);
            }

            int testX;
            int testY;

            hitChain.GetTestPoint(out testX, out testY);
            if ((testY >= b_top && testY <= (b_top + b_height) &&
                 (testX >= b_left && testX <= (b_left + b_width))))
            {
                if (this.MayHasViewport)
                {
                    hitChain.OffsetTestPoint(
                        -b_left + this.ViewportX,
                        -b_top + this.ViewportY);
                }
                else
                {
                    hitChain.OffsetTestPoint(-b_left, -b_top);
                }

                hitChain.AddHitObject(this);

                if (this.MayHasChild)
                {
                    this.ChildrenHitTestCore(hitChain);
                }

                if (this.MayHasViewport)
                {
                    hitChain.OffsetTestPoint(
                        b_left - this.ViewportX,
                        b_top - this.ViewportY);
                }
                else
                {
                    hitChain.OffsetTestPoint(b_left, b_top);
                }

                if ((propFlags & RenderElementConst.TRANSPARENT_FOR_ALL_EVENTS) != 0 &&
                    hitChain.TopMostElement == this)
                {
                    hitChain.RemoveCurrentHit();
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        public override bool HitTestCore(HitChain hitChain)
        {
            int testX;
            int testY;

            hitChain.GetTestPoint(out testX, out testY);
            GridCell cell = GetGridItemByPosition(testX, testY);

            if (cell != null && cell.HasContent)
            {
                hitChain.OffsetTestPoint(-cell.X, -cell.Y);
                var renderE = cell.ContentElement as RenderElement;
                if (renderE != null)
                {
                    renderE.HitTestCore(hitChain);
                }

                hitChain.OffsetTestPoint(cell.X, cell.Y);
                return(true);
            }
            return(false);
        }
示例#4
0
        //==============================================================
        //hit test

        public bool HitTestCore(HitChain hitChain)
        {
            if ((propFlags & RenderElementConst.HIDDEN) != 0)
            {
                return(false);
            }

            int testX;
            int testY;

            hitChain.GetTestPoint(out testX, out testY);

            if ((testY >= b_top && testY <= (b_top + b_height) &&
                 (testX >= b_left && testX <= (b_left + b_width))))
            {
                if (this.MayHasViewport)
                {
                    hitChain.OffsetTestPoint(
                        -b_left + this.ViewportX,
                        -b_top + this.ViewportY);
                }
                else
                {
                    hitChain.OffsetTestPoint(-b_left, -b_top);
                }

                hitChain.AddHitObject(this);
                if (this.MayHasChild)
                {
                    this.ChildrenHitTestCore(hitChain);
                }

                if (this.MayHasViewport)
                {
                    hitChain.OffsetTestPoint(
                        b_left - this.ViewportX,
                        b_top - this.ViewportY);
                }
                else
                {
                    hitChain.OffsetTestPoint(b_left, b_top);
                }

                if ((propFlags & RenderElementConst.TRANSPARENT_FOR_ALL_EVENTS) != 0 &&
                    hitChain.TopMostElement == this)
                {
                    hitChain.RemoveCurrentHit();
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                //not visual hit on this object..
                if (this.needClipArea)
                {
                    return(false);
                }

                //---
                //if this RenderElement not need clip area
                //we should test on its child

                int preTestCount = hitChain.Count;

                if (this.MayHasViewport)
                {
                    hitChain.OffsetTestPoint(
                        -b_left + this.ViewportX,
                        -b_top + this.ViewportY);
                }
                else
                {
                    hitChain.OffsetTestPoint(-b_left, -b_top);
                }


                if (this.MayHasChild)
                {
                    this.ChildrenHitTestCore(hitChain);
                }

                if (this.MayHasViewport)
                {
                    hitChain.OffsetTestPoint(
                        b_left - this.ViewportX,
                        b_top - this.ViewportY);
                }
                else
                {
                    hitChain.OffsetTestPoint(b_left, b_top);
                }

                return(hitChain.Count > preTestCount);
            }
        }