示例#1
0
        public override void paint(PaintingContext context, Offset offset)
        {
            if (!_hasOverflow)
            {
                defaultPaint(context, offset);
                return;
            }

            if (size.isEmpty)
            {
                return;
            }

            context.pushClipRect(needsCompositing, offset, Offset.zero & size, defaultPaint);

            D.assert(() => {
                List <DiagnosticsNode> debugOverflowHints = new List <DiagnosticsNode> {
                    new ErrorDescription(
                        $"The overflowing {GetType()} has an orientation of {_direction}."
                        ),
                    new ErrorDescription(
                        $"The edge of the {GetType()} that is overflowing has been marked " +
                        "in the rendering with a yellow and black striped pattern. This is " +
                        "usually caused by the contents being too big for the {GetType()}."
                        ),
                    new ErrorHint(
                        "Consider applying a flex factor (e.g. using an Expanded widget) to " +
                        $"force the children of the {GetType()} to fit within the available " +
                        "space instead of being sized to their natural size."
                        ),
                    new ErrorHint(
                        "This is considered an error condition because it indicates that there " +
                        "is content that cannot be seen. If the content is legitimately bigger " +
                        "than the available space, consider clipping it with a ClipRect widget " +
                        "before putting it in the flex, or using a scrollable container rather " +
                        "than a Flex, like a ListView."
                        )
                };

                Rect overflowChildRect;
                switch (_direction)
                {
                case Axis.horizontal:
                    overflowChildRect = Rect.fromLTWH(0.0f, 0.0f, size.width + _overflow, 0.0f);
                    break;

                case Axis.vertical:
                    overflowChildRect = Rect.fromLTWH(0.0f, 0.0f, 0.0f, size.height + _overflow);
                    break;

                default:
                    throw new Exception("Unknown direction: " + _direction);
                }

                DebugOverflowIndicatorMixin.paintOverflowIndicator(this, context, offset, Offset.zero & size,
                                                                   overflowChildRect, overflowHints: debugOverflowHints);
                return(true);
            });
        }
示例#2
0
文件: stack.cs 项目: JC-ut0/CubeGame
 public override void paint(PaintingContext context, Offset offset)
 {
     if (this._overflow == Overflow.clip && this._hasVisualOverflow)
     {
         context.pushClipRect(this.needsCompositing, offset, Offset.zero & this.size, this.paintStack);
     }
     else
     {
         this.paintStack(context, offset);
     }
 }
示例#3
0
 public override void paint(PaintingContext context, Offset offset)
 {
     if (this._hasVisualOverflow)
     {
         context.pushClipRect(this.needsCompositing, offset, Offset.zero & this.size, this.defaultPaint);
     }
     else
     {
         this.defaultPaint(context, offset);
     }
 }
示例#4
0
 public override void paint(PaintingContext context, Offset offset)
 {
     if (_hasVisualOverflow)
     {
         context.pushClipRect(needsCompositing, offset, Offset.zero & size, paintStack);
     }
     else
     {
         paintStack(context, offset);
     }
 }
示例#5
0
 public override void paint(PaintingContext context, Offset offset)
 {
     if (this.child != null && this._hasVisualOverflow)
     {
         Rect rect = Offset.zero & this.size;
         context.pushClipRect(this.needsCompositing, offset, rect, base.paint);
     }
     else
     {
         base.paint(context, offset);
     }
 }
示例#6
0
 public override void paint(PaintingContext context, Offset offset)
 {
     this._layoutText(this.constraints.maxWidth);
     if (this._hasVisualOverflow)
     {
         context.pushClipRect(this.needsCompositing, offset, Offset.zero & this.size, this._paintContents);
     }
     else
     {
         this._paintContents(context, offset);
     }
 }
示例#7
0
        public override void paint(PaintingContext context, Offset offset)
        {
            if (this._overflow <= 0.0)
            {
                this.defaultPaint(context, offset);
                return;
            }

            if (this.size.isEmpty)
            {
                return;
            }

            context.pushClipRect(this.needsCompositing, offset, Offset.zero & this.size, this.defaultPaint);
        }
示例#8
0
        public override void paint(PaintingContext context, Offset offset)
        {
            if (this.child == null || this.size.isEmpty)
            {
                return;
            }

            if (!this._isOverflowing)
            {
                base.paint(context, offset);
                return;
            }

            context.pushClipRect(this.needsCompositing, offset, Offset.zero & this.size, base.paint);
        }
 public override void paint(PaintingContext context, Offset offset)
 {
     if (this.childCount > 0)
     {
         if (this._clipToSize && this._shouldClipAtCurrentOffset())
         {
             context.pushClipRect(
                 this.needsCompositing,
                 offset,
                 Offset.zero & this.size, this._paintVisibleChildren
                 );
         }
         else
         {
             this._paintVisibleChildren(context, offset);
         }
     }
 }
示例#10
0
        public override void paint(PaintingContext context, Offset offset)
        {
            if (this.child == null || this.size.isEmpty)
            {
                return;
            }

            if (!this._isOverflowing)
            {
                base.paint(context, offset);
                return;
            }

            context.pushClipRect(this.needsCompositing, offset, Offset.zero & this.size, base.paint);
            D.assert(() => {
                DebugOverflowIndicatorMixin.paintOverflowIndicator(this, context, offset, this._overflowContainerRect, this._overflowChildRect);
                return(true);
            });
        }
示例#11
0
        public override void paint(PaintingContext context, Offset offset)
        {
            if (this.child != null)
            {
                Offset paintOffset = this._paintOffset;

                void paintContents(PaintingContext subContext, Offset SubOffset)
                {
                    subContext.paintChild(this.child, SubOffset + paintOffset);
                }

                if (this._shouldClipAtPaintOffset(paintOffset))
                {
                    context.pushClipRect(this.needsCompositing, offset, Offset.zero & this.size, paintContents);
                }
                else
                {
                    paintContents(context, offset);
                }
            }
        }
        void _paintChildWithMagnifier(
            PaintingContext context,
            Offset offset,
            RenderBox child,
            // Matrix4x4 cylindricalTransform,
            Matrix3 cylindricalTransform,
            Offset offsetToCenter,
            Offset untransformedPaintingCoordinates
            )
        {
            float magnifierTopLinePosition    = this.size.height / 2 - this._itemExtent * this._magnification / 2;
            float magnifierBottomLinePosition = this.size.height / 2 + this._itemExtent * this._magnification / 2;

            bool isAfterMagnifierTopLine = untransformedPaintingCoordinates.dy
                                           >= magnifierTopLinePosition - this._itemExtent * this._magnification;
            bool isBeforeMagnifierBottomLine = untransformedPaintingCoordinates.dy
                                               <= magnifierBottomLinePosition;

            if (isAfterMagnifierTopLine && isBeforeMagnifierBottomLine)
            {
                Rect centerRect = Rect.fromLTWH(
                    0.0f,
                    magnifierTopLinePosition, this.size.width, this._itemExtent * this._magnification);
                Rect topHalfRect = Rect.fromLTWH(
                    0.0f,
                    0.0f, this.size.width,
                    magnifierTopLinePosition);
                Rect bottomHalfRect = Rect.fromLTWH(
                    0.0f,
                    magnifierBottomLinePosition, this.size.width,
                    magnifierTopLinePosition);

                context.pushClipRect(
                    false,
                    offset,
                    centerRect,
                    (PaintingContext context1, Offset offset1) => {
                    context1.pushTransform(
                        false,
                        offset1,
                        cylindricalTransform,
                        // this._centerOriginTransform(cylindricalTransform),
                        (PaintingContext context2, Offset offset2) => {
                        context2.paintChild(
                            child,
                            offset2 + untransformedPaintingCoordinates);
                    });
                });

                context.pushClipRect(
                    false,
                    offset,
                    untransformedPaintingCoordinates.dy <= magnifierTopLinePosition
                        ? topHalfRect
                        : bottomHalfRect,
                    (PaintingContext context1, Offset offset1) => {
                    this._paintChildCylindrically(
                        context1,
                        offset1,
                        child,
                        cylindricalTransform,
                        offsetToCenter
                        );
                }
                    );
            }
            else
            {
                this._paintChildCylindrically(
                    context,
                    offset,
                    child,
                    cylindricalTransform,
                    offsetToCenter
                    );
            }
        }
示例#13
0
        void _paintChildWithMagnifier(
            PaintingContext context,
            Offset offset,
            RenderBox child,
            Matrix4 cylindricalTransform,
            Offset offsetToCenter,
            Offset untransformedPaintingCoordinates
            )
        {
            float magnifierTopLinePosition    = size.height / 2 - _itemExtent * _magnification / 2;
            float magnifierBottomLinePosition = size.height / 2 + _itemExtent * _magnification / 2;

            bool isAfterMagnifierTopLine = untransformedPaintingCoordinates.dy
                                           >= magnifierTopLinePosition - _itemExtent * _magnification;
            bool isBeforeMagnifierBottomLine = untransformedPaintingCoordinates.dy
                                               <= magnifierBottomLinePosition;

            if (isAfterMagnifierTopLine && isBeforeMagnifierBottomLine)
            {
                Rect centerRect = Rect.fromLTWH(
                    0.0f,
                    magnifierTopLinePosition,
                    size.width,
                    _itemExtent * _magnification);
                Rect topHalfRect = Rect.fromLTWH(
                    0.0f,
                    0.0f, size.width,
                    magnifierTopLinePosition);
                Rect bottomHalfRect = Rect.fromLTWH(
                    0.0f,
                    magnifierBottomLinePosition,
                    size.width,
                    magnifierTopLinePosition);

                context.pushClipRect(
                    needsCompositing,
                    offset,
                    centerRect,
                    (PaintingContext context1, Offset offset1) => {
                    context1.pushTransform(
                        needsCompositing,
                        offset1,
                        _magnifyTransform(),
                        (PaintingContext context2, Offset offset2) => {
                        context2.paintChild(child, offset2 + untransformedPaintingCoordinates);
                    });
                });

                context.pushClipRect(
                    needsCompositing,
                    offset,
                    untransformedPaintingCoordinates.dy <= magnifierTopLinePosition
                        ? topHalfRect
                        : bottomHalfRect,
                    (PaintingContext context1, Offset offset1) => {
                    _paintChildCylindrically(
                        context1,
                        offset1,
                        child,
                        cylindricalTransform,
                        offsetToCenter
                        );
                }
                    );
            }
            else
            {
                _paintChildCylindrically(
                    context,
                    offset,
                    child,
                    cylindricalTransform,
                    offsetToCenter
                    );
            }
        }