当前位置: 首页>>代码示例>>C#>>正文


C# CSSNode.markHasNewLayout方法代码示例

本文整理汇总了C#中CSSNode.markHasNewLayout方法的典型用法代码示例。如果您正苦于以下问题:C# CSSNode.markHasNewLayout方法的具体用法?C# CSSNode.markHasNewLayout怎么用?C# CSSNode.markHasNewLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSSNode的用法示例。


在下文中一共展示了CSSNode.markHasNewLayout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: layoutNode

        internal static void layoutNode(CSSLayoutContext layoutContext, CSSNode node, float parentMaxWidth, float parentMaxHeight, CSSDirection? parentDirection)
        {
            if (needsRelayout(node, parentMaxWidth, parentMaxHeight))
            {
                node.lastLayout.requestedWidth = node.layout.dimensions[DIMENSION_WIDTH];
                node.lastLayout.requestedHeight = node.layout.dimensions[DIMENSION_HEIGHT];
                node.lastLayout.parentMaxWidth = parentMaxWidth;
                node.lastLayout.parentMaxHeight = parentMaxHeight;

                layoutNodeImpl(layoutContext, node, parentMaxWidth, parentMaxHeight, parentDirection);
                node.lastLayout.copy(node.layout);
            }
            else
            {
                node.layout.copy(node.lastLayout);
            }

            node.markHasNewLayout();
        }
开发者ID:tryroach,项目名称:css-layout,代码行数:19,代码来源:LayoutEngine.cs

示例2: layoutNodeInternal


//.........这里部分代码省略.........
                    widthMeasureMode, heightMeasureMode, layout.cachedLayout))
                {
                    cachedResults = layout.cachedLayout;
                }
                else
                {
                    // Try to use the measurement cache.
                    for (int i = 0; i < layout.nextCachedMeasurementsIndex; i++)
                    {
                        if (canUseCachedMeasurement(node.IsTextNode, availableWidth, availableHeight, marginAxisRow, marginAxisColumn,
                            widthMeasureMode, heightMeasureMode, layout.cachedMeasurements[i]))
                        {
                            cachedResults = layout.cachedMeasurements[i];
                            break;
                        }
                    }
                }
            }
            else if (performLayout)
            {
                if (FloatUtil.floatsEqual(layout.cachedLayout.availableWidth, availableWidth) &&
                    FloatUtil.floatsEqual(layout.cachedLayout.availableHeight, availableHeight) &&
                    layout.cachedLayout.widthMeasureMode == widthMeasureMode &&
                    layout.cachedLayout.heightMeasureMode == heightMeasureMode)
                {

                    cachedResults = layout.cachedLayout;
                }
            }
            else
            {
                for (int i = 0; i < layout.nextCachedMeasurementsIndex; i++)
                {
                    if (FloatUtil.floatsEqual(layout.cachedMeasurements[i].availableWidth, availableWidth) &&
                        FloatUtil.floatsEqual(layout.cachedMeasurements[i].availableHeight, availableHeight) &&
                        layout.cachedMeasurements[i].widthMeasureMode == widthMeasureMode &&
                        layout.cachedMeasurements[i].heightMeasureMode == heightMeasureMode)
                    {

                        cachedResults = layout.cachedMeasurements[i];
                        break;
                    }
                }
            }

            if (!needToVisitNode && cachedResults != null)
            {
                layout.measuredDimensions[DIMENSION_WIDTH] = cachedResults.computedWidth;
                layout.measuredDimensions[DIMENSION_HEIGHT] = cachedResults.computedHeight;
            }
            else
            {
                layoutNodeImpl(layoutContext, node, availableWidth, availableHeight, parentDirection, widthMeasureMode, heightMeasureMode, performLayout);

                layout.lastParentDirection = parentDirection;

                if (cachedResults == null)
                {
                    if (layout.nextCachedMeasurementsIndex == CSSLayout.MAX_CACHED_RESULT_COUNT)
                    {
                        layout.nextCachedMeasurementsIndex = 0;
                    }

                    CSSCachedMeasurement newCacheEntry = null;
                    if (performLayout)
                    {
                        // Use the single layout cache entry.
                        newCacheEntry = layout.cachedLayout;
                    }
                    else
                    {
                        // Allocate a new measurement cache entry.
                        newCacheEntry = layout.cachedMeasurements[layout.nextCachedMeasurementsIndex];
                        if (newCacheEntry == null)
                        {
                            newCacheEntry = new CSSCachedMeasurement();
                            layout.cachedMeasurements[layout.nextCachedMeasurementsIndex] = newCacheEntry;
                        }
                        layout.nextCachedMeasurementsIndex++;
                    }

                    newCacheEntry.availableWidth = availableWidth;
                    newCacheEntry.availableHeight = availableHeight;
                    newCacheEntry.widthMeasureMode = widthMeasureMode;
                    newCacheEntry.heightMeasureMode = heightMeasureMode;
                    newCacheEntry.computedWidth = layout.measuredDimensions[DIMENSION_WIDTH];
                    newCacheEntry.computedHeight = layout.measuredDimensions[DIMENSION_HEIGHT];
                }
            }

            if (performLayout)
            {
                node.layout.dimensions[DIMENSION_WIDTH] = node.layout.measuredDimensions[DIMENSION_WIDTH];
                node.layout.dimensions[DIMENSION_HEIGHT] = node.layout.measuredDimensions[DIMENSION_HEIGHT];
                node.markHasNewLayout();
            }

            layout.generationCount = layoutContext.currentGenerationCount;
            return (needToVisitNode || cachedResults == null);
        }
开发者ID:emilsjolander,项目名称:css-layout,代码行数:101,代码来源:LayoutEngine.cs


注:本文中的CSSNode.markHasNewLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。