Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

Interface IHitTestDelegate

interface IHitTestDelegate
Extends com.amazon.apmf.IStandard This interface allows the user to customize the behaviour of hit test functionality to determine that user wants the the view or one of its children to consume the pointer event. Each function of this delegate provides an additional parameter which holds a pointer to the default implementation of this delegate. This enables the user to call the base implementation of the function as per the use-case (similar to calling the parent class function from the overriden function in child class). See also- IViewModule::makeViewWithDelegate.

Methods

checkSelfBoundsForHit()

HitTestResult checkSelfBoundsForHit(IView* view, IHitTestContext* context, IHitTestDelegate* defaultDelegate)
This function is called while dispatching pointer event, and checks whether the view wants to handle pointer event. By default, this method returns HitTestResult.MISS if the pointer event is out of bounds of the view, and HitTestResult.HIT if the pointer event is within the bounds of the view.

Parameters

view
IView* — Required IView The view for which the hit test is being performed currently.
context
IHitTestContext* — Required IHitTestContext Context aware data properties containing the location of the pointer event.
defaultDelegate
IHitTestDelegate* — Required IHitTestDelegate Pointer to the default implementation of IHitTestDelegate. view, context and defaultDelegate are always non-null when this method is invoked by the uitoolkit.

Returns

HitTestResult HitTestResult

performHitTest()

IView*[] performHitTest(IView* view, com.amazon.kepler.uitoolkit.graphics.Point point, IHitTestDelegate* defaultDelegate)
This function is called while collecting the list of views which can be potential candidates for the receiving pointer. This function might return greater than one view, so we iterate over all the views and call IEventDelegate.dispatchPointerEvent for each of the view. If any of the view has marked the event as consumed, then all of the remaining views will get the pointer event with a cancelled state. By default, this function adds all the children of the current view recursively, by calling hitTestSelf and checking which views want to consume the pointer event, meaning they have returned HitTestResult.HIT_TARGET. See also- IEventDelegate::dispatchPointerEvent

Parameters

view
IView* — Required IView The view for which hit test is needed to be performed.
point
com.amazon.kepler.uitoolkit.graphics.Point — Required Point The location of the point event for which we want to accumulate the list of potential hit candidates.
defaultDelegate
IHitTestDelegate* — Required IHitTestDelegate Pointer to the default implementation of IHitTestDelegate. view and defaultDelegate are always non-null when this method is invoked by the uitoolkit.

Returns

IView*[] The array containing views representing the potential candidates; may be empty when no view wants to consume the event. Entries are non-null.
Last modified on October 29, 2026