Skip to content

Commit 6057576

Browse files
chore: Implementing PR feedback
1 parent 2090b96 commit 6057576

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

packages/react/handle/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
"zustand": "^4.5.2"
3636
},
3737
"devDependencies": {
38-
"@react-three/fiber": "rc",
39-
"jsdoc-to-markdown": "^9.1.1"
38+
"@react-three/fiber": "rc"
4039
},
4140
"scripts": {
4241
"build": "tsc",

packages/react/xr/src/controller.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ export const XRControllerModel = forwardRef<Object3D, XRControllerModelOptions>(
101101
const LoadXRControllerLayoutSymbol = Symbol('loadXRControllerLayout')
102102

103103
/**
104-
* Hook for loading a controller layout, which contains info about the controller model and its buttons / controls.
105-
* For xr controllers provided through WebXR, the layout is loaded and provided through the controller state automatically.
106-
* Therefore, this hook's purpose is for building controller demos/tutorials.
104+
* For rendering a controller that is not included in WebXR. (e.g controller tutorials/demos)
107105
*
108106
* @param profileIds
109107
* @param handedness

packages/react/xr/src/hooks.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ import { useXR } from './xr.js'
66
/**
77
* Used to track the hover state of a 3D object.
88
*
9-
* @param ref The reference to the 3D object.
10-
* @param onChange `(hover: boolean, event: PointerEvent) => void` Callback for hover state changes.
11-
* @returns Returns the hover state if no callback is provided.
9+
* @param ref The reference to the 3D object.
10+
* @param onChange `(hover: boolean, event: PointerEvent) => void` Callback for hover state changes.
1211
*/
12+
export function useHover(ref: RefObject<Object3D | null>): boolean
13+
14+
export function useHover(ref: RefObject<Object3D | null>, onChange: (hover: boolean, event: PointerEvent) => void): void
15+
1316
export function useHover(
1417
ref: RefObject<Object3D | null>,
1518
onChange?: (hover: boolean, event: PointerEvent) => void,
@@ -76,7 +79,7 @@ export function useInitRoomCapture() {
7679
* @param {XRSessionMode} mode - The `XRSessionMode` to check against.
7780
* @param {(error: any) => void} [onError] - Callback executed when an error occurs.
7881
*/
79-
export function useXRSessionModeSupported(mode: XRSessionMode, onError?: (error: any) => void): boolean | undefined {
82+
export function useXRSessionModeSupported(mode: XRSessionMode, onError?: (error: any) => void) {
8083
const onErrorRef = useRef(onError)
8184
onErrorRef.current = onError
8285
const [subscribe, getSnapshot] = useMemo(() => {

packages/react/xr/src/space.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ export const XRSpace = forwardRef<
5353
/**
5454
* A combined type of all XRSpace types
5555
* @see [XRReferenceSpaceType](https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpaceType)
56-
* @see [XRInputSourceSpaceType](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSourceSpaceType)
57-
* @see [XRHandJointSpaceType](https://developer.mozilla.org/en-US/docs/Web/API/XRHandJointSpaceType)
58-
* @see [XRBodyJointSpaceType](https://developer.mozilla.org/en-US/docs/Web/API/XRBodyJointSpaceType)
56+
* @see [XRHandJointSpaceType](https://immersive-web.github.io/webxr-hand-input/#xrhand-interface)
5957
*/
6058
export type XRSpaceType = XRReferenceSpaceType | XRInputSourceSpaceType | XRHandJointSpaceType | XRBodyJointSpaceType
6159

@@ -241,10 +239,11 @@ export function useGetXRSpaceMatrix(space: XRSpace | undefined) {
241239
* Hook that applies the transformation of the provided xr space to the provided object reference
242240
*
243241
* @param onFrame Optional callback that gets executed after the matrix of the reference object was updated
242+
* @param ref.current A react ref object that points to the object that the XRSpaceMatrix should be applied to
244243
* @requires matrixAutoUpdate to be disabled for the referenced object
245244
*/
246245
export function useApplyXRSpaceMatrix(
247-
ref: React.RefObject<Object3D | null>,
246+
ref: { current?: Group | null },
248247
space: XRSpace | undefined,
249248
onFrame?: (state: RootState, delta: number, frame: XRFrame | undefined) => void,
250249
): void {

0 commit comments

Comments
 (0)