Class TreeAlgorithm4beta2
This file contains the 'start a layout / relayout / detect a relayout / optimize relayout' parts.
Implements
Inherited Members
Namespace: NinjaTools.FlexBuilder.LayoutAlgorithms
Assembly: cs.temp.dll.dll
Syntax
public class TreeAlgorithm4beta2 : ITreeUpdateAlgorithmV4, IFlexboxDescribableLayoutAlgorithm
Properties
- (String) defaultAssetName
Used when creating new instances automatically in the Inspector or the 'auto-fix' dialog boxes
Overrides
- (ReadOnlyCollection<String>) featureDescription
Overrides
Methods
- (void) ChildContentSizeChanged(FlexContainer, FlexItem)
When something (internal or external) changes the flex 'content-size' of a FlexItem, such that the containing FlexContainer may need to do a relayout (at the very least: will nearly always need to reposition the child); most common example is user editing a Text component's string, and/or changing the anchored positions of a child UI component, or the 'size to fit' setting of a Text component, etc.
Parameters
FlexContainer | parent | |
FlexItem | childChanged |
Overrides
- (void) ChildrenChanged(FlexContainer)
Called both because children were added/removed AND because children were enabled/disabled
Parameters
FlexContainer | fc |
Overrides
- (void) ChildSizeAndOrPositionNeedsReinstating(FlexContainer, FlexItem)
- (void) ContainerPositionNeedsReinstating(FlexContainer)
- (void) ContainerSizeAndOrPositionNeedsReinstating(FlexContainer)
- (void) ContainerSizeAndOrPositionNeedsReinstating(RootFlexContainer)
- (void) FlexContainerAddedOrCreated(FlexContainer, String)
- (void) FlexItemAddedOrCreated(FlexItem, String)
- (void) FlexPropertyPathModified(FlexContainer, String)
- (void) FlexPropertyPathModified(FlexItem, String)
- (void) ForceRelayoutFullTree(RootFlexContainer, String)
- (String) GetDebugInfo(FlexContainer)
- (void) InvalidateContainerDontRelayout(FlexContainer)
Invalidates a specific container
Currently recurses up the tree and invalidates ALL ancestors, because this version of the layout algorithms expects that (sub-optimal, but cost is usually low)
Parameters
FlexContainer | fc |
- (void) InvalidateItemInternals(FlexItem)
This potentially duplicates the meaning of _CacheInvalidateMinContentSize(FlexItem) and _CacheInvalidateMaxContentSize(FlexItem) - but as of 2023 v4.0, those methods are not being actively used (MIN/MAX CONTENT_Size caching is currently not performed, because of problems with it in the 2023-beta). If those methods get re-implemented successfully, it would be sufficient to move the meat of this method into those two iff we retain this method for the cases where those two aren't invoked (they are ONLY invoked on FlexItems iff the FlexItem also is a FlexContainer).
i.e. this method is currently the ONLY place that a "Flexitem-without-a-FlexContainer" gets to perform invalidation -- so it cannot be removed entirely, needs to be preserved (although the name could change to synch better with NinjaTools.FlexBuilder.LayoutAlgorithms.TreeAlgorithm4beta2.Invalidate(NinjaTools.FlexBuilder.FlexContainer), perhaps).
Invalidates a specific FlexItem - Note: this doesn't affect Flex layout, but it gives a chance to invalidate non-flexbox children (or: attached components) on FlexItems -- especially: The TMP caching that's automatically done on TMP_Text items to workaround the very slow performance of TextMeshPro in multiple cases.
Parameters
FlexItem | item |
- (void) LayoutAlgorithmChanged(RootFlexContainer, IFlexboxLayoutAlgorithm, IFlexboxLayoutAlgorithm)
Parameters
RootFlexContainer | rfc | |
IFlexboxLayoutAlgorithm | oldValue | |
IFlexboxLayoutAlgorithm | newValue |
Overrides
- (void) RecursivelyInvalidateSelfAndAllAncestorsDontRelayout(FlexContainer)
- (void) RootContainerAddedToCanvas(RootFlexContainer)
Unity's UI does this badly: when a RectTransform is reparented, it FORCES itself to have the position on the old Canvas - in screen/world-space! - which is never the right decision.
Ideally we'd maintain our anchors in new canvas/parent to (relatively) match what they were in the old parent; instead we settle for: 'resizing-to-fit before we layout'. TODO: replace the ExpandToFillParent with a 're-instate relative positions in new space'
Parameters
RootFlexContainer | rfc |