@react-three/fiber 7.0.18 → 7.0.19
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 +6 -0
- package/dist/react-three-fiber.cjs.dev.js +28 -23
- package/dist/react-three-fiber.cjs.prod.js +28 -23
- package/dist/react-three-fiber.esm.js +28 -22
- package/native/dist/react-three-fiber-native.cjs.d.ts +11 -0
- package/native/dist/react-three-fiber-native.cjs.js +16 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var THREE = require('three');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var create = require('zustand');
|
|
8
|
-
var shallow = require('zustand/shallow');
|
|
9
8
|
var Reconciler = require('react-reconciler');
|
|
10
9
|
var scheduler = require('scheduler');
|
|
11
10
|
var useAsset = require('use-asset');
|
|
@@ -37,7 +36,6 @@ function _interopNamespace(e) {
|
|
|
37
36
|
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
|
|
38
37
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
39
38
|
var create__default = /*#__PURE__*/_interopDefault(create);
|
|
40
|
-
var shallow__default = /*#__PURE__*/_interopDefault(shallow);
|
|
41
39
|
var Reconciler__default = /*#__PURE__*/_interopDefault(Reconciler);
|
|
42
40
|
var mergeRefs__default = /*#__PURE__*/_interopDefault(mergeRefs);
|
|
43
41
|
var useMeasure__default = /*#__PURE__*/_interopDefault(useMeasure);
|
|
@@ -1280,38 +1278,45 @@ const createStore = (applyProps, invalidate, advance, props) => {
|
|
|
1280
1278
|
}
|
|
1281
1279
|
}
|
|
1282
1280
|
};
|
|
1283
|
-
});
|
|
1281
|
+
});
|
|
1282
|
+
const state = rootState.getState(); // Resize camera and renderer on changes to size and pixelratio
|
|
1284
1283
|
|
|
1284
|
+
let oldSize = state.size;
|
|
1285
|
+
let oldDpr = state.viewport.dpr;
|
|
1285
1286
|
rootState.subscribe(() => {
|
|
1286
1287
|
const {
|
|
1287
1288
|
camera,
|
|
1288
1289
|
size,
|
|
1289
1290
|
viewport,
|
|
1290
1291
|
internal
|
|
1291
|
-
} = rootState.getState();
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
camera
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1292
|
+
} = rootState.getState();
|
|
1293
|
+
|
|
1294
|
+
if (size !== oldSize || viewport.dpr !== oldDpr) {
|
|
1295
|
+
// https://github.com/pmndrs/react-three-fiber/issues/92
|
|
1296
|
+
// Do not mess with the camera if it belongs to the user
|
|
1297
|
+
if (!(internal.lastProps.camera instanceof THREE__namespace.Camera)) {
|
|
1298
|
+
if (isOrthographicCamera(camera)) {
|
|
1299
|
+
camera.left = size.width / -2;
|
|
1300
|
+
camera.right = size.width / 2;
|
|
1301
|
+
camera.top = size.height / 2;
|
|
1302
|
+
camera.bottom = size.height / -2;
|
|
1303
|
+
} else {
|
|
1304
|
+
camera.aspect = size.width / size.height;
|
|
1305
|
+
}
|
|
1303
1306
|
|
|
1304
|
-
|
|
1305
|
-
|
|
1307
|
+
camera.updateProjectionMatrix(); // https://github.com/pmndrs/react-three-fiber/issues/178
|
|
1308
|
+
// Update matrix world since the renderer is a frame late
|
|
1306
1309
|
|
|
1307
|
-
|
|
1308
|
-
|
|
1310
|
+
camera.updateMatrixWorld();
|
|
1311
|
+
} // Update renderer
|
|
1309
1312
|
|
|
1310
1313
|
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1314
|
+
gl.setPixelRatio(viewport.dpr);
|
|
1315
|
+
gl.setSize(size.width, size.height);
|
|
1316
|
+
oldSize = size;
|
|
1317
|
+
oldDpr = viewport.dpr;
|
|
1318
|
+
}
|
|
1319
|
+
}); // Update size
|
|
1315
1320
|
|
|
1316
1321
|
if (size) state.setSize(size.width, size.height); // Invalidate on any change
|
|
1317
1322
|
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var THREE = require('three');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var create = require('zustand');
|
|
8
|
-
var shallow = require('zustand/shallow');
|
|
9
8
|
var Reconciler = require('react-reconciler');
|
|
10
9
|
var scheduler = require('scheduler');
|
|
11
10
|
var useAsset = require('use-asset');
|
|
@@ -37,7 +36,6 @@ function _interopNamespace(e) {
|
|
|
37
36
|
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
|
|
38
37
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
39
38
|
var create__default = /*#__PURE__*/_interopDefault(create);
|
|
40
|
-
var shallow__default = /*#__PURE__*/_interopDefault(shallow);
|
|
41
39
|
var Reconciler__default = /*#__PURE__*/_interopDefault(Reconciler);
|
|
42
40
|
var mergeRefs__default = /*#__PURE__*/_interopDefault(mergeRefs);
|
|
43
41
|
var useMeasure__default = /*#__PURE__*/_interopDefault(useMeasure);
|
|
@@ -1280,38 +1278,45 @@ const createStore = (applyProps, invalidate, advance, props) => {
|
|
|
1280
1278
|
}
|
|
1281
1279
|
}
|
|
1282
1280
|
};
|
|
1283
|
-
});
|
|
1281
|
+
});
|
|
1282
|
+
const state = rootState.getState(); // Resize camera and renderer on changes to size and pixelratio
|
|
1284
1283
|
|
|
1284
|
+
let oldSize = state.size;
|
|
1285
|
+
let oldDpr = state.viewport.dpr;
|
|
1285
1286
|
rootState.subscribe(() => {
|
|
1286
1287
|
const {
|
|
1287
1288
|
camera,
|
|
1288
1289
|
size,
|
|
1289
1290
|
viewport,
|
|
1290
1291
|
internal
|
|
1291
|
-
} = rootState.getState();
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
camera
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1292
|
+
} = rootState.getState();
|
|
1293
|
+
|
|
1294
|
+
if (size !== oldSize || viewport.dpr !== oldDpr) {
|
|
1295
|
+
// https://github.com/pmndrs/react-three-fiber/issues/92
|
|
1296
|
+
// Do not mess with the camera if it belongs to the user
|
|
1297
|
+
if (!(internal.lastProps.camera instanceof THREE__namespace.Camera)) {
|
|
1298
|
+
if (isOrthographicCamera(camera)) {
|
|
1299
|
+
camera.left = size.width / -2;
|
|
1300
|
+
camera.right = size.width / 2;
|
|
1301
|
+
camera.top = size.height / 2;
|
|
1302
|
+
camera.bottom = size.height / -2;
|
|
1303
|
+
} else {
|
|
1304
|
+
camera.aspect = size.width / size.height;
|
|
1305
|
+
}
|
|
1303
1306
|
|
|
1304
|
-
|
|
1305
|
-
|
|
1307
|
+
camera.updateProjectionMatrix(); // https://github.com/pmndrs/react-three-fiber/issues/178
|
|
1308
|
+
// Update matrix world since the renderer is a frame late
|
|
1306
1309
|
|
|
1307
|
-
|
|
1308
|
-
|
|
1310
|
+
camera.updateMatrixWorld();
|
|
1311
|
+
} // Update renderer
|
|
1309
1312
|
|
|
1310
1313
|
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1314
|
+
gl.setPixelRatio(viewport.dpr);
|
|
1315
|
+
gl.setSize(size.width, size.height);
|
|
1316
|
+
oldSize = size;
|
|
1317
|
+
oldDpr = viewport.dpr;
|
|
1318
|
+
}
|
|
1319
|
+
}); // Update size
|
|
1315
1320
|
|
|
1316
1321
|
if (size) state.setSize(size.width, size.height); // Invalidate on any change
|
|
1317
1322
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import create from 'zustand';
|
|
4
|
-
import shallow from 'zustand/shallow';
|
|
5
4
|
import Reconciler from 'react-reconciler';
|
|
6
5
|
import { unstable_now, unstable_runWithPriority, unstable_IdlePriority } from 'scheduler';
|
|
7
6
|
import { useAsset } from 'use-asset';
|
|
@@ -1246,38 +1245,45 @@ const createStore = (applyProps, invalidate, advance, props) => {
|
|
|
1246
1245
|
}
|
|
1247
1246
|
}
|
|
1248
1247
|
};
|
|
1249
|
-
});
|
|
1248
|
+
});
|
|
1249
|
+
const state = rootState.getState(); // Resize camera and renderer on changes to size and pixelratio
|
|
1250
1250
|
|
|
1251
|
+
let oldSize = state.size;
|
|
1252
|
+
let oldDpr = state.viewport.dpr;
|
|
1251
1253
|
rootState.subscribe(() => {
|
|
1252
1254
|
const {
|
|
1253
1255
|
camera,
|
|
1254
1256
|
size,
|
|
1255
1257
|
viewport,
|
|
1256
1258
|
internal
|
|
1257
|
-
} = rootState.getState();
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
camera
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1259
|
+
} = rootState.getState();
|
|
1260
|
+
|
|
1261
|
+
if (size !== oldSize || viewport.dpr !== oldDpr) {
|
|
1262
|
+
// https://github.com/pmndrs/react-three-fiber/issues/92
|
|
1263
|
+
// Do not mess with the camera if it belongs to the user
|
|
1264
|
+
if (!(internal.lastProps.camera instanceof THREE.Camera)) {
|
|
1265
|
+
if (isOrthographicCamera(camera)) {
|
|
1266
|
+
camera.left = size.width / -2;
|
|
1267
|
+
camera.right = size.width / 2;
|
|
1268
|
+
camera.top = size.height / 2;
|
|
1269
|
+
camera.bottom = size.height / -2;
|
|
1270
|
+
} else {
|
|
1271
|
+
camera.aspect = size.width / size.height;
|
|
1272
|
+
}
|
|
1269
1273
|
|
|
1270
|
-
|
|
1271
|
-
|
|
1274
|
+
camera.updateProjectionMatrix(); // https://github.com/pmndrs/react-three-fiber/issues/178
|
|
1275
|
+
// Update matrix world since the renderer is a frame late
|
|
1272
1276
|
|
|
1273
|
-
|
|
1274
|
-
|
|
1277
|
+
camera.updateMatrixWorld();
|
|
1278
|
+
} // Update renderer
|
|
1275
1279
|
|
|
1276
1280
|
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
+
gl.setPixelRatio(viewport.dpr);
|
|
1282
|
+
gl.setSize(size.width, size.height);
|
|
1283
|
+
oldSize = size;
|
|
1284
|
+
oldDpr = viewport.dpr;
|
|
1285
|
+
}
|
|
1286
|
+
}); // Update size
|
|
1281
1287
|
|
|
1282
1288
|
if (size) state.setSize(size.width, size.height); // Invalidate on any change
|
|
1283
1289
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// are you seeing an error that a default export doesn't exist but your source file has a default export?
|
|
2
|
+
// you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
|
|
3
|
+
|
|
4
|
+
// curious why you need to?
|
|
5
|
+
// this file exists so that you can import from the entrypoint normally
|
|
6
|
+
// except that it points to your source file and you don't need to run build constantly
|
|
7
|
+
// which means we need to re-export all of the modules from your source file
|
|
8
|
+
// and since export * doesn't include default exports, we need to read your source file
|
|
9
|
+
// to check for a default export and re-export it if it exists
|
|
10
|
+
// it's not ideal, but it works pretty well ¯\_(ツ)_/¯
|
|
11
|
+
export * from "../../src/native";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// this file might look strange and you might be wondering what it's for
|
|
3
|
+
// it's lets you import your source files by importing this entrypoint
|
|
4
|
+
// as you would import it if it was built with preconstruct build
|
|
5
|
+
// this file is slightly different to some others though
|
|
6
|
+
// it has a require hook which compiles your code with Babel
|
|
7
|
+
// this means that you don't have to set up @babel/register or anything like that
|
|
8
|
+
// but you can still require this module and it'll be compiled
|
|
9
|
+
|
|
10
|
+
// this bit of code imports the require hook and registers it
|
|
11
|
+
let unregister = require("../../../../node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../..", "../..");
|
|
12
|
+
|
|
13
|
+
// this re-exports the source file
|
|
14
|
+
module.exports = require("../../src/native.tsx");
|
|
15
|
+
|
|
16
|
+
unregister();
|