protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null)
        {
            RenderBox child = lastChild;

            while (child != null)
            {
                _ToolbarParentData childParentData = child.parentData as _ToolbarParentData;

                if (!childParentData.shouldPaint)
                {
                    child = childParentData.previousSibling;
                    continue;
                }

                bool isHit = result.addWithPaintOffset(
                    offset: childParentData.offset,
                    position: position,
                    hitTest: (BoxHitTestResult boxResult, Offset boxTransformed) => {
                    D.assert(boxTransformed == position - childParentData.offset);
                    return(child.hitTest(boxResult, position: boxTransformed));
                }
                    );
                if (isHit)
                {
                    return(true);
                }

                child = childParentData.previousSibling;
            }

            return(false);
        }
Esempio n. 2
0
        protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null)
        {
            D.assert(_children.Count == rows * columns);
            for (int index = _children.Count - 1; index >= 0; index--)
            {
                RenderBox child = _children[index];
                if (child != null)
                {
                    BoxParentData childParentData = (BoxParentData)child.parentData;
                    bool          isHit           = result.addWithPaintOffset(
                        offset: childParentData.offset,
                        position: position,
                        hitTest: (BoxHitTestResult resultIn, Offset transformed) => {
                        D.assert(transformed == position - childParentData.offset);
                        return(child.hitTest(resultIn, position: transformed));
                    }
                        );
                    if (isHit)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 3
0
        protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null)
        {
            RenderBox child = _lastOnstageChild;

            for (int i = 0; i < _onstageChildCount; i++)
            {
                D.assert(child != null);
                StackParentData childParentData = child.parentData as StackParentData;

                bool isHit = result.addWithPaintOffset(
                    offset: childParentData.offset,
                    position: position,
                    hitTest: (BoxHitTestResult resultIn, Offset transformed) => {
                    D.assert(transformed == position - childParentData.offset);
                    return(child.hitTest(resultIn, position: transformed));
                }
                    );
                if (isHit)
                {
                    return(true);
                }
                child = childParentData.previousSibling;
            }

            return(false);
        }
        protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null)
        {
            MultiChildLayoutParentData contentSectionParentData =
                contentSection.parentData as MultiChildLayoutParentData;
            MultiChildLayoutParentData actionsSectionParentData =
                actionsSection.parentData as MultiChildLayoutParentData;

            return(result.addWithPaintOffset(
                       offset: contentSectionParentData.offset,
                       position: position,
                       hitTest: (BoxHitTestResult resultIn, Offset transformed) => {
                D.assert(transformed == position - contentSectionParentData.offset);
                return contentSection.hitTest(resultIn, position: transformed);
            }) || result.addWithPaintOffset(
                       offset: actionsSectionParentData.offset,
                       position: position,
                       hitTest: (BoxHitTestResult resultIn, Offset transformed) => {
                D.assert(transformed == position - actionsSectionParentData.offset);
                return actionsSection.hitTest(resultIn, position: transformed);
            }
                       ));
        }
        protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null)
        {
            _ToolbarParentData childParentData = child.parentData as _ToolbarParentData;

            return(result.addWithPaintOffset(
                       offset: childParentData.offset,
                       position: position,
                       hitTest: (BoxHitTestResult boxResult, Offset boxTransformed) => {
                D.assert(boxTransformed == position - childParentData.offset);
                return child.hitTest(boxResult, position: boxTransformed);
            }
                       ));
        }
Esempio n. 6
0
        protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null)
        {
            if (this.child != null)
            {
                return(result.addWithPaintOffset(
                           offset: this._paintOffset,
                           position: position,
                           hitTest: (BoxHitTestResult resultIn, Offset transformed) => {
                    D.assert(transformed == position + (-this._paintOffset));
                    return this.child.hitTest(result, position: transformed);
                }
                           ));
            }

            return(false);
        }
Esempio n. 7
0
        public static bool hitTestBoxChild(
            this RenderSliver it,
            BoxHitTestResult result,
            RenderBox child,
            float mainAxisPosition  = 0.0f,
            float crossAxisPosition = 0.0f)
        {
            bool   rightWayUp                = _getRightWayUp(it.constraints);
            float? delta                     = it.childMainAxisPosition(child);
            float? crossAxisDelta            = it.childCrossAxisPosition(child);
            float? absolutePosition          = mainAxisPosition - delta;
            float? absoluteCrossAxisPosition = crossAxisPosition - crossAxisDelta;
            Offset paintOffset               = null;
            Offset transformedPosition       = null;

            switch (it.constraints.axis)
            {
            case Axis.horizontal:
                if (!rightWayUp)
                {
                    absolutePosition = child.size.width - absolutePosition;
                    delta            = it.geometry.paintExtent - child.size.width - delta;
                }
                paintOffset         = new Offset(delta ?? 0.0f, crossAxisDelta ?? 0.0f);
                transformedPosition = new Offset(absolutePosition ?? 0.0f, absoluteCrossAxisPosition ?? 0.0f);
                break;

            case Axis.vertical:
                if (!rightWayUp)
                {
                    absolutePosition = child.size.height - absolutePosition;
                    delta            = it.geometry.paintExtent - child.size.height - delta;
                }
                paintOffset         = new Offset(crossAxisDelta ?? 0.0f, delta ?? 0.0f);
                transformedPosition = new Offset(absoluteCrossAxisPosition ?? 0.0f, absolutePosition ?? 0.0f);
                break;
            }
            D.assert(paintOffset != null);
            D.assert(transformedPosition != null);
            return(result.addWithPaintOffset(
                       offset: paintOffset,
                       position: null, // Manually adapting from sliver to box position above.
                       hitTest: (BoxHitTestResult boxHitTestResult, Offset _) => {
                return child.hitTest(boxHitTestResult, position: transformedPosition);
            }
                       ));
        }
Esempio n. 8
0
        protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null)
        {
            if (this.child != null)
            {
                var childParentData = (BoxParentData)this.child.parentData;
                return(result.addWithPaintOffset(
                           offset: childParentData.offset,
                           position: position,
                           hitTest: (BoxHitTestResult resultIn, Offset transformed) => {
                    D.assert(transformed == position - childParentData.offset);
                    return this.child.hitTest(resultIn, position: transformed);
                }
                           ));
            }

            return(false);
        }
Esempio n. 9
0
        protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null)
        {
            if (firstChild == null)
            {
                return(false);
            }

            D.assert(position != null);
            RenderBox       child           = _childAtIndex();
            StackParentData childParentData = (StackParentData)child.parentData;

            return(result.addWithPaintOffset(
                       offset: childParentData.offset,
                       position: position,
                       hitTest: (BoxHitTestResult resultIn, Offset transformed) => {
                D.assert(transformed == position - childParentData.offset);
                return child.hitTest(resultIn, position: transformed);
            }
                       ));
        }
Esempio n. 10
0
        protected override bool hitTestChildren(BoxHitTestResult result, Offset position)
        {
            D.assert(position != null);
            foreach (RenderBox child in _children)
            {
                BoxParentData parentData = child.parentData as BoxParentData;
                bool          isHit      = result.addWithPaintOffset(
                    offset: parentData.offset,
                    position: position,
                    hitTest: (BoxHitTestResult resultIn, Offset transformed) => {
                    D.assert(transformed == position - parentData.offset);
                    return(child.hitTest(resultIn, position: transformed));
                }
                    );
                if (isHit)
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 11
0
        public bool defaultHitTestChildren(BoxHitTestResult result, Offset position)
        {
            ChildType child = lastChild;

            while (child != null)
            {
                ParentDataType childParentData = child.parentData as ParentDataType;
                bool           isHit           = result.addWithPaintOffset(
                    offset: childParentData.offset,
                    position: position,
                    hitTest: (BoxHitTestResult boxHitTestResult, Offset transformed) => {
                    D.assert(transformed == position - childParentData.offset);
                    return(child.hitTest(boxHitTestResult, position: transformed));
                }
                    );
                if (isHit)
                {
                    return(true);
                }
                child = childParentData.previousSibling;
            }
            return(false);
        }
Esempio n. 12
0
        public bool defaultHitTestChildren(BoxHitTestResult result, Offset position)
        {
            // the x, y parameters have the top left of the node's box as the origin4
            ChildType child = this.lastChild;

            while (child != null)
            {
                ParentDataType childParentData = child.parentData as ParentDataType;
                bool           isHit           = result.addWithPaintOffset(
                    offset: childParentData.offset,
                    position: position,
                    hitTest: (BoxHitTestResult boxHitTestResult, Offset transformed) => {
                    D.assert(transformed == position - childParentData.offset);
                    return(child.hitTest(boxHitTestResult, position: transformed));
                }
                    );
                if (isHit)
                {
                    return(true);
                }
                child = childParentData.previousSibling;
            }
            return(false);
        }