Catlike Coding
Unity Code Documentation
|
Element of a clip hierarchy. More...
Inherits MonoBehaviour.
Inherited by CatlikeCoding.Clipping.ClipBox, CatlikeCoding.Clipping.ClipBoxScrollbar, CatlikeCoding.Clipping.ClippedSlicedSprite, CatlikeCoding.Clipping.Scrollbar3DInput, CatlikeCoding.Clipping.ScrollbarInput3D, and CatlikeCoding.TextBox.ClippedTextBox.
Public Member Functions | |
void | InitializeClipHierarchy () |
Initialize the clip hierarchy. This method is already called at the appropriate places, you typically should have no reason to call it yourself. More... | |
void | UpdateClipHierarchy () |
Update the clip hierarchy if this element's parent changed. Call this method after changing the transform parent of this element, if it was or is now part of a clip hierarchy. More... | |
void | UpdateHierarchyBounds () |
Update the bounds of the entire clip hierarchy that this element is a part of. More... | |
Public Attributes | |
bool | clipsChildren |
Whether the element uses its content bounds to clip its children. More... | |
bool | notifiesParent = true |
Whether the element notifies its parent when its bounds have changed. More... | |
Protected Member Functions | |
virtual void | OnClipBoundsChanged () |
Called when the clip bounds have changed, because the hierarchy bounds have changed. More... | |
virtual void | OnContentBoundsChanged () |
Called when the content bounds have changed, by setting ContentBounds. More... | |
virtual void | OnDestroy () |
Called by Unity when the component is destroyed. More... | |
virtual void | OnEnable () |
Called by Unity when the component is enabled. More... | |
Protected Attributes | |
Bounds2D | clipBounds |
Clip bounds. More... | |
List< ClippedElement > | clipChildren |
Clip children. More... | |
ClippedElement | clipParent |
Clip parent. More... | |
Bounds2D | contentBounds |
Content bounds. More... | |
Properties | |
Bounds2D | ClipBounds [get] |
Get the clip bounds. More... | |
Bounds2D | ContentBounds [get, set] |
Get or set the content bounds. More... | |
Bounds2D | ContentBoundsForParent [get] |
Get the content bounds for use by the element's direct parent. More... | |
Element of a clip hierarchy.
Clip hierarchies allow nested 2D clipping, but the elements in the hierarchy cannot be scaled or rotated. These limitations exist because the clipping happens in local space, which enables nesting but cannot deal with scaling or rotation inside the hierarchy. The root element of the clip hierarchy is the only element that can be rotated, which rotates the entire hierarchy. It still cannot be scaled.
void CatlikeCoding.Clipping.ClippedElement.InitializeClipHierarchy | ( | ) |
Initialize the clip hierarchy. This method is already called at the appropriate places, you typically should have no reason to call it yourself.
|
protectedvirtual |
Called when the clip bounds have changed, because the hierarchy bounds have changed.
Does nothing. Override if you need to respond to this change.
Reimplemented in CatlikeCoding.Clipping.ClippedSlicedSprite, CatlikeCoding.Clipping.ClipBox, CatlikeCoding.Clipping.Scrollbar3DInput, CatlikeCoding.Clipping.ScrollbarInput3D, CatlikeCoding.TextBox.ClippedTextBox, and CatlikeCoding.TextBox.ClippedTextBoxCollider3D.
|
protectedvirtual |
Called when the content bounds have changed, by setting ContentBounds.
Does nothing. Override if you need to respond to this change.
Reimplemented in CatlikeCoding.Clipping.ClippedSlicedSprite.
|
protectedvirtual |
Called by Unity when the component is destroyed.
Subclasses with their own OnDestroy functionality should override this method and call this base version. It ensures that the clip hierarchy stays valid.
Reimplemented in CatlikeCoding.Clipping.ClipBoxScrollbar, CatlikeCoding.Clipping.ClippedSlicedSprite, and CatlikeCoding.TextBox.ClippedTextBox.
|
protectedvirtual |
Called by Unity when the component is enabled.
Subclasses with their own OnEnable functionality should override this method and call this base version. It ensures that clip hierarchy gets initialized.
Reimplemented in CatlikeCoding.Clipping.ClipBoxScrollbar, CatlikeCoding.Clipping.ClippedSlicedSprite, and CatlikeCoding.TextBox.ClippedTextBox.
void CatlikeCoding.Clipping.ClippedElement.UpdateClipHierarchy | ( | ) |
Update the clip hierarchy if this element's parent changed. Call this method after changing the transform parent of this element, if it was or is now part of a clip hierarchy.
void CatlikeCoding.Clipping.ClippedElement.UpdateHierarchyBounds | ( | ) |
Update the bounds of the entire clip hierarchy that this element is a part of.
|
protected |
Clip bounds.
|
protected |
Clip children.
|
protected |
Clip parent.
bool CatlikeCoding.Clipping.ClippedElement.clipsChildren |
Whether the element uses its content bounds to clip its children.
Root elements of clip hierarchies ignore this value and always clip their children.
|
protected |
Content bounds.
When changing this directly instead of using the ContentBounds property, OnContentBoundsChanged and UpdateHierarchyBounds will not be called.
bool CatlikeCoding.Clipping.ClippedElement.notifiesParent = true |
Whether the element notifies its parent when its bounds have changed.
Disable this for frequently changing elements of which you know they'll never influence the hierarchy bounds. This will prevent needless updates of the hierarchy. Also disable it for elements that change themselves in reaction to hierarchy updates - like scrollbars - to prevent recursion warnings from UpdateHierarchyBounds.
|
get |
Get the clip bounds.
|
getset |
Get or set the content bounds.
OnContentBoundsChanged, UpdateHierarchyBounds, and probably OnClipBoundsChanged will be called if the content bounds are changed, but not if the bounds remain the same.
|
get |
Get the content bounds for use by the element's direct parent.
The bounds are in the parent's local space and take child bounds into consideration, if the element is not clipping them.