示例#1
0
文件: stack.cs 项目: JC-ut0/CubeGame
        public override void paintStack(PaintingContext context, Offset offset)
        {
            if (this.firstChild == null || this.index == null)
            {
                return;
            }

            RenderBox       child           = this._childAtIndex();
            StackParentData childParentData = (StackParentData)child.parentData;

            context.paintChild(child, childParentData.offset + offset);
        }
示例#2
0
文件: stack.cs 项目: JC-ut0/CubeGame
        protected override bool hitTestChildren(HitTestResult result, Offset position)
        {
            if (this.firstChild == null || this.index == null)
            {
                return(false);
            }

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

            return(child.hitTest(result, position: position - childParentData.offset));
        }
示例#3
0
        RenderBox _childAtIndex()
        {
            RenderBox child = firstChild;
            int       i     = 0;

            while (child != null && i < index)
            {
                StackParentData childParentData = (StackParentData)child.parentData;
                child = childParentData.nextSibling;
                i    += 1;
            }

            D.assert(i == index);
            D.assert(child != null);
            return(child);
        }
示例#4
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);
            }
                       ));
        }