@react-three/drei 9.39.0 → 9.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +1 -1
- package/web/KeyboardControls.d.ts +4 -3
package/README.md
CHANGED
|
@@ -353,7 +353,7 @@ Scroll controls create a HTML scroll container in front of the canvas. Everythin
|
|
|
353
353
|
You can listen and react to scroll with the `useScroll` hook which gives you useful data like the current scroll `offset`, `delta` and functions for range finding: `range`, `curve` and `visible`. The latter functions are especially useful if you want to react to the scroll offset, for instance if you wanted to fade things in and out if they are in or out of view.
|
|
354
354
|
|
|
355
355
|
```jsx
|
|
356
|
-
|
|
356
|
+
;<ScrollControls
|
|
357
357
|
pages={3} // Each page takes 100% of the height of the canvas
|
|
358
358
|
distance={1} // A factor that increases scroll bar travel (default: 1)
|
|
359
359
|
damping={4} // Friction, higher is faster (default: 4)
|
|
@@ -387,7 +387,7 @@ function Foo(props) {
|
|
|
387
387
|
// Will start increasing when 1 / 3 of the scroll distance is reached,
|
|
388
388
|
// and reach 1 when it reaches 2 / 3rds.
|
|
389
389
|
const b = data.range(1 / 3, 1 / 3)
|
|
390
|
-
|
|
390
|
+
// Same as above but with a margin of 0.1 on both ends
|
|
391
391
|
const c = data.range(1 / 3, 1 / 3, 0.1)
|
|
392
392
|
// Will move between 0-1-0 for the selected range
|
|
393
393
|
const d = data.curve(1 / 3, 1 / 3)
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { GetState,
|
|
2
|
+
import { GetState, Subscribe } from 'zustand';
|
|
3
3
|
declare type KeyboardControlsState<T extends string = string> = {
|
|
4
4
|
[K in T]: boolean;
|
|
5
5
|
};
|
|
@@ -15,9 +15,10 @@ declare type KeyboardControlsProps = {
|
|
|
15
15
|
domElement?: HTMLElement;
|
|
16
16
|
};
|
|
17
17
|
export declare function KeyboardControls({ map, children, onChange, domElement }: KeyboardControlsProps): JSX.Element;
|
|
18
|
-
|
|
18
|
+
declare type Selector<T extends string = string> = (state: KeyboardControlsState<T>) => boolean;
|
|
19
|
+
export declare function useKeyboardControls<T extends string = string>(): [
|
|
19
20
|
Subscribe<KeyboardControlsState<T>>,
|
|
20
21
|
GetState<KeyboardControlsState<T>>
|
|
21
22
|
];
|
|
22
|
-
export declare function useKeyboardControls<T extends string = string
|
|
23
|
+
export declare function useKeyboardControls<T extends string = string>(sel: Selector<T>): ReturnType<Selector<T>>;
|
|
23
24
|
export {};
|