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()
This function is called while dispatching pointer event, and checks whether the view wants to handle pointer event. By default, this method returnsHitTestResultcheckSelfBoundsForHit(IView*view,IHitTestContext*context,IHitTestDelegate*defaultDelegate)
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()
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 callIView*[]performHitTest(IView*view,com.amazon.kepler.uitoolkit.graphics.Pointpoint,IHitTestDelegate*defaultDelegate)
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.

