示例#1
0
 public void Destroy()
 {
     OnDestroy();
     flags       = 0;
     element     = null;
     nextSibling = null;
     firstChild  = null;
     if (parent != null)
     {
         parent.flags |= LayoutBoxFlags.GatherChildren;
         parent        = null;
     }
 }
示例#2
0
        public void ApplyLayoutHorizontalExplicit(float localX, float size, int frameId)
        {
            LayoutResult layoutResult = element.layoutResult;

            layoutResult.alignedPosition.x   = localX;
            layoutResult.allocatedPosition.x = localX;
            layoutResult.actualSize.width    = size;
            layoutResult.allocatedSize.width = size;
            layoutResult.margin.left         = 0;
            layoutResult.margin.right        = 0;
            if (size != finalWidth)
            {
                flags     |= LayoutBoxFlags.RequireLayoutHorizontal;
                flags     |= LayoutBoxFlags.RecomputeClipping;
                finalWidth = size;
            }

            UpdateContentAreaWidth();
        }
示例#3
0
        public void UpdateContentAreaHeight()
        {
            flags &= ~LayoutBoxFlags.ContentAreaHeightChanged;
            Vector2      viewSize     = element.View.Viewport.size;
            float        emSize       = element.style.GetResolvedFontSize();
            LayoutResult layoutResult = element.layoutResult;

            float paddingTop    = MeasurementUtil.ResolveFixedSize(finalHeight, viewSize.x, viewSize.y, emSize, element.style.PaddingTop);
            float paddingBottom = MeasurementUtil.ResolveFixedSize(finalHeight, viewSize.x, viewSize.y, emSize, element.style.PaddingBottom);
            float borderTop     = MeasurementUtil.ResolveFixedSize(finalHeight, viewSize.x, viewSize.y, emSize, element.style.BorderTop);
            float borderBottom  = MeasurementUtil.ResolveFixedSize(finalHeight, viewSize.x, viewSize.y, emSize, element.style.BorderBottom);

            layoutResult.padding.top     = paddingTop;
            layoutResult.padding.bottom  = paddingBottom;
            layoutResult.border.top      = borderTop;
            layoutResult.border.bottom   = borderBottom;
            layoutResult.rebuildGeometry = true;

            paddingBorderVerticalStart = paddingTop + borderTop;
            paddingBorderVerticalEnd   = paddingBottom + borderBottom;
        }
示例#4
0
        public void UpdateContentAreaWidth()
        {
            flags &= ~LayoutBoxFlags.ContentAreaWidthChanged;
            Vector2 viewSize     = element.View.Viewport.size;
            float   emSize       = element.style.GetResolvedFontSize();
            float   paddingLeft  = MeasurementUtil.ResolveFixedSize(finalWidth, viewSize.x, viewSize.y, emSize, element.style.PaddingLeft);
            float   paddingRight = MeasurementUtil.ResolveFixedSize(finalWidth, viewSize.x, viewSize.y, emSize, element.style.PaddingRight);
            float   borderLeft   = MeasurementUtil.ResolveFixedSize(finalWidth, viewSize.x, viewSize.y, emSize, element.style.BorderLeft);
            float   borderRight  = MeasurementUtil.ResolveFixedSize(finalWidth, viewSize.x, viewSize.y, emSize, element.style.BorderRight);

            // write to layout result here? would need to flag layout result for changes anyway
            LayoutResult layoutResult = element.layoutResult;

            layoutResult.padding.left    = paddingLeft;
            layoutResult.padding.right   = paddingRight;
            layoutResult.border.left     = borderLeft;
            layoutResult.border.right    = borderRight;
            layoutResult.rebuildGeometry = true;

            paddingBorderHorizontalStart = paddingLeft + borderLeft;
            paddingBorderHorizontalEnd   = paddingRight + borderRight;
        }