@react-three/fiber 8.0.27 → 8.1.0

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.
@@ -1,9 +1,9 @@
1
- import * as React from 'react';
2
- import type { Options as ResizeOptions } from 'react-use-measure';
3
- import { RenderProps } from '../core';
4
- export interface Props extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React.HTMLAttributes<HTMLDivElement> {
5
- children: React.ReactNode;
6
- fallback?: React.ReactNode;
7
- resize?: ResizeOptions;
8
- }
9
- export declare const Canvas: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLCanvasElement>>;
1
+ import * as React from 'react';
2
+ import type { Options as ResizeOptions } from 'react-use-measure';
3
+ import { RenderProps } from '../core';
4
+ export interface Props extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React.HTMLAttributes<HTMLDivElement> {
5
+ children: React.ReactNode;
6
+ fallback?: React.ReactNode;
7
+ resize?: ResizeOptions;
8
+ }
9
+ export declare const Canvas: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLCanvasElement>>;
@@ -1,4 +1,4 @@
1
- import { UseBoundStore } from 'zustand';
2
- import { RootState } from '../core/store';
3
- import { EventManager } from '../core/events';
4
- export declare function createPointerEvents(store: UseBoundStore<RootState>): EventManager<HTMLElement>;
1
+ import { UseBoundStore } from 'zustand';
2
+ import { RootState } from '../core/store';
3
+ import { EventManager } from '../core/events';
4
+ export declare function createPointerEvents(store: UseBoundStore<RootState>): EventManager<HTMLElement>;
@@ -1184,7 +1184,9 @@ const createStore = (invalidate, advance) => {
1184
1184
  function getCurrentViewport(camera = get().camera, target = defaultTarget, size = get().size) {
1185
1185
  const {
1186
1186
  width,
1187
- height
1187
+ height,
1188
+ top,
1189
+ left
1188
1190
  } = size;
1189
1191
  const aspect = width / height;
1190
1192
  if (target instanceof THREE.Vector3) tempTarget.copy(target);else tempTarget.set(...target);
@@ -1194,6 +1196,8 @@ const createStore = (invalidate, advance) => {
1194
1196
  return {
1195
1197
  width: width / camera.zoom,
1196
1198
  height: height / camera.zoom,
1199
+ top,
1200
+ left,
1197
1201
  factor: 1,
1198
1202
  distance,
1199
1203
  aspect
@@ -1207,6 +1211,8 @@ const createStore = (invalidate, advance) => {
1207
1211
  return {
1208
1212
  width: w,
1209
1213
  height: h,
1214
+ top,
1215
+ left,
1210
1216
  factor: width / w,
1211
1217
  distance,
1212
1218
  aspect
@@ -1223,7 +1229,7 @@ const createStore = (invalidate, advance) => {
1223
1229
  }));
1224
1230
 
1225
1231
  const pointer = new THREE.Vector2();
1226
- return {
1232
+ const rootState = {
1227
1233
  set,
1228
1234
  get,
1229
1235
  // Mock objects that have to be configured
@@ -1266,6 +1272,8 @@ const createStore = (invalidate, advance) => {
1266
1272
  size: {
1267
1273
  width: 0,
1268
1274
  height: 0,
1275
+ top: 0,
1276
+ left: 0,
1269
1277
  updateStyle: false
1270
1278
  },
1271
1279
  viewport: {
@@ -1273,6 +1281,8 @@ const createStore = (invalidate, advance) => {
1273
1281
  dpr: 0,
1274
1282
  width: 0,
1275
1283
  height: 0,
1284
+ top: 0,
1285
+ left: 0,
1276
1286
  aspect: 0,
1277
1287
  distance: 0,
1278
1288
  factor: 0,
@@ -1283,11 +1293,13 @@ const createStore = (invalidate, advance) => {
1283
1293
  ...events
1284
1294
  }
1285
1295
  })),
1286
- setSize: (width, height, updateStyle) => {
1296
+ setSize: (width, height, updateStyle, top, left) => {
1287
1297
  const camera = get().camera;
1288
1298
  const size = {
1289
1299
  width,
1290
1300
  height,
1301
+ top: top || 0,
1302
+ left: left || 0,
1291
1303
  updateStyle
1292
1304
  };
1293
1305
  set(state => ({
@@ -1361,6 +1373,7 @@ const createStore = (invalidate, advance) => {
1361
1373
  }
1362
1374
  }
1363
1375
  };
1376
+ return rootState;
1364
1377
  });
1365
1378
  const state = rootState.getState();
1366
1379
  let oldSize = state.size;
@@ -1402,15 +1415,17 @@ const createStore = (invalidate, advance) => {
1402
1415
  };
1403
1416
 
1404
1417
  function createSubs(callback, subs) {
1405
- const index = subs.length;
1406
- subs.push(callback);
1407
- return () => void subs.splice(index, 1);
1418
+ const sub = {
1419
+ callback
1420
+ };
1421
+ subs.add(sub);
1422
+ return () => void subs.delete(sub);
1408
1423
  }
1409
1424
 
1410
1425
  let i;
1411
- let globalEffects = [];
1412
- let globalAfterEffects = [];
1413
- let globalTailEffects = [];
1426
+ let globalEffects = new Set();
1427
+ let globalAfterEffects = new Set();
1428
+ let globalTailEffects = new Set();
1414
1429
  /**
1415
1430
  * Adds a global render callback which is called each frame.
1416
1431
  * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
@@ -1431,7 +1446,9 @@ const addAfterEffect = callback => createSubs(callback, globalAfterEffects);
1431
1446
  const addTail = callback => createSubs(callback, globalTailEffects);
1432
1447
 
1433
1448
  function run(effects, timestamp) {
1434
- for (i = 0; i < effects.length; i++) effects[i](timestamp);
1449
+ effects.forEach(({
1450
+ callback
1451
+ }) => callback(timestamp));
1435
1452
  }
1436
1453
 
1437
1454
  let subscribers;
@@ -1473,7 +1490,7 @@ function createLoop(roots) {
1473
1490
  running = true;
1474
1491
  repeat = 0; // Run effects
1475
1492
 
1476
- if (globalEffects.length) run(globalEffects, timestamp); // Render all roots
1493
+ if (globalEffects.size) run(globalEffects, timestamp); // Render all roots
1477
1494
 
1478
1495
  roots.forEach(root => {
1479
1496
  var _state$gl$xr;
@@ -1485,11 +1502,11 @@ function createLoop(roots) {
1485
1502
  }
1486
1503
  }); // Run after-effects
1487
1504
 
1488
- if (globalAfterEffects.length) run(globalAfterEffects, timestamp); // Stop the loop if nothing invalidates it
1505
+ if (globalAfterEffects.size) run(globalAfterEffects, timestamp); // Stop the loop if nothing invalidates it
1489
1506
 
1490
1507
  if (repeat === 0) {
1491
1508
  // Tail call effects, they are called when rendering stops
1492
- if (globalTailEffects.length) run(globalTailEffects, timestamp); // Flag end of operation
1509
+ if (globalTailEffects.size) run(globalTailEffects, timestamp); // Flag end of operation
1493
1510
 
1494
1511
  running = false;
1495
1512
  return cancelAnimationFrame(frame);
@@ -1668,8 +1685,6 @@ function createRoot(canvas) {
1668
1685
  let configured = false;
1669
1686
  return {
1670
1687
  configure(props = {}) {
1671
- var _canvas$parentElement, _canvas$parentElement2, _canvas$parentElement3, _canvas$parentElement4;
1672
-
1673
1688
  let {
1674
1689
  gl: glConfig,
1675
1690
  size,
@@ -1807,11 +1822,22 @@ function createRoot(canvas) {
1807
1822
 
1808
1823
  if (dpr && state.viewport.dpr !== calculateDpr(dpr)) state.setDpr(dpr); // Check size, allow it to take on container bounds initially
1809
1824
 
1810
- size = size || {
1811
- width: (_canvas$parentElement = (_canvas$parentElement2 = canvas.parentElement) == null ? void 0 : _canvas$parentElement2.clientWidth) != null ? _canvas$parentElement : 0,
1812
- height: (_canvas$parentElement3 = (_canvas$parentElement4 = canvas.parentElement) == null ? void 0 : _canvas$parentElement4.clientHeight) != null ? _canvas$parentElement3 : 0
1813
- };
1814
- if (!is.equ(size, state.size, shallowLoose)) state.setSize(size.width, size.height, size.updateStyle); // Check frameloop
1825
+ size = size || (canvas.parentElement ? {
1826
+ width: canvas.parentElement.clientWidth,
1827
+ height: canvas.parentElement.clientHeight,
1828
+ top: canvas.parentElement.clientTop,
1829
+ left: canvas.parentElement.clientLeft
1830
+ } : {
1831
+ width: 0,
1832
+ height: 0,
1833
+ top: 0,
1834
+ left: 0
1835
+ });
1836
+
1837
+ if (!is.equ(size, state.size, shallowLoose)) {
1838
+ state.setSize(size.width, size.height, size.updateStyle, size.top, size.left);
1839
+ } // Check frameloop
1840
+
1815
1841
 
1816
1842
  if (state.frameloop !== frameloop) state.setFrameloop(frameloop); // Check pointer missed
1817
1843
 
@@ -1211,7 +1211,9 @@ const createStore = (invalidate, advance) => {
1211
1211
  function getCurrentViewport(camera = get().camera, target = defaultTarget, size = get().size) {
1212
1212
  const {
1213
1213
  width,
1214
- height
1214
+ height,
1215
+ top,
1216
+ left
1215
1217
  } = size;
1216
1218
  const aspect = width / height;
1217
1219
  if (target instanceof THREE__namespace.Vector3) tempTarget.copy(target);else tempTarget.set(...target);
@@ -1221,6 +1223,8 @@ const createStore = (invalidate, advance) => {
1221
1223
  return {
1222
1224
  width: width / camera.zoom,
1223
1225
  height: height / camera.zoom,
1226
+ top,
1227
+ left,
1224
1228
  factor: 1,
1225
1229
  distance,
1226
1230
  aspect
@@ -1234,6 +1238,8 @@ const createStore = (invalidate, advance) => {
1234
1238
  return {
1235
1239
  width: w,
1236
1240
  height: h,
1241
+ top,
1242
+ left,
1237
1243
  factor: width / w,
1238
1244
  distance,
1239
1245
  aspect
@@ -1250,7 +1256,7 @@ const createStore = (invalidate, advance) => {
1250
1256
  }));
1251
1257
 
1252
1258
  const pointer = new THREE__namespace.Vector2();
1253
- return {
1259
+ const rootState = {
1254
1260
  set,
1255
1261
  get,
1256
1262
  // Mock objects that have to be configured
@@ -1293,6 +1299,8 @@ const createStore = (invalidate, advance) => {
1293
1299
  size: {
1294
1300
  width: 0,
1295
1301
  height: 0,
1302
+ top: 0,
1303
+ left: 0,
1296
1304
  updateStyle: false
1297
1305
  },
1298
1306
  viewport: {
@@ -1300,6 +1308,8 @@ const createStore = (invalidate, advance) => {
1300
1308
  dpr: 0,
1301
1309
  width: 0,
1302
1310
  height: 0,
1311
+ top: 0,
1312
+ left: 0,
1303
1313
  aspect: 0,
1304
1314
  distance: 0,
1305
1315
  factor: 0,
@@ -1310,11 +1320,13 @@ const createStore = (invalidate, advance) => {
1310
1320
  ...events
1311
1321
  }
1312
1322
  })),
1313
- setSize: (width, height, updateStyle) => {
1323
+ setSize: (width, height, updateStyle, top, left) => {
1314
1324
  const camera = get().camera;
1315
1325
  const size = {
1316
1326
  width,
1317
1327
  height,
1328
+ top: top || 0,
1329
+ left: left || 0,
1318
1330
  updateStyle
1319
1331
  };
1320
1332
  set(state => ({
@@ -1388,6 +1400,7 @@ const createStore = (invalidate, advance) => {
1388
1400
  }
1389
1401
  }
1390
1402
  };
1403
+ return rootState;
1391
1404
  });
1392
1405
  const state = rootState.getState();
1393
1406
  let oldSize = state.size;
@@ -1429,15 +1442,17 @@ const createStore = (invalidate, advance) => {
1429
1442
  };
1430
1443
 
1431
1444
  function createSubs(callback, subs) {
1432
- const index = subs.length;
1433
- subs.push(callback);
1434
- return () => void subs.splice(index, 1);
1445
+ const sub = {
1446
+ callback
1447
+ };
1448
+ subs.add(sub);
1449
+ return () => void subs.delete(sub);
1435
1450
  }
1436
1451
 
1437
1452
  let i;
1438
- let globalEffects = [];
1439
- let globalAfterEffects = [];
1440
- let globalTailEffects = [];
1453
+ let globalEffects = new Set();
1454
+ let globalAfterEffects = new Set();
1455
+ let globalTailEffects = new Set();
1441
1456
  /**
1442
1457
  * Adds a global render callback which is called each frame.
1443
1458
  * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
@@ -1458,7 +1473,9 @@ const addAfterEffect = callback => createSubs(callback, globalAfterEffects);
1458
1473
  const addTail = callback => createSubs(callback, globalTailEffects);
1459
1474
 
1460
1475
  function run(effects, timestamp) {
1461
- for (i = 0; i < effects.length; i++) effects[i](timestamp);
1476
+ effects.forEach(({
1477
+ callback
1478
+ }) => callback(timestamp));
1462
1479
  }
1463
1480
 
1464
1481
  let subscribers;
@@ -1500,7 +1517,7 @@ function createLoop(roots) {
1500
1517
  running = true;
1501
1518
  repeat = 0; // Run effects
1502
1519
 
1503
- if (globalEffects.length) run(globalEffects, timestamp); // Render all roots
1520
+ if (globalEffects.size) run(globalEffects, timestamp); // Render all roots
1504
1521
 
1505
1522
  roots.forEach(root => {
1506
1523
  var _state$gl$xr;
@@ -1512,11 +1529,11 @@ function createLoop(roots) {
1512
1529
  }
1513
1530
  }); // Run after-effects
1514
1531
 
1515
- if (globalAfterEffects.length) run(globalAfterEffects, timestamp); // Stop the loop if nothing invalidates it
1532
+ if (globalAfterEffects.size) run(globalAfterEffects, timestamp); // Stop the loop if nothing invalidates it
1516
1533
 
1517
1534
  if (repeat === 0) {
1518
1535
  // Tail call effects, they are called when rendering stops
1519
- if (globalTailEffects.length) run(globalTailEffects, timestamp); // Flag end of operation
1536
+ if (globalTailEffects.size) run(globalTailEffects, timestamp); // Flag end of operation
1520
1537
 
1521
1538
  running = false;
1522
1539
  return cancelAnimationFrame(frame);
@@ -1695,8 +1712,6 @@ function createRoot(canvas) {
1695
1712
  let configured = false;
1696
1713
  return {
1697
1714
  configure(props = {}) {
1698
- var _canvas$parentElement, _canvas$parentElement2, _canvas$parentElement3, _canvas$parentElement4;
1699
-
1700
1715
  let {
1701
1716
  gl: glConfig,
1702
1717
  size,
@@ -1834,11 +1849,22 @@ function createRoot(canvas) {
1834
1849
 
1835
1850
  if (dpr && state.viewport.dpr !== calculateDpr(dpr)) state.setDpr(dpr); // Check size, allow it to take on container bounds initially
1836
1851
 
1837
- size = size || {
1838
- width: (_canvas$parentElement = (_canvas$parentElement2 = canvas.parentElement) == null ? void 0 : _canvas$parentElement2.clientWidth) != null ? _canvas$parentElement : 0,
1839
- height: (_canvas$parentElement3 = (_canvas$parentElement4 = canvas.parentElement) == null ? void 0 : _canvas$parentElement4.clientHeight) != null ? _canvas$parentElement3 : 0
1840
- };
1841
- if (!is.equ(size, state.size, shallowLoose)) state.setSize(size.width, size.height, size.updateStyle); // Check frameloop
1852
+ size = size || (canvas.parentElement ? {
1853
+ width: canvas.parentElement.clientWidth,
1854
+ height: canvas.parentElement.clientHeight,
1855
+ top: canvas.parentElement.clientTop,
1856
+ left: canvas.parentElement.clientLeft
1857
+ } : {
1858
+ width: 0,
1859
+ height: 0,
1860
+ top: 0,
1861
+ left: 0
1862
+ });
1863
+
1864
+ if (!is.equ(size, state.size, shallowLoose)) {
1865
+ state.setSize(size.width, size.height, size.updateStyle, size.top, size.left);
1866
+ } // Check frameloop
1867
+
1842
1868
 
1843
1869
  if (state.frameloop !== frameloop) state.setFrameloop(frameloop); // Check pointer missed
1844
1870
 
@@ -1211,7 +1211,9 @@ const createStore = (invalidate, advance) => {
1211
1211
  function getCurrentViewport(camera = get().camera, target = defaultTarget, size = get().size) {
1212
1212
  const {
1213
1213
  width,
1214
- height
1214
+ height,
1215
+ top,
1216
+ left
1215
1217
  } = size;
1216
1218
  const aspect = width / height;
1217
1219
  if (target instanceof THREE__namespace.Vector3) tempTarget.copy(target);else tempTarget.set(...target);
@@ -1221,6 +1223,8 @@ const createStore = (invalidate, advance) => {
1221
1223
  return {
1222
1224
  width: width / camera.zoom,
1223
1225
  height: height / camera.zoom,
1226
+ top,
1227
+ left,
1224
1228
  factor: 1,
1225
1229
  distance,
1226
1230
  aspect
@@ -1234,6 +1238,8 @@ const createStore = (invalidate, advance) => {
1234
1238
  return {
1235
1239
  width: w,
1236
1240
  height: h,
1241
+ top,
1242
+ left,
1237
1243
  factor: width / w,
1238
1244
  distance,
1239
1245
  aspect
@@ -1250,7 +1256,7 @@ const createStore = (invalidate, advance) => {
1250
1256
  }));
1251
1257
 
1252
1258
  const pointer = new THREE__namespace.Vector2();
1253
- return {
1259
+ const rootState = {
1254
1260
  set,
1255
1261
  get,
1256
1262
  // Mock objects that have to be configured
@@ -1293,6 +1299,8 @@ const createStore = (invalidate, advance) => {
1293
1299
  size: {
1294
1300
  width: 0,
1295
1301
  height: 0,
1302
+ top: 0,
1303
+ left: 0,
1296
1304
  updateStyle: false
1297
1305
  },
1298
1306
  viewport: {
@@ -1300,6 +1308,8 @@ const createStore = (invalidate, advance) => {
1300
1308
  dpr: 0,
1301
1309
  width: 0,
1302
1310
  height: 0,
1311
+ top: 0,
1312
+ left: 0,
1303
1313
  aspect: 0,
1304
1314
  distance: 0,
1305
1315
  factor: 0,
@@ -1310,11 +1320,13 @@ const createStore = (invalidate, advance) => {
1310
1320
  ...events
1311
1321
  }
1312
1322
  })),
1313
- setSize: (width, height, updateStyle) => {
1323
+ setSize: (width, height, updateStyle, top, left) => {
1314
1324
  const camera = get().camera;
1315
1325
  const size = {
1316
1326
  width,
1317
1327
  height,
1328
+ top: top || 0,
1329
+ left: left || 0,
1318
1330
  updateStyle
1319
1331
  };
1320
1332
  set(state => ({
@@ -1388,6 +1400,7 @@ const createStore = (invalidate, advance) => {
1388
1400
  }
1389
1401
  }
1390
1402
  };
1403
+ return rootState;
1391
1404
  });
1392
1405
  const state = rootState.getState();
1393
1406
  let oldSize = state.size;
@@ -1429,15 +1442,17 @@ const createStore = (invalidate, advance) => {
1429
1442
  };
1430
1443
 
1431
1444
  function createSubs(callback, subs) {
1432
- const index = subs.length;
1433
- subs.push(callback);
1434
- return () => void subs.splice(index, 1);
1445
+ const sub = {
1446
+ callback
1447
+ };
1448
+ subs.add(sub);
1449
+ return () => void subs.delete(sub);
1435
1450
  }
1436
1451
 
1437
1452
  let i;
1438
- let globalEffects = [];
1439
- let globalAfterEffects = [];
1440
- let globalTailEffects = [];
1453
+ let globalEffects = new Set();
1454
+ let globalAfterEffects = new Set();
1455
+ let globalTailEffects = new Set();
1441
1456
  /**
1442
1457
  * Adds a global render callback which is called each frame.
1443
1458
  * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
@@ -1458,7 +1473,9 @@ const addAfterEffect = callback => createSubs(callback, globalAfterEffects);
1458
1473
  const addTail = callback => createSubs(callback, globalTailEffects);
1459
1474
 
1460
1475
  function run(effects, timestamp) {
1461
- for (i = 0; i < effects.length; i++) effects[i](timestamp);
1476
+ effects.forEach(({
1477
+ callback
1478
+ }) => callback(timestamp));
1462
1479
  }
1463
1480
 
1464
1481
  let subscribers;
@@ -1500,7 +1517,7 @@ function createLoop(roots) {
1500
1517
  running = true;
1501
1518
  repeat = 0; // Run effects
1502
1519
 
1503
- if (globalEffects.length) run(globalEffects, timestamp); // Render all roots
1520
+ if (globalEffects.size) run(globalEffects, timestamp); // Render all roots
1504
1521
 
1505
1522
  roots.forEach(root => {
1506
1523
  var _state$gl$xr;
@@ -1512,11 +1529,11 @@ function createLoop(roots) {
1512
1529
  }
1513
1530
  }); // Run after-effects
1514
1531
 
1515
- if (globalAfterEffects.length) run(globalAfterEffects, timestamp); // Stop the loop if nothing invalidates it
1532
+ if (globalAfterEffects.size) run(globalAfterEffects, timestamp); // Stop the loop if nothing invalidates it
1516
1533
 
1517
1534
  if (repeat === 0) {
1518
1535
  // Tail call effects, they are called when rendering stops
1519
- if (globalTailEffects.length) run(globalTailEffects, timestamp); // Flag end of operation
1536
+ if (globalTailEffects.size) run(globalTailEffects, timestamp); // Flag end of operation
1520
1537
 
1521
1538
  running = false;
1522
1539
  return cancelAnimationFrame(frame);
@@ -1695,8 +1712,6 @@ function createRoot(canvas) {
1695
1712
  let configured = false;
1696
1713
  return {
1697
1714
  configure(props = {}) {
1698
- var _canvas$parentElement, _canvas$parentElement2, _canvas$parentElement3, _canvas$parentElement4;
1699
-
1700
1715
  let {
1701
1716
  gl: glConfig,
1702
1717
  size,
@@ -1834,11 +1849,22 @@ function createRoot(canvas) {
1834
1849
 
1835
1850
  if (dpr && state.viewport.dpr !== calculateDpr(dpr)) state.setDpr(dpr); // Check size, allow it to take on container bounds initially
1836
1851
 
1837
- size = size || {
1838
- width: (_canvas$parentElement = (_canvas$parentElement2 = canvas.parentElement) == null ? void 0 : _canvas$parentElement2.clientWidth) != null ? _canvas$parentElement : 0,
1839
- height: (_canvas$parentElement3 = (_canvas$parentElement4 = canvas.parentElement) == null ? void 0 : _canvas$parentElement4.clientHeight) != null ? _canvas$parentElement3 : 0
1840
- };
1841
- if (!is.equ(size, state.size, shallowLoose)) state.setSize(size.width, size.height, size.updateStyle); // Check frameloop
1852
+ size = size || (canvas.parentElement ? {
1853
+ width: canvas.parentElement.clientWidth,
1854
+ height: canvas.parentElement.clientHeight,
1855
+ top: canvas.parentElement.clientTop,
1856
+ left: canvas.parentElement.clientLeft
1857
+ } : {
1858
+ width: 0,
1859
+ height: 0,
1860
+ top: 0,
1861
+ left: 0
1862
+ });
1863
+
1864
+ if (!is.equ(size, state.size, shallowLoose)) {
1865
+ state.setSize(size.width, size.height, size.updateStyle, size.top, size.left);
1866
+ } // Check frameloop
1867
+
1842
1868
 
1843
1869
  if (state.frameloop !== frameloop) state.setFrameloop(frameloop); // Check pointer missed
1844
1870
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-acc8c265.cjs.dev.js');
5
+ var index = require('./index-c13c7c31.cjs.dev.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
@@ -144,10 +144,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
144
144
  // This will include the entire THREE namespace by default, users can extend
145
145
  // their own elements by using the createRoot API instead
146
146
  React__namespace.useMemo(() => index.extend(THREE__namespace), []);
147
- const [containerRef, {
148
- width,
149
- height
150
- }] = useMeasure__default["default"]({
147
+ const [containerRef, containerRect] = useMeasure__default["default"]({
151
148
  scroll: true,
152
149
  debounce: {
153
150
  scroll: 50,
@@ -168,7 +165,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
168
165
  if (error) throw error;
169
166
  const root = React__namespace.useRef(null);
170
167
 
171
- if (width > 0 && height > 0 && canvas) {
168
+ if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
172
169
  if (!root.current) root.current = index.createRoot(canvas);
173
170
  root.current.configure({
174
171
  gl,
@@ -183,10 +180,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
183
180
  performance,
184
181
  raycaster,
185
182
  camera,
186
- size: {
187
- width,
188
- height
189
- },
183
+ size: containerRect,
190
184
  // Pass mutable reference to onPointerMissed so it's free to update
191
185
  onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
192
186
  onCreated: state => {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-c30de6b8.cjs.prod.js');
5
+ var index = require('./index-ab905875.cjs.prod.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
@@ -144,10 +144,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
144
144
  // This will include the entire THREE namespace by default, users can extend
145
145
  // their own elements by using the createRoot API instead
146
146
  React__namespace.useMemo(() => index.extend(THREE__namespace), []);
147
- const [containerRef, {
148
- width,
149
- height
150
- }] = useMeasure__default["default"]({
147
+ const [containerRef, containerRect] = useMeasure__default["default"]({
151
148
  scroll: true,
152
149
  debounce: {
153
150
  scroll: 50,
@@ -168,7 +165,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
168
165
  if (error) throw error;
169
166
  const root = React__namespace.useRef(null);
170
167
 
171
- if (width > 0 && height > 0 && canvas) {
168
+ if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
172
169
  if (!root.current) root.current = index.createRoot(canvas);
173
170
  root.current.configure({
174
171
  gl,
@@ -183,10 +180,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
183
180
  performance,
184
181
  raycaster,
185
182
  camera,
186
- size: {
187
- width,
188
- height
189
- },
183
+ size: containerRect,
190
184
  // Pass mutable reference to onPointerMissed so it's free to update
191
185
  onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
192
186
  onCreated: state => {
@@ -1,5 +1,5 @@
1
- import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-4f1a8e2f.esm.js';
2
- export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, c as createEvents, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from './index-4f1a8e2f.esm.js';
1
+ import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-9b4af973.esm.js';
2
+ export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, c as createEvents, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from './index-9b4af973.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';
@@ -117,10 +117,7 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
117
117
  // This will include the entire THREE namespace by default, users can extend
118
118
  // their own elements by using the createRoot API instead
119
119
  React.useMemo(() => extend(THREE), []);
120
- const [containerRef, {
121
- width,
122
- height
123
- }] = useMeasure({
120
+ const [containerRef, containerRect] = useMeasure({
124
121
  scroll: true,
125
122
  debounce: {
126
123
  scroll: 50,
@@ -141,7 +138,7 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
141
138
  if (error) throw error;
142
139
  const root = React.useRef(null);
143
140
 
144
- if (width > 0 && height > 0 && canvas) {
141
+ if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
145
142
  if (!root.current) root.current = createRoot(canvas);
146
143
  root.current.configure({
147
144
  gl,
@@ -156,10 +153,7 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
156
153
  performance,
157
154
  raycaster,
158
155
  camera,
159
- size: {
160
- width,
161
- height
162
- },
156
+ size: containerRect,
163
157
  // Pass mutable reference to onPointerMissed so it's free to update
164
158
  onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
165
159
  onCreated: state => {