@react-three/fiber 8.16.2 → 8.16.4

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @react-three/fiber
2
2
 
3
+ ## 8.16.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 1270d24c: fix: missing dependency on inject function
8
+
9
+ ## 8.16.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 9c83502c: fix(Canvas): don't override camera frustum props
14
+
3
15
  ## 8.16.2
4
16
 
5
17
  ### Patch Changes
@@ -1901,7 +1901,15 @@ function createRoot(canvas) {
1901
1901
  const camera = isCamera ? cameraOptions : orthographic ? new THREE__namespace.OrthographicCamera(0, 0, 0, 0, 0.1, 1000) : new THREE__namespace.PerspectiveCamera(75, 0, 0.1, 1000);
1902
1902
  if (!isCamera) {
1903
1903
  camera.position.z = 5;
1904
- if (cameraOptions) applyProps(camera, cameraOptions);
1904
+ if (cameraOptions) {
1905
+ applyProps(camera, cameraOptions);
1906
+ // Preserve user-defined frustum if possible
1907
+ // https://github.com/pmndrs/react-three-fiber/issues/3160
1908
+ if ('aspect' in cameraOptions || 'left' in cameraOptions || 'right' in cameraOptions || 'bottom' in cameraOptions || 'top' in cameraOptions) {
1909
+ camera.manual = true;
1910
+ camera.updateProjectionMatrix();
1911
+ }
1912
+ }
1905
1913
  // Always look at center by default
1906
1914
  if (!state.camera && !(cameraOptions != null && cameraOptions.rotation)) camera.lookAt(0, 0, 0);
1907
1915
  }
@@ -2241,14 +2249,19 @@ function Portal({
2241
2249
  const unsub = previousRoot.subscribe(prev => usePortalStore.setState(state => inject(prev, state)));
2242
2250
  return () => {
2243
2251
  unsub();
2244
- usePortalStore.destroy();
2245
2252
  };
2246
2253
  // eslint-disable-next-line react-hooks/exhaustive-deps
2247
- }, []);
2254
+ }, [inject]);
2248
2255
  React__namespace.useEffect(() => {
2249
2256
  usePortalStore.setState(injectState => inject(previousRoot.getState(), injectState));
2250
2257
  // eslint-disable-next-line react-hooks/exhaustive-deps
2251
2258
  }, [inject]);
2259
+ React__namespace.useEffect(() => {
2260
+ return () => {
2261
+ usePortalStore.destroy();
2262
+ };
2263
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2264
+ }, []);
2252
2265
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, reconciler.createPortal( /*#__PURE__*/React__namespace.createElement(context.Provider, {
2253
2266
  value: usePortalStore
2254
2267
  }, children), usePortalStore, null));
@@ -1901,7 +1901,15 @@ function createRoot(canvas) {
1901
1901
  const camera = isCamera ? cameraOptions : orthographic ? new THREE__namespace.OrthographicCamera(0, 0, 0, 0, 0.1, 1000) : new THREE__namespace.PerspectiveCamera(75, 0, 0.1, 1000);
1902
1902
  if (!isCamera) {
1903
1903
  camera.position.z = 5;
1904
- if (cameraOptions) applyProps(camera, cameraOptions);
1904
+ if (cameraOptions) {
1905
+ applyProps(camera, cameraOptions);
1906
+ // Preserve user-defined frustum if possible
1907
+ // https://github.com/pmndrs/react-three-fiber/issues/3160
1908
+ if ('aspect' in cameraOptions || 'left' in cameraOptions || 'right' in cameraOptions || 'bottom' in cameraOptions || 'top' in cameraOptions) {
1909
+ camera.manual = true;
1910
+ camera.updateProjectionMatrix();
1911
+ }
1912
+ }
1905
1913
  // Always look at center by default
1906
1914
  if (!state.camera && !(cameraOptions != null && cameraOptions.rotation)) camera.lookAt(0, 0, 0);
1907
1915
  }
@@ -2241,14 +2249,19 @@ function Portal({
2241
2249
  const unsub = previousRoot.subscribe(prev => usePortalStore.setState(state => inject(prev, state)));
2242
2250
  return () => {
2243
2251
  unsub();
2244
- usePortalStore.destroy();
2245
2252
  };
2246
2253
  // eslint-disable-next-line react-hooks/exhaustive-deps
2247
- }, []);
2254
+ }, [inject]);
2248
2255
  React__namespace.useEffect(() => {
2249
2256
  usePortalStore.setState(injectState => inject(previousRoot.getState(), injectState));
2250
2257
  // eslint-disable-next-line react-hooks/exhaustive-deps
2251
2258
  }, [inject]);
2259
+ React__namespace.useEffect(() => {
2260
+ return () => {
2261
+ usePortalStore.destroy();
2262
+ };
2263
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2264
+ }, []);
2252
2265
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, reconciler.createPortal( /*#__PURE__*/React__namespace.createElement(context.Provider, {
2253
2266
  value: usePortalStore
2254
2267
  }, children), usePortalStore, null));
@@ -1874,7 +1874,15 @@ function createRoot(canvas) {
1874
1874
  const camera = isCamera ? cameraOptions : orthographic ? new THREE.OrthographicCamera(0, 0, 0, 0, 0.1, 1000) : new THREE.PerspectiveCamera(75, 0, 0.1, 1000);
1875
1875
  if (!isCamera) {
1876
1876
  camera.position.z = 5;
1877
- if (cameraOptions) applyProps(camera, cameraOptions);
1877
+ if (cameraOptions) {
1878
+ applyProps(camera, cameraOptions);
1879
+ // Preserve user-defined frustum if possible
1880
+ // https://github.com/pmndrs/react-three-fiber/issues/3160
1881
+ if ('aspect' in cameraOptions || 'left' in cameraOptions || 'right' in cameraOptions || 'bottom' in cameraOptions || 'top' in cameraOptions) {
1882
+ camera.manual = true;
1883
+ camera.updateProjectionMatrix();
1884
+ }
1885
+ }
1878
1886
  // Always look at center by default
1879
1887
  if (!state.camera && !(cameraOptions != null && cameraOptions.rotation)) camera.lookAt(0, 0, 0);
1880
1888
  }
@@ -2214,14 +2222,19 @@ function Portal({
2214
2222
  const unsub = previousRoot.subscribe(prev => usePortalStore.setState(state => inject(prev, state)));
2215
2223
  return () => {
2216
2224
  unsub();
2217
- usePortalStore.destroy();
2218
2225
  };
2219
2226
  // eslint-disable-next-line react-hooks/exhaustive-deps
2220
- }, []);
2227
+ }, [inject]);
2221
2228
  React.useEffect(() => {
2222
2229
  usePortalStore.setState(injectState => inject(previousRoot.getState(), injectState));
2223
2230
  // eslint-disable-next-line react-hooks/exhaustive-deps
2224
2231
  }, [inject]);
2232
+ React.useEffect(() => {
2233
+ return () => {
2234
+ usePortalStore.destroy();
2235
+ };
2236
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2237
+ }, []);
2225
2238
  return /*#__PURE__*/React.createElement(React.Fragment, null, reconciler.createPortal( /*#__PURE__*/React.createElement(context.Provider, {
2226
2239
  value: usePortalStore
2227
2240
  }, children), usePortalStore, null));
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-2d64b670.cjs.dev.js');
5
+ var index = require('./index-20975705.cjs.dev.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-b61f7365.cjs.prod.js');
5
+ var index = require('./index-67aff14f.cjs.prod.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
@@ -1,5 +1,5 @@
1
- import { c as createEvents, 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 './index-c636ef6d.esm.js';
2
- export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from './index-c636ef6d.esm.js';
1
+ import { c as createEvents, 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 './index-d449885c.esm.js';
2
+ export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from './index-d449885c.esm.js';
3
3
  import _extends from '@babel/runtime/helpers/esm/extends';
4
4
  import * as React from 'react';
5
5
  import * as THREE from 'three';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../../dist/index-2d64b670.cjs.dev.js');
5
+ var index = require('../../dist/index-20975705.cjs.dev.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../../dist/index-b61f7365.cjs.prod.js');
5
+ var index = require('../../dist/index-67aff14f.cjs.prod.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
@@ -1,5 +1,5 @@
1
- import { c as createEvents, e as extend, u as useMutableCallback, b as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-c636ef6d.esm.js';
2
- export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from '../../dist/index-c636ef6d.esm.js';
1
+ import { c as createEvents, e as extend, u as useMutableCallback, b as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-d449885c.esm.js';
2
+ export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from '../../dist/index-d449885c.esm.js';
3
3
  import _extends from '@babel/runtime/helpers/esm/extends';
4
4
  import * as React from 'react';
5
5
  import * as THREE from 'three';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/fiber",
3
- "version": "8.16.2",
3
+ "version": "8.16.4",
4
4
  "description": "A React renderer for Threejs",
5
5
  "keywords": [
6
6
  "react",