Open 3D Engine LyShine Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
UiInteractableInterface Class Referenceabstract

Inherits AZ::ComponentBus.

Public Member Functions

virtual bool CanHandleEvent (AZ::Vector2 point)=0
 Check whether this component can handle the event at the given location.
 
virtual bool HandlePressed (AZ::Vector2 point, bool &shouldStayActive)=0
 
virtual bool HandleReleased (AZ::Vector2 point)=0
 
virtual bool HandleMultiTouchPressed (AZ::Vector2 point, int multiTouchIndex)=0
 
virtual bool HandleMultiTouchReleased (AZ::Vector2 point, int multiTouchIndex)=0
 
virtual bool HandleEnterPressed (bool &shouldStayActive)
 
virtual bool HandleEnterReleased ()
 
virtual bool HandleAutoActivation ()
 
virtual bool HandleTextInput (const AZStd::string &textUTF8)
 
virtual bool HandleKeyInputBegan (const AzFramework::InputChannel::Snapshot &inputSnapshot, AzFramework::ModifierKeyMask activeModifierKeys)
 
virtual void InputPositionUpdate (AZ::Vector2 point)
 
virtual void MultiTouchPositionUpdate (AZ::Vector2 point, int multiTouchIndex)
 
virtual bool DoesSupportDragHandOff (AZ::Vector2 startPoint)
 
virtual bool OfferDragHandOff (AZ::EntityId currentActiveInteractable, AZ::Vector2 startPoint, AZ::Vector2 currentPoint, float dragThreshold)
 
virtual void LostActiveStatus ()
 Called on the currently active interactable component when the active interactable changes.
 
virtual void HandleHoverStart ()=0
 Called when mouse/touch enters the bounds of this interactable.
 
virtual void HandleHoverEnd ()=0
 Called on the currently hovered interactable component when mouse/touch moves outside of bounds.
 
virtual void HandleDescendantReceivedHoverByNavigation (AZ::EntityId descendantEntityId)
 Called when a descendant of the interactable becomes the hover interactable by being navigated to.
 
virtual void HandleReceivedHoverByNavigatingFromDescendant (AZ::EntityId descendantEntityId)
 Called when the interactable becomes the hover interactable by being navigated to from one of its descendants.
 
virtual bool IsPressed ()
 Query whether the interactable is currently pressed.
 
virtual bool IsHandlingEvents ()
 Enable/disable event handling.
 
virtual void SetIsHandlingEvents (bool isHandlingEvents)
 
virtual bool IsHandlingMultiTouchEvents ()
 Enable/disable multi-touch event handling.
 
virtual void SetIsHandlingMultiTouchEvents (bool isHandlingMultiTouchEvents)
 
virtual bool GetIsAutoActivationEnabled ()=0
 Get/set whether the interactable automatically becomes active when navigated to via gamepad/keyboard.
 
virtual void SetIsAutoActivationEnabled (bool isEnabled)=0
 

Static Public Attributes

static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single
 Only one component on a entity can implement the events.
 

Member Function Documentation

◆ DoesSupportDragHandOff()

virtual bool UiInteractableInterface::DoesSupportDragHandOff ( AZ::Vector2  startPoint)
inlinevirtual

Returns true if this interactable supports taking active status when a drag is started on a child interactble AND the given drag startPoint would be a valid drag start point

Parameters
point,thestart point of the drag (which would be on a child interactable) (viewport space)

◆ HandleAutoActivation()

virtual bool UiInteractableInterface::HandleAutoActivation ( )
inlinevirtual

Called when the interactable was navigated to via gamepad/keyboard, and auto activation is enabled on the interactable

Returns
true if the interactable handled the event

◆ HandleEnterPressed()

virtual bool UiInteractableInterface::HandleEnterPressed ( bool &  shouldStayActive)
inlinevirtual

Called on an interactable component when an enter pressed event is received

Parameters
shouldStayActive,output- true if the interactable wants to become the active element for the canvas
Returns
true if the interactable handled the event

◆ HandleEnterReleased()

virtual bool UiInteractableInterface::HandleEnterReleased ( )
inlinevirtual

Called on the currently pressed interactable component when an enter released event is received

Returns
true if the interactable handled the event

◆ HandleKeyInputBegan()

virtual bool UiInteractableInterface::HandleKeyInputBegan ( const AzFramework::InputChannel::Snapshot &  inputSnapshot,
AzFramework::ModifierKeyMask  activeModifierKeys 
)
inlinevirtual

Called on the currently active interactable component when input is received

Returns
true if the interactable handled the event

◆ HandleMultiTouchPressed()

virtual bool UiInteractableInterface::HandleMultiTouchPressed ( AZ::Vector2  point,
int  multiTouchIndex 
)
pure virtual

Called on an interactable component when a multi-touch pressed event is received over it

Parameters
point,thepoint at which the event occurred (viewport space)
multiTouchIndex,theindex of the multi-touch (the 'primary' touch with index 0 is sent to HandlePressed)
Returns
true if the interactable handled the event

◆ HandleMultiTouchReleased()

virtual bool UiInteractableInterface::HandleMultiTouchReleased ( AZ::Vector2  point,
int  multiTouchIndex 
)
pure virtual

Called on the currently pressed interactable component when a multi-touch release event is received

Parameters
point,thepoint at which the event occurred (viewport space)
multiTouchIndex,theindex of the multi-touch (the 'primary' touch with index 0 is sent to HandlePressed)
Returns
true if the interactable handled the event

◆ HandlePressed()

virtual bool UiInteractableInterface::HandlePressed ( AZ::Vector2  point,
bool &  shouldStayActive 
)
pure virtual

Called on an interactable component when a pressed event is received over it

Parameters
point,thepoint at which the event occurred (viewport space)
shouldStayActive,output- true if the interactable wants to become the active element for the canvas
Returns
true if the interactable handled the event

◆ HandleReleased()

virtual bool UiInteractableInterface::HandleReleased ( AZ::Vector2  point)
pure virtual

Called on the currently pressed interactable component when a release event is received

Parameters
point,thepoint at which the event occurred (viewport space)
Returns
true if the interactable handled the event

◆ HandleTextInput()

virtual bool UiInteractableInterface::HandleTextInput ( const AZStd::string &  textUTF8)
inlinevirtual

Called on the currently active interactable component when text input is received

Returns
true if the interactable handled the event

◆ InputPositionUpdate()

virtual void UiInteractableInterface::InputPositionUpdate ( AZ::Vector2  point)
inlinevirtual

Called on the currently active interactable component when a mouse/touch position event is received

Parameters
point,thecurrent mouse/touch position (viewport space)

◆ MultiTouchPositionUpdate()

virtual void UiInteractableInterface::MultiTouchPositionUpdate ( AZ::Vector2  point,
int  multiTouchIndex 
)
inlinevirtual

Called on the currently pressed interactable component when a multi-touch position event is received

Parameters
point,thecurrent mouse/touch position (viewport space)
multiTouchIndex,theindex of the multi-touch (the 'primary' touch with index 0 is sent to HandlePressed)

◆ OfferDragHandOff()

virtual bool UiInteractableInterface::OfferDragHandOff ( AZ::EntityId  currentActiveInteractable,
AZ::Vector2  startPoint,
AZ::Vector2  currentPoint,
float  dragThreshold 
)
inlinevirtual

Called on a parent of the currently active interactable element to allow interactables that contain other interactables to support drags that start on the child. If this return true the hand-off occured and the caller will no longer be considered the active interactable by the canvas.

Parameters
currentActiveInteractable,thechild element that is the currently active interactable
startPoint,thestart point of the potential drag (viewport space)
currentPoint,thecurrent points of the potential drag (viewport space)

The documentation for this class was generated from the following file: