Catlike Coding
Unity Code Documentation
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
CatlikeCoding.Clipping.ScrollbarInput3D Class Reference

Component that adds 3D input support to ClipBoxScrollbar. More...

Inherits CatlikeCoding.Clipping.ClippedElement, CatlikeCoding.EventSystem.IPointerDownHandler, CatlikeCoding.EventSystem.IPointerUpHandler, and CatlikeCoding.EventSystem.IDragHandler.

Public Member Functions

void OnDrag (PointerEventData eventData)
 Called on the same component that the pointer went down on, after OnBeginDrag each time a pointer move is detected before it goes up. More...
 
void OnPointerDown (PointerEventData eventData)
 Called when pointer went down on this component. More...
 
void OnPointerUp (PointerEventData eventData)
 Called on the same component that the pointer went down on, after it went up. More...
 
- Public Member Functions inherited from CatlikeCoding.Clipping.ClippedElement
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

Vector2 activeColliderScale = Vector2.one
 Factor to scale the collider with when it's being dragged. More...
 
Vector2 inactiveColliderScale = Vector2.one
 Factor to scale the collider with when it's not being dragged. More...
 
ClipBoxScrollbar scrollbar
 Scrollbar to control. More...
 
- Public Attributes inherited from CatlikeCoding.Clipping.ClippedElement
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

override void OnClipBoundsChanged ()
 Called when the clip bounds have changed, because the hierarchy bounds have changed. More...
 
- Protected Member Functions inherited from CatlikeCoding.Clipping.ClippedElement
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...
 

Additional Inherited Members

- Protected Attributes inherited from CatlikeCoding.Clipping.ClippedElement
Bounds2D clipBounds
 Clip bounds. More...
 
List< ClippedElementclipChildren
 Clip children. More...
 
ClippedElement clipParent
 Clip parent. More...
 
Bounds2D contentBounds
 Content bounds. More...
 
- Properties inherited from CatlikeCoding.Clipping.ClippedElement
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...
 

Detailed Description

Component that adds 3D input support to ClipBoxScrollbar.

It is intended to place this component on a child object of a ClippedBoxScrollbar. It will then add a box collider and make sure it stays inside the clip bounds.

You typically make the box collider a trigger, so it doesn't interact with solid objects.

Member Function Documentation

override void CatlikeCoding.Clipping.ScrollbarInput3D.OnClipBoundsChanged ( )
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 from CatlikeCoding.Clipping.ClippedElement.

void CatlikeCoding.Clipping.ScrollbarInput3D.OnDrag ( PointerEventData  eventData)

Called on the same component that the pointer went down on, after OnBeginDrag each time a pointer move is detected before it goes up.

Parameters
eventDataEvent data.

Implements CatlikeCoding.EventSystem.IDragHandler.

void CatlikeCoding.Clipping.ScrollbarInput3D.OnPointerDown ( PointerEventData  eventData)

Called when pointer went down on this component.

Typically a mouse click or touch.

Parameters
eventDataEvent data.

Implements CatlikeCoding.EventSystem.IPointerDownHandler.

void CatlikeCoding.Clipping.ScrollbarInput3D.OnPointerUp ( PointerEventData  eventData)

Called on the same component that the pointer went down on, after it went up.

It's not called on the component that the pointer is currently on, if any.

Parameters
eventDataEvent data.

Implements CatlikeCoding.EventSystem.IPointerUpHandler.

Member Data Documentation

Vector2 CatlikeCoding.Clipping.ScrollbarInput3D.activeColliderScale = Vector2.one

Factor to scale the collider with when it's being dragged.

By making this larger than one, you guarantee that there's an area around the scrollbar that will detect user dragging even when not inside the scrollbar's surface. This is very convenient for the user.

Vector2 CatlikeCoding.Clipping.ScrollbarInput3D.inactiveColliderScale = Vector2.one

Factor to scale the collider with when it's not being dragged.

By making this larger than one, the collider will be scaled up so the user doesn't have to exactly hit the scrollbar's surface. This is convenient when using small scrollbars, especially with touch input.

As the scaling happens after clipping, the collider can expand outside of its clip area.

ClipBoxScrollbar CatlikeCoding.Clipping.ScrollbarInput3D.scrollbar

Scrollbar to control.