-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(component): minimal
sensor
documentation
- Loading branch information
1 parent
1b37050
commit bc48f47
Showing
6 changed files
with
84 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
import type { collisionType, sourceTarget } from '../types' | ||
import type { CollisionType, SourceTarget } from '../types' | ||
|
||
/** | ||
* @description Make traversed {@link SourceTarget Source} emit an intersection event. | ||
* | ||
* Either `@intersection-start` or `intersection-exist` based on the {@link CollisionType}. | ||
* | ||
* @param source - The traversed source. | ||
* @param target - The traversing target. | ||
* @param started - Whether the intersection started or ended | ||
*/ | ||
export const emitIntersection = ( | ||
source: sourceTarget, | ||
target: sourceTarget, | ||
source: SourceTarget, | ||
target: SourceTarget, | ||
started: boolean, | ||
) => { | ||
const collisionType: collisionType = started ? 'enter' : 'exit' | ||
const CollisionType: CollisionType = started ? 'enter' : 'exit' | ||
const colliderNode = source.object?.__vnode?.children?.[1]?.children?.find(child => child?.component?.exposed?.instance?.value === source.context.collider) | ||
|
||
colliderNode?.component?.emit?.(`intersection-${collisionType}`, { source, target }) | ||
colliderNode?.component?.emit?.(`intersection-${CollisionType}`, { source, target }) | ||
} |