@react-three/fiber 8.17.5 → 8.17.6
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/CHANGELOG.md +1040 -1034
- package/dist/declarations/src/core/events.d.ts +93 -93
- package/dist/declarations/src/core/hooks.d.ts +57 -57
- package/dist/declarations/src/core/index.d.ts +94 -94
- package/dist/declarations/src/core/loop.d.ts +38 -38
- package/dist/declarations/src/core/renderer.d.ts +58 -58
- package/dist/declarations/src/core/store.d.ts +138 -138
- package/dist/declarations/src/core/utils.d.ts +134 -134
- package/dist/declarations/src/index.d.ts +12 -12
- package/dist/declarations/src/native/Canvas.d.ts +14 -14
- package/dist/declarations/src/native/events.d.ts +5 -5
- package/dist/declarations/src/native/polyfills.d.ts +1 -1
- package/dist/declarations/src/native.d.ts +13 -13
- package/dist/declarations/src/three-types.d.ts +396 -393
- package/dist/declarations/src/web/Canvas.d.ts +24 -24
- package/dist/declarations/src/web/events.d.ts +5 -5
- package/dist/declarations/src/web/use-measure.d.ts +34 -34
- package/dist/{events-be1682bd.cjs.prod.js → events-2e7e6eab.cjs.prod.js} +76 -76
- package/dist/{events-a5fc3e51.esm.js → events-3515660a.esm.js} +76 -76
- package/dist/{events-66f43fbc.cjs.dev.js → events-c54ce65e.cjs.dev.js} +76 -76
- package/dist/react-three-fiber.cjs.dev.js +4 -4
- package/dist/react-three-fiber.cjs.prod.js +4 -4
- package/dist/react-three-fiber.esm.js +5 -5
- package/native/dist/react-three-fiber-native.cjs.dev.js +13 -18
- package/native/dist/react-three-fiber-native.cjs.prod.js +13 -18
- package/native/dist/react-three-fiber-native.esm.js +14 -19
- package/native/package.json +5 -5
- package/package.json +1 -1
- package/readme.md +253 -253
|
@@ -360,12 +360,12 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
360
360
|
}
|
|
361
361
|
|
|
362
362
|
var _window$document, _window$navigator;
|
|
363
|
-
/**
|
|
364
|
-
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
363
|
+
/**
|
|
364
|
+
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
365
365
|
*/
|
|
366
366
|
const hasColorSpace = object => 'colorSpace' in object || 'outputColorSpace' in object;
|
|
367
|
-
/**
|
|
368
|
-
* The current THREE.ColorManagement instance, if present.
|
|
367
|
+
/**
|
|
368
|
+
* The current THREE.ColorManagement instance, if present.
|
|
369
369
|
*/
|
|
370
370
|
const getColorManagement = () => {
|
|
371
371
|
var _ColorManagement;
|
|
@@ -374,14 +374,14 @@ const getColorManagement = () => {
|
|
|
374
374
|
const isOrthographicCamera = def => def && def.isOrthographicCamera;
|
|
375
375
|
const isRef = obj => obj && obj.hasOwnProperty('current');
|
|
376
376
|
|
|
377
|
-
/**
|
|
378
|
-
* An SSR-friendly useLayoutEffect.
|
|
379
|
-
*
|
|
380
|
-
* React currently throws a warning when using useLayoutEffect on the server.
|
|
381
|
-
* To get around it, we can conditionally useEffect on the server (no-op) and
|
|
382
|
-
* useLayoutEffect elsewhere.
|
|
383
|
-
*
|
|
384
|
-
* @see https://github.com/facebook/react/issues/14927
|
|
377
|
+
/**
|
|
378
|
+
* An SSR-friendly useLayoutEffect.
|
|
379
|
+
*
|
|
380
|
+
* React currently throws a warning when using useLayoutEffect on the server.
|
|
381
|
+
* To get around it, we can conditionally useEffect on the server (no-op) and
|
|
382
|
+
* useLayoutEffect elsewhere.
|
|
383
|
+
*
|
|
384
|
+
* @see https://github.com/facebook/react/issues/14927
|
|
385
385
|
*/
|
|
386
386
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' && ((_window$document = window.document) != null && _window$document.createElement || ((_window$navigator = window.navigator) == null ? void 0 : _window$navigator.product) === 'ReactNative') ? React.useLayoutEffect : React.useEffect;
|
|
387
387
|
function useMutableCallback(fn) {
|
|
@@ -426,16 +426,16 @@ function calculateDpr(dpr) {
|
|
|
426
426
|
return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
/**
|
|
430
|
-
* Returns instance root state
|
|
429
|
+
/**
|
|
430
|
+
* Returns instance root state
|
|
431
431
|
*/
|
|
432
432
|
const getRootState = obj => {
|
|
433
433
|
var _r3f;
|
|
434
434
|
return (_r3f = obj.__r3f) == null ? void 0 : _r3f.root.getState();
|
|
435
435
|
};
|
|
436
436
|
|
|
437
|
-
/**
|
|
438
|
-
* Returns the instances initial (outmost) root
|
|
437
|
+
/**
|
|
438
|
+
* Returns the instances initial (outmost) root
|
|
439
439
|
*/
|
|
440
440
|
function findInitialRoot(child) {
|
|
441
441
|
let root = child.__r3f.root;
|
|
@@ -492,8 +492,8 @@ const is = {
|
|
|
492
492
|
}
|
|
493
493
|
};
|
|
494
494
|
|
|
495
|
-
/**
|
|
496
|
-
* Collects nodes and materials from a THREE.Object3D.
|
|
495
|
+
/**
|
|
496
|
+
* Collects nodes and materials from a THREE.Object3D.
|
|
497
497
|
*/
|
|
498
498
|
function buildGraph(object) {
|
|
499
499
|
const data = {
|
|
@@ -833,9 +833,9 @@ function getEventPriority() {
|
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
835
|
|
|
836
|
-
/**
|
|
837
|
-
* Release pointer captures.
|
|
838
|
-
* This is called by releasePointerCapture in the API, and when an object is removed.
|
|
836
|
+
/**
|
|
837
|
+
* Release pointer captures.
|
|
838
|
+
* This is called by releasePointerCapture in the API, and when an object is removed.
|
|
839
839
|
*/
|
|
840
840
|
function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
|
|
841
841
|
const captureData = captures.get(obj);
|
|
@@ -1170,19 +1170,19 @@ function createEvents(store) {
|
|
|
1170
1170
|
// Check presence of handlers
|
|
1171
1171
|
if (!(instance != null && instance.eventCount)) return;
|
|
1172
1172
|
|
|
1173
|
-
/*
|
|
1174
|
-
MAYBE TODO, DELETE IF NOT:
|
|
1175
|
-
Check if the object is captured, captured events should not have intersects running in parallel
|
|
1176
|
-
But wouldn't it be better to just replace capturedMap with a single entry?
|
|
1177
|
-
Also, are we OK with straight up making picking up multiple objects impossible?
|
|
1178
|
-
|
|
1179
|
-
const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
|
|
1180
|
-
if (pointerId !== undefined) {
|
|
1181
|
-
const capturedMeshSet = internal.capturedMap.get(pointerId)
|
|
1182
|
-
if (capturedMeshSet) {
|
|
1183
|
-
const captured = capturedMeshSet.get(eventObject)
|
|
1184
|
-
if (captured && captured.localState.stopped) return
|
|
1185
|
-
}
|
|
1173
|
+
/*
|
|
1174
|
+
MAYBE TODO, DELETE IF NOT:
|
|
1175
|
+
Check if the object is captured, captured events should not have intersects running in parallel
|
|
1176
|
+
But wouldn't it be better to just replace capturedMap with a single entry?
|
|
1177
|
+
Also, are we OK with straight up making picking up multiple objects impossible?
|
|
1178
|
+
|
|
1179
|
+
const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
|
|
1180
|
+
if (pointerId !== undefined) {
|
|
1181
|
+
const capturedMeshSet = internal.capturedMap.get(pointerId)
|
|
1182
|
+
if (capturedMeshSet) {
|
|
1183
|
+
const captured = capturedMeshSet.get(eventObject)
|
|
1184
|
+
if (captured && captured.localState.stopped) return
|
|
1185
|
+
}
|
|
1186
1186
|
}*/
|
|
1187
1187
|
|
|
1188
1188
|
if (isPointerMove) {
|
|
@@ -1488,21 +1488,21 @@ let globalEffects = new Set();
|
|
|
1488
1488
|
let globalAfterEffects = new Set();
|
|
1489
1489
|
let globalTailEffects = new Set();
|
|
1490
1490
|
|
|
1491
|
-
/**
|
|
1492
|
-
* Adds a global render callback which is called each frame.
|
|
1493
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
|
|
1491
|
+
/**
|
|
1492
|
+
* Adds a global render callback which is called each frame.
|
|
1493
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
|
|
1494
1494
|
*/
|
|
1495
1495
|
const addEffect = callback => createSubs(callback, globalEffects);
|
|
1496
1496
|
|
|
1497
|
-
/**
|
|
1498
|
-
* Adds a global after-render callback which is called each frame.
|
|
1499
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
|
|
1497
|
+
/**
|
|
1498
|
+
* Adds a global after-render callback which is called each frame.
|
|
1499
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
|
|
1500
1500
|
*/
|
|
1501
1501
|
const addAfterEffect = callback => createSubs(callback, globalAfterEffects);
|
|
1502
1502
|
|
|
1503
|
-
/**
|
|
1504
|
-
* Adds a global callback which is called when rendering stops.
|
|
1505
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
|
|
1503
|
+
/**
|
|
1504
|
+
* Adds a global callback which is called when rendering stops.
|
|
1505
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
|
|
1506
1506
|
*/
|
|
1507
1507
|
const addTail = callback => createSubs(callback, globalTailEffects);
|
|
1508
1508
|
function run(effects, timestamp) {
|
|
@@ -1621,11 +1621,11 @@ function createLoop(roots) {
|
|
|
1621
1621
|
};
|
|
1622
1622
|
}
|
|
1623
1623
|
|
|
1624
|
-
/**
|
|
1625
|
-
* Exposes an object's {@link LocalState}.
|
|
1626
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
1627
|
-
*
|
|
1628
|
-
* **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
|
|
1624
|
+
/**
|
|
1625
|
+
* Exposes an object's {@link LocalState}.
|
|
1626
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
1627
|
+
*
|
|
1628
|
+
* **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
|
|
1629
1629
|
*/
|
|
1630
1630
|
function useInstanceHandle(ref) {
|
|
1631
1631
|
const instance = React.useRef(null);
|
|
@@ -1638,18 +1638,18 @@ function useStore() {
|
|
|
1638
1638
|
return store;
|
|
1639
1639
|
}
|
|
1640
1640
|
|
|
1641
|
-
/**
|
|
1642
|
-
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
1643
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
1641
|
+
/**
|
|
1642
|
+
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
1643
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
1644
1644
|
*/
|
|
1645
1645
|
function useThree(selector = state => state, equalityFn) {
|
|
1646
1646
|
return useStore()(selector, equalityFn);
|
|
1647
1647
|
}
|
|
1648
1648
|
|
|
1649
|
-
/**
|
|
1650
|
-
* Executes a callback before render in a shared frame loop.
|
|
1651
|
-
* Can order effects with render priority or manually render with a positive priority.
|
|
1652
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
1649
|
+
/**
|
|
1650
|
+
* Executes a callback before render in a shared frame loop.
|
|
1651
|
+
* Can order effects with render priority or manually render with a positive priority.
|
|
1652
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
1653
1653
|
*/
|
|
1654
1654
|
function useFrame(callback, renderPriority = 0) {
|
|
1655
1655
|
const store = useStore();
|
|
@@ -1661,9 +1661,9 @@ function useFrame(callback, renderPriority = 0) {
|
|
|
1661
1661
|
return null;
|
|
1662
1662
|
}
|
|
1663
1663
|
|
|
1664
|
-
/**
|
|
1665
|
-
* Returns a node graph of an object with named nodes & materials.
|
|
1666
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
|
|
1664
|
+
/**
|
|
1665
|
+
* Returns a node graph of an object with named nodes & materials.
|
|
1666
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
|
|
1667
1667
|
*/
|
|
1668
1668
|
function useGraph(object) {
|
|
1669
1669
|
return React.useMemo(() => buildGraph(object), [object]);
|
|
@@ -1685,11 +1685,11 @@ function loadingFn(extensions, onProgress) {
|
|
|
1685
1685
|
}, onProgress, error => reject(new Error(`Could not load ${input}: ${error == null ? void 0 : error.message}`))))));
|
|
1686
1686
|
};
|
|
1687
1687
|
}
|
|
1688
|
-
/**
|
|
1689
|
-
* Synchronously loads and caches assets with a three loader.
|
|
1690
|
-
*
|
|
1691
|
-
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
1692
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
1688
|
+
/**
|
|
1689
|
+
* Synchronously loads and caches assets with a three loader.
|
|
1690
|
+
*
|
|
1691
|
+
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
1692
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
1693
1693
|
*/
|
|
1694
1694
|
function useLoader(Proto, input, extensions, onProgress) {
|
|
1695
1695
|
// Use suspense to load async assets
|
|
@@ -1701,16 +1701,16 @@ function useLoader(Proto, input, extensions, onProgress) {
|
|
|
1701
1701
|
return Array.isArray(input) ? results : results[0];
|
|
1702
1702
|
}
|
|
1703
1703
|
|
|
1704
|
-
/**
|
|
1705
|
-
* Preloads an asset into cache as a side-effect.
|
|
1704
|
+
/**
|
|
1705
|
+
* Preloads an asset into cache as a side-effect.
|
|
1706
1706
|
*/
|
|
1707
1707
|
useLoader.preload = function (Proto, input, extensions) {
|
|
1708
1708
|
const keys = Array.isArray(input) ? input : [input];
|
|
1709
1709
|
return preload(loadingFn(extensions), [Proto, ...keys]);
|
|
1710
1710
|
};
|
|
1711
1711
|
|
|
1712
|
-
/**
|
|
1713
|
-
* Removes a loaded asset from cache.
|
|
1712
|
+
/**
|
|
1713
|
+
* Removes a loaded asset from cache.
|
|
1714
1714
|
*/
|
|
1715
1715
|
useLoader.clear = function (Proto, input) {
|
|
1716
1716
|
const keys = Array.isArray(input) ? input : [input];
|
|
@@ -2115,10 +2115,10 @@ function Portal({
|
|
|
2115
2115
|
children,
|
|
2116
2116
|
container
|
|
2117
2117
|
}) {
|
|
2118
|
-
/** This has to be a component because it would not be able to call useThree/useStore otherwise since
|
|
2119
|
-
* if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
|
|
2120
|
-
* the "R3F hooks can only be used within the Canvas component!" warning:
|
|
2121
|
-
* <Canvas>
|
|
2118
|
+
/** This has to be a component because it would not be able to call useThree/useStore otherwise since
|
|
2119
|
+
* if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
|
|
2120
|
+
* the "R3F hooks can only be used within the Canvas component!" warning:
|
|
2121
|
+
* <Canvas>
|
|
2122
2122
|
* {createPortal(...)} */
|
|
2123
2123
|
const {
|
|
2124
2124
|
events,
|
|
@@ -2242,11 +2242,11 @@ function Portal({
|
|
|
2242
2242
|
});
|
|
2243
2243
|
}
|
|
2244
2244
|
|
|
2245
|
-
/**
|
|
2246
|
-
* Force React to flush any updates inside the provided callback synchronously and immediately.
|
|
2247
|
-
* All the same caveats documented for react-dom's `flushSync` apply here (see https://react.dev/reference/react-dom/flushSync).
|
|
2248
|
-
* Nevertheless, sometimes one needs to render synchronously, for example to keep DOM and 3D changes in lock-step without
|
|
2249
|
-
* having to revert to a non-React solution.
|
|
2245
|
+
/**
|
|
2246
|
+
* Force React to flush any updates inside the provided callback synchronously and immediately.
|
|
2247
|
+
* All the same caveats documented for react-dom's `flushSync` apply here (see https://react.dev/reference/react-dom/flushSync).
|
|
2248
|
+
* Nevertheless, sometimes one needs to render synchronously, for example to keep DOM and 3D changes in lock-step without
|
|
2249
|
+
* having to revert to a non-React solution.
|
|
2250
2250
|
*/
|
|
2251
2251
|
function flushSync(fn) {
|
|
2252
2252
|
// `flushSync` implementation only takes one argument. I don't know what's up with the type declaration for it.
|
|
@@ -387,12 +387,12 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
387
387
|
}
|
|
388
388
|
|
|
389
389
|
var _window$document, _window$navigator;
|
|
390
|
-
/**
|
|
391
|
-
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
390
|
+
/**
|
|
391
|
+
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
392
392
|
*/
|
|
393
393
|
const hasColorSpace = object => 'colorSpace' in object || 'outputColorSpace' in object;
|
|
394
|
-
/**
|
|
395
|
-
* The current THREE.ColorManagement instance, if present.
|
|
394
|
+
/**
|
|
395
|
+
* The current THREE.ColorManagement instance, if present.
|
|
396
396
|
*/
|
|
397
397
|
const getColorManagement = () => {
|
|
398
398
|
var _ColorManagement;
|
|
@@ -401,14 +401,14 @@ const getColorManagement = () => {
|
|
|
401
401
|
const isOrthographicCamera = def => def && def.isOrthographicCamera;
|
|
402
402
|
const isRef = obj => obj && obj.hasOwnProperty('current');
|
|
403
403
|
|
|
404
|
-
/**
|
|
405
|
-
* An SSR-friendly useLayoutEffect.
|
|
406
|
-
*
|
|
407
|
-
* React currently throws a warning when using useLayoutEffect on the server.
|
|
408
|
-
* To get around it, we can conditionally useEffect on the server (no-op) and
|
|
409
|
-
* useLayoutEffect elsewhere.
|
|
410
|
-
*
|
|
411
|
-
* @see https://github.com/facebook/react/issues/14927
|
|
404
|
+
/**
|
|
405
|
+
* An SSR-friendly useLayoutEffect.
|
|
406
|
+
*
|
|
407
|
+
* React currently throws a warning when using useLayoutEffect on the server.
|
|
408
|
+
* To get around it, we can conditionally useEffect on the server (no-op) and
|
|
409
|
+
* useLayoutEffect elsewhere.
|
|
410
|
+
*
|
|
411
|
+
* @see https://github.com/facebook/react/issues/14927
|
|
412
412
|
*/
|
|
413
413
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' && ((_window$document = window.document) != null && _window$document.createElement || ((_window$navigator = window.navigator) == null ? void 0 : _window$navigator.product) === 'ReactNative') ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
414
414
|
function useMutableCallback(fn) {
|
|
@@ -453,16 +453,16 @@ function calculateDpr(dpr) {
|
|
|
453
453
|
return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
-
/**
|
|
457
|
-
* Returns instance root state
|
|
456
|
+
/**
|
|
457
|
+
* Returns instance root state
|
|
458
458
|
*/
|
|
459
459
|
const getRootState = obj => {
|
|
460
460
|
var _r3f;
|
|
461
461
|
return (_r3f = obj.__r3f) == null ? void 0 : _r3f.root.getState();
|
|
462
462
|
};
|
|
463
463
|
|
|
464
|
-
/**
|
|
465
|
-
* Returns the instances initial (outmost) root
|
|
464
|
+
/**
|
|
465
|
+
* Returns the instances initial (outmost) root
|
|
466
466
|
*/
|
|
467
467
|
function findInitialRoot(child) {
|
|
468
468
|
let root = child.__r3f.root;
|
|
@@ -519,8 +519,8 @@ const is = {
|
|
|
519
519
|
}
|
|
520
520
|
};
|
|
521
521
|
|
|
522
|
-
/**
|
|
523
|
-
* Collects nodes and materials from a THREE.Object3D.
|
|
522
|
+
/**
|
|
523
|
+
* Collects nodes and materials from a THREE.Object3D.
|
|
524
524
|
*/
|
|
525
525
|
function buildGraph(object) {
|
|
526
526
|
const data = {
|
|
@@ -860,9 +860,9 @@ function getEventPriority() {
|
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
862
|
|
|
863
|
-
/**
|
|
864
|
-
* Release pointer captures.
|
|
865
|
-
* This is called by releasePointerCapture in the API, and when an object is removed.
|
|
863
|
+
/**
|
|
864
|
+
* Release pointer captures.
|
|
865
|
+
* This is called by releasePointerCapture in the API, and when an object is removed.
|
|
866
866
|
*/
|
|
867
867
|
function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
|
|
868
868
|
const captureData = captures.get(obj);
|
|
@@ -1197,19 +1197,19 @@ function createEvents(store) {
|
|
|
1197
1197
|
// Check presence of handlers
|
|
1198
1198
|
if (!(instance != null && instance.eventCount)) return;
|
|
1199
1199
|
|
|
1200
|
-
/*
|
|
1201
|
-
MAYBE TODO, DELETE IF NOT:
|
|
1202
|
-
Check if the object is captured, captured events should not have intersects running in parallel
|
|
1203
|
-
But wouldn't it be better to just replace capturedMap with a single entry?
|
|
1204
|
-
Also, are we OK with straight up making picking up multiple objects impossible?
|
|
1205
|
-
|
|
1206
|
-
const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
|
|
1207
|
-
if (pointerId !== undefined) {
|
|
1208
|
-
const capturedMeshSet = internal.capturedMap.get(pointerId)
|
|
1209
|
-
if (capturedMeshSet) {
|
|
1210
|
-
const captured = capturedMeshSet.get(eventObject)
|
|
1211
|
-
if (captured && captured.localState.stopped) return
|
|
1212
|
-
}
|
|
1200
|
+
/*
|
|
1201
|
+
MAYBE TODO, DELETE IF NOT:
|
|
1202
|
+
Check if the object is captured, captured events should not have intersects running in parallel
|
|
1203
|
+
But wouldn't it be better to just replace capturedMap with a single entry?
|
|
1204
|
+
Also, are we OK with straight up making picking up multiple objects impossible?
|
|
1205
|
+
|
|
1206
|
+
const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
|
|
1207
|
+
if (pointerId !== undefined) {
|
|
1208
|
+
const capturedMeshSet = internal.capturedMap.get(pointerId)
|
|
1209
|
+
if (capturedMeshSet) {
|
|
1210
|
+
const captured = capturedMeshSet.get(eventObject)
|
|
1211
|
+
if (captured && captured.localState.stopped) return
|
|
1212
|
+
}
|
|
1213
1213
|
}*/
|
|
1214
1214
|
|
|
1215
1215
|
if (isPointerMove) {
|
|
@@ -1515,21 +1515,21 @@ let globalEffects = new Set();
|
|
|
1515
1515
|
let globalAfterEffects = new Set();
|
|
1516
1516
|
let globalTailEffects = new Set();
|
|
1517
1517
|
|
|
1518
|
-
/**
|
|
1519
|
-
* Adds a global render callback which is called each frame.
|
|
1520
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
|
|
1518
|
+
/**
|
|
1519
|
+
* Adds a global render callback which is called each frame.
|
|
1520
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
|
|
1521
1521
|
*/
|
|
1522
1522
|
const addEffect = callback => createSubs(callback, globalEffects);
|
|
1523
1523
|
|
|
1524
|
-
/**
|
|
1525
|
-
* Adds a global after-render callback which is called each frame.
|
|
1526
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
|
|
1524
|
+
/**
|
|
1525
|
+
* Adds a global after-render callback which is called each frame.
|
|
1526
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
|
|
1527
1527
|
*/
|
|
1528
1528
|
const addAfterEffect = callback => createSubs(callback, globalAfterEffects);
|
|
1529
1529
|
|
|
1530
|
-
/**
|
|
1531
|
-
* Adds a global callback which is called when rendering stops.
|
|
1532
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
|
|
1530
|
+
/**
|
|
1531
|
+
* Adds a global callback which is called when rendering stops.
|
|
1532
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
|
|
1533
1533
|
*/
|
|
1534
1534
|
const addTail = callback => createSubs(callback, globalTailEffects);
|
|
1535
1535
|
function run(effects, timestamp) {
|
|
@@ -1648,11 +1648,11 @@ function createLoop(roots) {
|
|
|
1648
1648
|
};
|
|
1649
1649
|
}
|
|
1650
1650
|
|
|
1651
|
-
/**
|
|
1652
|
-
* Exposes an object's {@link LocalState}.
|
|
1653
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
1654
|
-
*
|
|
1655
|
-
* **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
|
|
1651
|
+
/**
|
|
1652
|
+
* Exposes an object's {@link LocalState}.
|
|
1653
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
1654
|
+
*
|
|
1655
|
+
* **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
|
|
1656
1656
|
*/
|
|
1657
1657
|
function useInstanceHandle(ref) {
|
|
1658
1658
|
const instance = React__namespace.useRef(null);
|
|
@@ -1665,18 +1665,18 @@ function useStore() {
|
|
|
1665
1665
|
return store;
|
|
1666
1666
|
}
|
|
1667
1667
|
|
|
1668
|
-
/**
|
|
1669
|
-
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
1670
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
1668
|
+
/**
|
|
1669
|
+
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
1670
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
1671
1671
|
*/
|
|
1672
1672
|
function useThree(selector = state => state, equalityFn) {
|
|
1673
1673
|
return useStore()(selector, equalityFn);
|
|
1674
1674
|
}
|
|
1675
1675
|
|
|
1676
|
-
/**
|
|
1677
|
-
* Executes a callback before render in a shared frame loop.
|
|
1678
|
-
* Can order effects with render priority or manually render with a positive priority.
|
|
1679
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
1676
|
+
/**
|
|
1677
|
+
* Executes a callback before render in a shared frame loop.
|
|
1678
|
+
* Can order effects with render priority or manually render with a positive priority.
|
|
1679
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
1680
1680
|
*/
|
|
1681
1681
|
function useFrame(callback, renderPriority = 0) {
|
|
1682
1682
|
const store = useStore();
|
|
@@ -1688,9 +1688,9 @@ function useFrame(callback, renderPriority = 0) {
|
|
|
1688
1688
|
return null;
|
|
1689
1689
|
}
|
|
1690
1690
|
|
|
1691
|
-
/**
|
|
1692
|
-
* Returns a node graph of an object with named nodes & materials.
|
|
1693
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
|
|
1691
|
+
/**
|
|
1692
|
+
* Returns a node graph of an object with named nodes & materials.
|
|
1693
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
|
|
1694
1694
|
*/
|
|
1695
1695
|
function useGraph(object) {
|
|
1696
1696
|
return React__namespace.useMemo(() => buildGraph(object), [object]);
|
|
@@ -1712,11 +1712,11 @@ function loadingFn(extensions, onProgress) {
|
|
|
1712
1712
|
}, onProgress, error => reject(new Error(`Could not load ${input}: ${error == null ? void 0 : error.message}`))))));
|
|
1713
1713
|
};
|
|
1714
1714
|
}
|
|
1715
|
-
/**
|
|
1716
|
-
* Synchronously loads and caches assets with a three loader.
|
|
1717
|
-
*
|
|
1718
|
-
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
1719
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
1715
|
+
/**
|
|
1716
|
+
* Synchronously loads and caches assets with a three loader.
|
|
1717
|
+
*
|
|
1718
|
+
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
1719
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
1720
1720
|
*/
|
|
1721
1721
|
function useLoader(Proto, input, extensions, onProgress) {
|
|
1722
1722
|
// Use suspense to load async assets
|
|
@@ -1728,16 +1728,16 @@ function useLoader(Proto, input, extensions, onProgress) {
|
|
|
1728
1728
|
return Array.isArray(input) ? results : results[0];
|
|
1729
1729
|
}
|
|
1730
1730
|
|
|
1731
|
-
/**
|
|
1732
|
-
* Preloads an asset into cache as a side-effect.
|
|
1731
|
+
/**
|
|
1732
|
+
* Preloads an asset into cache as a side-effect.
|
|
1733
1733
|
*/
|
|
1734
1734
|
useLoader.preload = function (Proto, input, extensions) {
|
|
1735
1735
|
const keys = Array.isArray(input) ? input : [input];
|
|
1736
1736
|
return suspendReact.preload(loadingFn(extensions), [Proto, ...keys]);
|
|
1737
1737
|
};
|
|
1738
1738
|
|
|
1739
|
-
/**
|
|
1740
|
-
* Removes a loaded asset from cache.
|
|
1739
|
+
/**
|
|
1740
|
+
* Removes a loaded asset from cache.
|
|
1741
1741
|
*/
|
|
1742
1742
|
useLoader.clear = function (Proto, input) {
|
|
1743
1743
|
const keys = Array.isArray(input) ? input : [input];
|
|
@@ -2142,10 +2142,10 @@ function Portal({
|
|
|
2142
2142
|
children,
|
|
2143
2143
|
container
|
|
2144
2144
|
}) {
|
|
2145
|
-
/** This has to be a component because it would not be able to call useThree/useStore otherwise since
|
|
2146
|
-
* if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
|
|
2147
|
-
* the "R3F hooks can only be used within the Canvas component!" warning:
|
|
2148
|
-
* <Canvas>
|
|
2145
|
+
/** This has to be a component because it would not be able to call useThree/useStore otherwise since
|
|
2146
|
+
* if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
|
|
2147
|
+
* the "R3F hooks can only be used within the Canvas component!" warning:
|
|
2148
|
+
* <Canvas>
|
|
2149
2149
|
* {createPortal(...)} */
|
|
2150
2150
|
const {
|
|
2151
2151
|
events,
|
|
@@ -2269,11 +2269,11 @@ function Portal({
|
|
|
2269
2269
|
});
|
|
2270
2270
|
}
|
|
2271
2271
|
|
|
2272
|
-
/**
|
|
2273
|
-
* Force React to flush any updates inside the provided callback synchronously and immediately.
|
|
2274
|
-
* All the same caveats documented for react-dom's `flushSync` apply here (see https://react.dev/reference/react-dom/flushSync).
|
|
2275
|
-
* Nevertheless, sometimes one needs to render synchronously, for example to keep DOM and 3D changes in lock-step without
|
|
2276
|
-
* having to revert to a non-React solution.
|
|
2272
|
+
/**
|
|
2273
|
+
* Force React to flush any updates inside the provided callback synchronously and immediately.
|
|
2274
|
+
* All the same caveats documented for react-dom's `flushSync` apply here (see https://react.dev/reference/react-dom/flushSync).
|
|
2275
|
+
* Nevertheless, sometimes one needs to render synchronously, for example to keep DOM and 3D changes in lock-step without
|
|
2276
|
+
* having to revert to a non-React solution.
|
|
2277
2277
|
*/
|
|
2278
2278
|
function flushSync(fn) {
|
|
2279
2279
|
// `flushSync` implementation only takes one argument. I don't know what's up with the type declaration for it.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var events = require('./events-
|
|
5
|
+
var events = require('./events-c54ce65e.cjs.dev.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var createDebounce = require('debounce');
|
|
@@ -347,9 +347,9 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
347
347
|
});
|
|
348
348
|
});
|
|
349
349
|
|
|
350
|
-
/**
|
|
351
|
-
* A DOM canvas which accepts threejs elements as children.
|
|
352
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
350
|
+
/**
|
|
351
|
+
* A DOM canvas which accepts threejs elements as children.
|
|
352
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
353
353
|
*/
|
|
354
354
|
const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(props, ref) {
|
|
355
355
|
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var events = require('./events-
|
|
5
|
+
var events = require('./events-2e7e6eab.cjs.prod.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var createDebounce = require('debounce');
|
|
@@ -347,9 +347,9 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
347
347
|
});
|
|
348
348
|
});
|
|
349
349
|
|
|
350
|
-
/**
|
|
351
|
-
* A DOM canvas which accepts threejs elements as children.
|
|
352
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
350
|
+
/**
|
|
351
|
+
* A DOM canvas which accepts threejs elements as children.
|
|
352
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
353
353
|
*/
|
|
354
354
|
const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(props, ref) {
|
|
355
355
|
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createPointerEvents, e as extend, u as useMutableCallback, a as useIsomorphicLayoutEffect, b as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from './events-
|
|
2
|
-
export { t as ReactThreeFiber, z as _roots, x as act, p as addAfterEffect, o as addEffect, q as addTail, n as advance, k as applyProps, y as buildGraph, g as context, f as createEvents, c as createPointerEvents, h as createPortal, b as createRoot, l as dispose, c as events, e as extend, s as flushGlobalEffects, v as flushSync, w as getRootState, m as invalidate, j as reconciler, r as render, d as unmountComponentAtNode, F as useFrame, G as useGraph, A as useInstanceHandle, H as useLoader, C as useStore, D as useThree } from './events-
|
|
1
|
+
import { c as createPointerEvents, e as extend, u as useMutableCallback, a as useIsomorphicLayoutEffect, b as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from './events-3515660a.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, z as _roots, x as act, p as addAfterEffect, o as addEffect, q as addTail, n as advance, k as applyProps, y as buildGraph, g as context, f as createEvents, c as createPointerEvents, h as createPortal, b as createRoot, l as dispose, c as events, e as extend, s as flushGlobalEffects, v as flushSync, w as getRootState, m as invalidate, j as reconciler, r as render, d as unmountComponentAtNode, F as useFrame, G as useGraph, A as useInstanceHandle, H as useLoader, C as useStore, D as useThree } from './events-3515660a.esm.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useState, useRef, useEffect, useMemo } from 'react';
|
|
5
5
|
import * as THREE from 'three';
|
|
@@ -321,9 +321,9 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
321
321
|
});
|
|
322
322
|
});
|
|
323
323
|
|
|
324
|
-
/**
|
|
325
|
-
* A DOM canvas which accepts threejs elements as children.
|
|
326
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
324
|
+
/**
|
|
325
|
+
* A DOM canvas which accepts threejs elements as children.
|
|
326
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
327
327
|
*/
|
|
328
328
|
const Canvas = /*#__PURE__*/React.forwardRef(function CanvasWrapper(props, ref) {
|
|
329
329
|
return /*#__PURE__*/jsx(FiberProvider, {
|