@react-three/drei 9.39.0 → 9.40.1
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 +7 -3
- package/package.json +2 -2
- 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)
|
|
@@ -434,6 +434,10 @@ Semi-OrbitControls with spring-physics, polar zoom and snap-back, for presentati
|
|
|
434
434
|
|
|
435
435
|

|
|
436
436
|
|
|
437
|
+
<p>
|
|
438
|
+
<a href="https://codesandbox.io/s/vkgi6"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/vkgi6/screenshot.png" alt="demo"/></a>
|
|
439
|
+
</p>
|
|
440
|
+
|
|
437
441
|
A rudimentary keyboard controller which distributes your defined data-model to the `useKeyboard` hook. It's a rather simple way to get started with keyboard input.
|
|
438
442
|
|
|
439
443
|
```tsx
|
|
@@ -1032,7 +1036,7 @@ You can either pass a Mesh and InstancedMesh as children:
|
|
|
1032
1036
|
</mesh>
|
|
1033
1037
|
|
|
1034
1038
|
<instancedMesh args={[null, null, 1_000]}>
|
|
1035
|
-
<sphereGeometry args={[0.1]}
|
|
1039
|
+
<sphereGeometry args={[0.1]}/>
|
|
1036
1040
|
</instancedMesh>
|
|
1037
1041
|
</Sampler>
|
|
1038
1042
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-three/drei",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.40.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "useful add-ons for react-three-fiber",
|
|
6
6
|
"keywords": [
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"stats.js": "^0.17.0",
|
|
54
54
|
"suspend-react": "^0.0.8",
|
|
55
55
|
"three-mesh-bvh": "^0.5.15",
|
|
56
|
-
"three-stdlib": "^2.
|
|
56
|
+
"three-stdlib": "^2.18.0",
|
|
57
57
|
"troika-three-text": "^0.46.4",
|
|
58
58
|
"utility-types": "^3.10.0",
|
|
59
59
|
"zustand": "^3.5.13"
|
|
@@ -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 {};
|