@react-three/fiber 8.11.5 → 8.11.7
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 +12 -0
- package/dist/{index-37bd4d5c.esm.js → index-947d20f1.esm.js} +19 -4
- package/dist/{index-17c44482.cjs.prod.js → index-ae10f2b1.cjs.prod.js} +19 -4
- package/dist/{index-d1fc6689.cjs.dev.js → index-baacab10.cjs.dev.js} +19 -4
- package/dist/react-three-fiber.cjs.dev.js +1 -1
- package/dist/react-three-fiber.cjs.prod.js +1 -1
- package/dist/react-three-fiber.esm.js +2 -2
- package/native/dist/react-three-fiber-native.cjs.dev.js +1 -1
- package/native/dist/react-three-fiber-native.cjs.prod.js +1 -1
- package/native/dist/react-three-fiber-native.esm.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @react-three/fiber
|
|
2
2
|
|
|
3
|
+
## 8.11.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 96af62d5: fix: don't overwrite public cameras
|
|
8
|
+
|
|
9
|
+
## 8.11.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7d319c18: Fix is.equ obj:shallow, allow it to test arrays 1 level deep, fix canvas.camera prop being stale
|
|
14
|
+
|
|
3
15
|
## 8.11.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -104,11 +104,24 @@ const is = {
|
|
|
104
104
|
if ((isArr || isObj) && a === b) return true;
|
|
105
105
|
// Last resort, go through keys
|
|
106
106
|
let i;
|
|
107
|
+
// Check if a has all the keys of b
|
|
107
108
|
for (i in a) if (!(i in b)) return false;
|
|
108
|
-
|
|
109
|
+
// Check if values between keys match
|
|
110
|
+
if (isObj && arrays === 'shallow' && objects === 'shallow') {
|
|
111
|
+
for (i in strict ? b : a) if (!is.equ(a[i], b[i], {
|
|
112
|
+
strict,
|
|
113
|
+
objects: 'reference'
|
|
114
|
+
})) return false;
|
|
115
|
+
} else {
|
|
116
|
+
for (i in strict ? b : a) if (a[i] !== b[i]) return false;
|
|
117
|
+
}
|
|
118
|
+
// If i is undefined
|
|
109
119
|
if (is.und(i)) {
|
|
120
|
+
// If both arrays are empty we consider them equal
|
|
110
121
|
if (isArr && a.length === 0 && b.length === 0) return true;
|
|
122
|
+
// If both objects are empty we consider them equal
|
|
111
123
|
if (isObj && Object.keys(a).length === 0 && Object.keys(b).length === 0) return true;
|
|
124
|
+
// Otherwise match them by value
|
|
112
125
|
if (a !== b) return false;
|
|
113
126
|
}
|
|
114
127
|
return true;
|
|
@@ -1707,6 +1720,7 @@ function createRoot(canvas) {
|
|
|
1707
1720
|
// Locals
|
|
1708
1721
|
let onCreated;
|
|
1709
1722
|
let configured = false;
|
|
1723
|
+
let lastCamera;
|
|
1710
1724
|
return {
|
|
1711
1725
|
configure(props = {}) {
|
|
1712
1726
|
let {
|
|
@@ -1755,15 +1769,16 @@ function createRoot(canvas) {
|
|
|
1755
1769
|
}
|
|
1756
1770
|
});
|
|
1757
1771
|
|
|
1758
|
-
// Create default camera
|
|
1759
|
-
if (!state.camera) {
|
|
1772
|
+
// Create default camera, don't overwrite any user-set state
|
|
1773
|
+
if (!state.camera || state.camera === lastCamera && !is.equ(lastCamera, cameraOptions, shallowLoose)) {
|
|
1774
|
+
lastCamera = cameraOptions;
|
|
1760
1775
|
const isCamera = cameraOptions instanceof THREE.Camera;
|
|
1761
1776
|
const camera = isCamera ? cameraOptions : orthographic ? new THREE.OrthographicCamera(0, 0, 0, 0, 0.1, 1000) : new THREE.PerspectiveCamera(75, 0, 0.1, 1000);
|
|
1762
1777
|
if (!isCamera) {
|
|
1763
1778
|
camera.position.z = 5;
|
|
1764
1779
|
if (cameraOptions) applyProps(camera, cameraOptions);
|
|
1765
1780
|
// Always look at center by default
|
|
1766
|
-
if (!(cameraOptions != null && cameraOptions.rotation)) camera.lookAt(0, 0, 0);
|
|
1781
|
+
if (!state.camera && !(cameraOptions != null && cameraOptions.rotation)) camera.lookAt(0, 0, 0);
|
|
1767
1782
|
}
|
|
1768
1783
|
state.set({
|
|
1769
1784
|
camera
|
|
@@ -131,11 +131,24 @@ const is = {
|
|
|
131
131
|
if ((isArr || isObj) && a === b) return true;
|
|
132
132
|
// Last resort, go through keys
|
|
133
133
|
let i;
|
|
134
|
+
// Check if a has all the keys of b
|
|
134
135
|
for (i in a) if (!(i in b)) return false;
|
|
135
|
-
|
|
136
|
+
// Check if values between keys match
|
|
137
|
+
if (isObj && arrays === 'shallow' && objects === 'shallow') {
|
|
138
|
+
for (i in strict ? b : a) if (!is.equ(a[i], b[i], {
|
|
139
|
+
strict,
|
|
140
|
+
objects: 'reference'
|
|
141
|
+
})) return false;
|
|
142
|
+
} else {
|
|
143
|
+
for (i in strict ? b : a) if (a[i] !== b[i]) return false;
|
|
144
|
+
}
|
|
145
|
+
// If i is undefined
|
|
136
146
|
if (is.und(i)) {
|
|
147
|
+
// If both arrays are empty we consider them equal
|
|
137
148
|
if (isArr && a.length === 0 && b.length === 0) return true;
|
|
149
|
+
// If both objects are empty we consider them equal
|
|
138
150
|
if (isObj && Object.keys(a).length === 0 && Object.keys(b).length === 0) return true;
|
|
151
|
+
// Otherwise match them by value
|
|
139
152
|
if (a !== b) return false;
|
|
140
153
|
}
|
|
141
154
|
return true;
|
|
@@ -1734,6 +1747,7 @@ function createRoot(canvas) {
|
|
|
1734
1747
|
// Locals
|
|
1735
1748
|
let onCreated;
|
|
1736
1749
|
let configured = false;
|
|
1750
|
+
let lastCamera;
|
|
1737
1751
|
return {
|
|
1738
1752
|
configure(props = {}) {
|
|
1739
1753
|
let {
|
|
@@ -1782,15 +1796,16 @@ function createRoot(canvas) {
|
|
|
1782
1796
|
}
|
|
1783
1797
|
});
|
|
1784
1798
|
|
|
1785
|
-
// Create default camera
|
|
1786
|
-
if (!state.camera) {
|
|
1799
|
+
// Create default camera, don't overwrite any user-set state
|
|
1800
|
+
if (!state.camera || state.camera === lastCamera && !is.equ(lastCamera, cameraOptions, shallowLoose)) {
|
|
1801
|
+
lastCamera = cameraOptions;
|
|
1787
1802
|
const isCamera = cameraOptions instanceof THREE__namespace.Camera;
|
|
1788
1803
|
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);
|
|
1789
1804
|
if (!isCamera) {
|
|
1790
1805
|
camera.position.z = 5;
|
|
1791
1806
|
if (cameraOptions) applyProps(camera, cameraOptions);
|
|
1792
1807
|
// Always look at center by default
|
|
1793
|
-
if (!(cameraOptions != null && cameraOptions.rotation)) camera.lookAt(0, 0, 0);
|
|
1808
|
+
if (!state.camera && !(cameraOptions != null && cameraOptions.rotation)) camera.lookAt(0, 0, 0);
|
|
1794
1809
|
}
|
|
1795
1810
|
state.set({
|
|
1796
1811
|
camera
|
|
@@ -131,11 +131,24 @@ const is = {
|
|
|
131
131
|
if ((isArr || isObj) && a === b) return true;
|
|
132
132
|
// Last resort, go through keys
|
|
133
133
|
let i;
|
|
134
|
+
// Check if a has all the keys of b
|
|
134
135
|
for (i in a) if (!(i in b)) return false;
|
|
135
|
-
|
|
136
|
+
// Check if values between keys match
|
|
137
|
+
if (isObj && arrays === 'shallow' && objects === 'shallow') {
|
|
138
|
+
for (i in strict ? b : a) if (!is.equ(a[i], b[i], {
|
|
139
|
+
strict,
|
|
140
|
+
objects: 'reference'
|
|
141
|
+
})) return false;
|
|
142
|
+
} else {
|
|
143
|
+
for (i in strict ? b : a) if (a[i] !== b[i]) return false;
|
|
144
|
+
}
|
|
145
|
+
// If i is undefined
|
|
136
146
|
if (is.und(i)) {
|
|
147
|
+
// If both arrays are empty we consider them equal
|
|
137
148
|
if (isArr && a.length === 0 && b.length === 0) return true;
|
|
149
|
+
// If both objects are empty we consider them equal
|
|
138
150
|
if (isObj && Object.keys(a).length === 0 && Object.keys(b).length === 0) return true;
|
|
151
|
+
// Otherwise match them by value
|
|
139
152
|
if (a !== b) return false;
|
|
140
153
|
}
|
|
141
154
|
return true;
|
|
@@ -1734,6 +1747,7 @@ function createRoot(canvas) {
|
|
|
1734
1747
|
// Locals
|
|
1735
1748
|
let onCreated;
|
|
1736
1749
|
let configured = false;
|
|
1750
|
+
let lastCamera;
|
|
1737
1751
|
return {
|
|
1738
1752
|
configure(props = {}) {
|
|
1739
1753
|
let {
|
|
@@ -1782,15 +1796,16 @@ function createRoot(canvas) {
|
|
|
1782
1796
|
}
|
|
1783
1797
|
});
|
|
1784
1798
|
|
|
1785
|
-
// Create default camera
|
|
1786
|
-
if (!state.camera) {
|
|
1799
|
+
// Create default camera, don't overwrite any user-set state
|
|
1800
|
+
if (!state.camera || state.camera === lastCamera && !is.equ(lastCamera, cameraOptions, shallowLoose)) {
|
|
1801
|
+
lastCamera = cameraOptions;
|
|
1787
1802
|
const isCamera = cameraOptions instanceof THREE__namespace.Camera;
|
|
1788
1803
|
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);
|
|
1789
1804
|
if (!isCamera) {
|
|
1790
1805
|
camera.position.z = 5;
|
|
1791
1806
|
if (cameraOptions) applyProps(camera, cameraOptions);
|
|
1792
1807
|
// Always look at center by default
|
|
1793
|
-
if (!(cameraOptions != null && cameraOptions.rotation)) camera.lookAt(0, 0, 0);
|
|
1808
|
+
if (!state.camera && !(cameraOptions != null && cameraOptions.rotation)) camera.lookAt(0, 0, 0);
|
|
1794
1809
|
}
|
|
1795
1810
|
state.set({
|
|
1796
1811
|
camera
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
5
|
+
var index = require('./index-baacab10.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-
|
|
5
|
+
var index = require('./index-ae10f2b1.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 createRoot, i as isRef, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-
|
|
2
|
-
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal, a 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, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from './index-
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, i as isRef, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-947d20f1.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal, a 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, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from './index-947d20f1.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-
|
|
5
|
+
var index = require('../../dist/index-baacab10.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-
|
|
5
|
+
var index = require('../../dist/index-ae10f2b1.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 createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-
|
|
2
|
-
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal, a 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, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from '../../dist/index-
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-947d20f1.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal, a 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, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from '../../dist/index-947d20f1.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';
|