Develop
Develop
Select your platform

InteractorGroups

InteractorGroups can be used to coordinate multiple Interactors based on state. These components become the root driving component in a group of IInteractors, and will advance the lifecycle of the “best” IInteractor in the group in priority order.
Note:InteractorGroups also implements (and acts as) IInteractors. This means they can be nested within other InteractorGroups to handle more complex scenarios. In all cases, the root-most InteractorGroup serves as the update-loop entrypoint for all nested IInteractors.
There are several types of InteractorGroups to choose from depending on your use case.

BestHoverInteractorGroup

BestHoverInteractorGroup is the default InteractorGroup. Until there is a selection, the highest priority IInteractor that is hovering will remain the active IInteractor unless an IInteractor with a higher priority can hover.
Upon selection, the selecting IInteractor will not change until selection ends. By default, a group is prioritized in list-order (first = highest priority). An ICandidateComparer can be provided to prioritize IInteractors in a different order.

BestSelectInteractorGroup

BestSelectInteractorGroup can be used to coordinate multiple Interactors based on select state. Unlike InteractorGroup, up until there is a selection, multiple IInteractors may be in a hover state.
Upon selection, the selecting IInteractor will not change until selection ends.

FirstHoverInteractorGroup

FirstHoverInteractorGroup keeps active the first interactor to Hover, preventing any other interactor to enter Hover state until it unhovers. When two interactors hover at exactly the same time, it will give priority to the best one based on list order or the ICandidateComparer.

ICandidateComparer

By default, InteractorGroups are prioritized in list-order (first = highest priority). ICandidateComparer can be provided to prioritize IInteractors in a different order based on their CandidateProperties.
For instance, for those IInteractors whose CandidateProperties can be cast to an ICandidatePosition, a CandidatePositionComparer can prioritize IInteractors by their candidates’ position as measured by a distance to a common location.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon