Open 3D Engine LyShine Gem API Reference  24.09
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 ([[maybe_unused]] bool &shouldStayActive)
 
virtual bool HandleEnterReleased ()
 
virtual bool HandleAutoActivation ()
 
virtual bool HandleTextInput ([[maybe_unused]] const AZStd::string &textUTF8)
 
virtual bool HandleKeyInputBegan ([[maybe_unused]] const AzFramework::InputChannel::Snapshot &inputSnapshot, [[maybe_unused]] AzFramework::ModifierKeyMask activeModifierKeys)
 
virtual void InputPositionUpdate ([[maybe_unused]] AZ::Vector2 point)
 
virtual void MultiTouchPositionUpdate ([[maybe_unused]] AZ::Vector2 point, [[maybe_unused]] int multiTouchIndex)
 
virtual bool DoesSupportDragHandOff ([[maybe_unused]] AZ::Vector2 startPoint)
 
virtual bool OfferDragHandOff ([[maybe_unused]] AZ::EntityId currentActiveInteractable, [[maybe_unused]] AZ::Vector2 startPoint, [[maybe_unused]] AZ::Vector2 currentPoint, [[maybe_unused]] 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 ([[maybe_unused]] AZ::EntityId descendantEntityId)
 Called when a descendant of the interactable becomes the hover interactable by being navigated to.
 
virtual void HandleReceivedHoverByNavigatingFromDescendant ([[maybe_unused]] 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 ([[maybe_unused]] bool isHandlingEvents)
 
virtual bool IsHandlingMultiTouchEvents ()
 Enable/disable multi-touch event handling.
 
virtual void SetIsHandlingMultiTouchEvents ([[maybe_unused]] 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 ( [[maybe_unused] ] 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 ( [[maybe_unused] ] 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 ( [[maybe_unused] ] const AzFramework::InputChannel::Snapshot &  inputSnapshot,
[[maybe_unused] ] 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 ( [[maybe_unused] ] 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 ( [[maybe_unused] ] 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 ( [[maybe_unused] ] AZ::Vector2  point,
[[maybe_unused] ] 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 ( [[maybe_unused] ] AZ::EntityId  currentActiveInteractable,
[[maybe_unused] ] AZ::Vector2  startPoint,
[[maybe_unused] ] AZ::Vector2  currentPoint,
[[maybe_unused] ] 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: