@react-three/fiber 8.16.1 → 8.16.3

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.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 9c83502c: fix(Canvas): don't override camera frustum props
8
+
9
+ ## 8.16.2
10
+
11
+ ### Patch Changes
12
+
13
+ - e0900489: fix(useLoader): don't dispose of memoized loader
14
+
3
15
  ## 8.16.1
4
16
 
5
17
  ### Patch Changes
@@ -1710,7 +1710,7 @@ function loadingFn(extensions, onProgress) {
1710
1710
  return Promise.all(input.map(input => new Promise((res, reject) => loader.load(input, data => {
1711
1711
  if (data.scene) Object.assign(data, buildGraph(data.scene));
1712
1712
  res(data);
1713
- }, onProgress, error => reject(new Error(`Could not load ${input}: ${error == null ? void 0 : error.message}`)))))).finally(() => loader.dispose == null ? void 0 : loader.dispose());
1713
+ }, onProgress, error => reject(new Error(`Could not load ${input}: ${error == null ? void 0 : error.message}`))))));
1714
1714
  };
1715
1715
  }
1716
1716
  /**
@@ -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
  }
@@ -1683,7 +1683,7 @@ function loadingFn(extensions, onProgress) {
1683
1683
  return Promise.all(input.map(input => new Promise((res, reject) => loader.load(input, data => {
1684
1684
  if (data.scene) Object.assign(data, buildGraph(data.scene));
1685
1685
  res(data);
1686
- }, onProgress, error => reject(new Error(`Could not load ${input}: ${error == null ? void 0 : error.message}`)))))).finally(() => loader.dispose == null ? void 0 : loader.dispose());
1686
+ }, onProgress, error => reject(new Error(`Could not load ${input}: ${error == null ? void 0 : error.message}`))))));
1687
1687
  };
1688
1688
  }
1689
1689
  /**
@@ -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
  }
@@ -1710,7 +1710,7 @@ function loadingFn(extensions, onProgress) {
1710
1710
  return Promise.all(input.map(input => new Promise((res, reject) => loader.load(input, data => {
1711
1711
  if (data.scene) Object.assign(data, buildGraph(data.scene));
1712
1712
  res(data);
1713
- }, onProgress, error => reject(new Error(`Could not load ${input}: ${error == null ? void 0 : error.message}`)))))).finally(() => loader.dispose == null ? void 0 : loader.dispose());
1713
+ }, onProgress, error => reject(new Error(`Could not load ${input}: ${error == null ? void 0 : error.message}`))))));
1714
1714
  };
1715
1715
  }
1716
1716
  /**
@@ -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
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-382d4f47.cjs.dev.js');
5
+ var index = require('./index-2a9d0be1.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-e8d6e828.cjs.prod.js');
5
+ var index = require('./index-ee718c12.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-d98fd1c7.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-d98fd1c7.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-b5f90606.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-b5f90606.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-382d4f47.cjs.dev.js');
5
+ var index = require('../../dist/index-2a9d0be1.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-e8d6e828.cjs.prod.js');
5
+ var index = require('../../dist/index-ee718c12.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-d98fd1c7.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-d98fd1c7.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-b5f90606.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-b5f90606.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.1",
3
+ "version": "8.16.3",
4
4
  "description": "A React renderer for Threejs",
5
5
  "keywords": [
6
6
  "react",