@react-three/fiber 8.0.14 → 8.0.17

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>;
@@ -1228,7 +1228,7 @@ const createStore = (invalidate, advance) => {
1228
1228
  connected: false
1229
1229
  },
1230
1230
  xr: null,
1231
- invalidate: () => invalidate(get()),
1231
+ invalidate: (frames = 1) => invalidate(get(), frames),
1232
1232
  advance: (timestamp, runGlobalEffects) => advance(timestamp, runGlobalEffects, get()),
1233
1233
  legacy: false,
1234
1234
  linear: false,
@@ -1480,13 +1480,13 @@ function createLoop(roots) {
1480
1480
  }
1481
1481
  }
1482
1482
 
1483
- function invalidate(state) {
1483
+ function invalidate(state, frames = 1) {
1484
1484
  var _state$gl$xr2;
1485
1485
 
1486
- if (!state) return roots.forEach(root => invalidate(root.store.getState()));
1486
+ if (!state) return roots.forEach(root => invalidate(root.store.getState()), frames);
1487
1487
  if ((_state$gl$xr2 = state.gl.xr) != null && _state$gl$xr2.isPresenting || !state.internal.active || state.frameloop === 'never') return; // Increase frames, do not go higher than 60
1488
1488
 
1489
- state.internal.frames = Math.min(60, state.internal.frames + 1); // If the render-loop isn't active, start it
1489
+ state.internal.frames = Math.min(60, state.internal.frames + frames); // If the render-loop isn't active, start it
1490
1490
 
1491
1491
  if (!running) {
1492
1492
  running = true;
@@ -1566,14 +1566,13 @@ function loadingFn(extensions, onProgress) {
1566
1566
  }, onProgress, error => reject(`Could not load ${input}: ${error.message}`)))));
1567
1567
  };
1568
1568
  }
1569
+
1569
1570
  /**
1570
1571
  * Synchronously loads and caches assets with a three loader.
1571
1572
  *
1572
1573
  * Note: this hook's caller must be wrapped with `React.Suspense`
1573
1574
  * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
1574
1575
  */
1575
-
1576
-
1577
1576
  function useLoader(Proto, input, extensions, onProgress) {
1578
1577
  // Use suspense to load async assets
1579
1578
  const keys = Array.isArray(input) ? input : [input];
@@ -1626,23 +1625,22 @@ const createRendererInstance = (gl, canvas) => {
1626
1625
  });
1627
1626
  };
1628
1627
 
1629
- const logRecoverableError = typeof reportError === 'function' ? // In modern browsers, reportError will dispatch an error event,
1630
- // emulating an uncaught JavaScript error.
1631
- reportError : error => {
1632
- // In older browsers and test environments, fallback to console.error.
1633
- console.error(error);
1634
- };
1635
-
1636
1628
  function createRoot(canvas) {
1637
1629
  // Check against mistaken use of createRoot
1638
1630
  let prevRoot = roots.get(canvas);
1639
1631
  let prevFiber = prevRoot == null ? void 0 : prevRoot.fiber;
1640
1632
  let prevStore = prevRoot == null ? void 0 : prevRoot.store;
1641
- if (prevRoot) console.warn('R3F.createRoot should only be called once!'); // Create store
1633
+ if (prevRoot) console.warn('R3F.createRoot should only be called once!'); // Report when an error was detected in a previous render
1634
+ // https://github.com/pmndrs/react-three-fiber/pull/2261
1635
+
1636
+ const logRecoverableError = typeof reportError === 'function' ? // In modern browsers, reportError will dispatch an error event,
1637
+ // emulating an uncaught JavaScript error.
1638
+ reportError : // In older browsers and test environments, fallback to console.error.
1639
+ console.error; // Create store
1642
1640
 
1643
1641
  const store = prevStore || createStore(invalidate, advance); // Create renderer
1644
1642
 
1645
- const fiber = prevFiber || reconciler.createContainer(store, ConcurrentRoot, null, false, null, null, logRecoverableError, null); // Map it
1643
+ const fiber = prevFiber || reconciler.createContainer(store, ConcurrentRoot, null, false, null, '', logRecoverableError, null); // Map it
1646
1644
 
1647
1645
  if (!prevRoot) roots.set(canvas, {
1648
1646
  fiber,
@@ -1255,7 +1255,7 @@ const createStore = (invalidate, advance) => {
1255
1255
  connected: false
1256
1256
  },
1257
1257
  xr: null,
1258
- invalidate: () => invalidate(get()),
1258
+ invalidate: (frames = 1) => invalidate(get(), frames),
1259
1259
  advance: (timestamp, runGlobalEffects) => advance(timestamp, runGlobalEffects, get()),
1260
1260
  legacy: false,
1261
1261
  linear: false,
@@ -1507,13 +1507,13 @@ function createLoop(roots) {
1507
1507
  }
1508
1508
  }
1509
1509
 
1510
- function invalidate(state) {
1510
+ function invalidate(state, frames = 1) {
1511
1511
  var _state$gl$xr2;
1512
1512
 
1513
- if (!state) return roots.forEach(root => invalidate(root.store.getState()));
1513
+ if (!state) return roots.forEach(root => invalidate(root.store.getState()), frames);
1514
1514
  if ((_state$gl$xr2 = state.gl.xr) != null && _state$gl$xr2.isPresenting || !state.internal.active || state.frameloop === 'never') return; // Increase frames, do not go higher than 60
1515
1515
 
1516
- state.internal.frames = Math.min(60, state.internal.frames + 1); // If the render-loop isn't active, start it
1516
+ state.internal.frames = Math.min(60, state.internal.frames + frames); // If the render-loop isn't active, start it
1517
1517
 
1518
1518
  if (!running) {
1519
1519
  running = true;
@@ -1593,14 +1593,13 @@ function loadingFn(extensions, onProgress) {
1593
1593
  }, onProgress, error => reject(`Could not load ${input}: ${error.message}`)))));
1594
1594
  };
1595
1595
  }
1596
+
1596
1597
  /**
1597
1598
  * Synchronously loads and caches assets with a three loader.
1598
1599
  *
1599
1600
  * Note: this hook's caller must be wrapped with `React.Suspense`
1600
1601
  * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
1601
1602
  */
1602
-
1603
-
1604
1603
  function useLoader(Proto, input, extensions, onProgress) {
1605
1604
  // Use suspense to load async assets
1606
1605
  const keys = Array.isArray(input) ? input : [input];
@@ -1653,23 +1652,22 @@ const createRendererInstance = (gl, canvas) => {
1653
1652
  });
1654
1653
  };
1655
1654
 
1656
- const logRecoverableError = typeof reportError === 'function' ? // In modern browsers, reportError will dispatch an error event,
1657
- // emulating an uncaught JavaScript error.
1658
- reportError : error => {
1659
- // In older browsers and test environments, fallback to console.error.
1660
- console.error(error);
1661
- };
1662
-
1663
1655
  function createRoot(canvas) {
1664
1656
  // Check against mistaken use of createRoot
1665
1657
  let prevRoot = roots.get(canvas);
1666
1658
  let prevFiber = prevRoot == null ? void 0 : prevRoot.fiber;
1667
1659
  let prevStore = prevRoot == null ? void 0 : prevRoot.store;
1668
- if (prevRoot) console.warn('R3F.createRoot should only be called once!'); // Create store
1660
+ if (prevRoot) console.warn('R3F.createRoot should only be called once!'); // Report when an error was detected in a previous render
1661
+ // https://github.com/pmndrs/react-three-fiber/pull/2261
1662
+
1663
+ const logRecoverableError = typeof reportError === 'function' ? // In modern browsers, reportError will dispatch an error event,
1664
+ // emulating an uncaught JavaScript error.
1665
+ reportError : // In older browsers and test environments, fallback to console.error.
1666
+ console.error; // Create store
1669
1667
 
1670
1668
  const store = prevStore || createStore(invalidate, advance); // Create renderer
1671
1669
 
1672
- const fiber = prevFiber || reconciler.createContainer(store, constants.ConcurrentRoot, null, false, null, null, logRecoverableError, null); // Map it
1670
+ const fiber = prevFiber || reconciler.createContainer(store, constants.ConcurrentRoot, null, false, null, '', logRecoverableError, null); // Map it
1673
1671
 
1674
1672
  if (!prevRoot) roots.set(canvas, {
1675
1673
  fiber,
@@ -1255,7 +1255,7 @@ const createStore = (invalidate, advance) => {
1255
1255
  connected: false
1256
1256
  },
1257
1257
  xr: null,
1258
- invalidate: () => invalidate(get()),
1258
+ invalidate: (frames = 1) => invalidate(get(), frames),
1259
1259
  advance: (timestamp, runGlobalEffects) => advance(timestamp, runGlobalEffects, get()),
1260
1260
  legacy: false,
1261
1261
  linear: false,
@@ -1507,13 +1507,13 @@ function createLoop(roots) {
1507
1507
  }
1508
1508
  }
1509
1509
 
1510
- function invalidate(state) {
1510
+ function invalidate(state, frames = 1) {
1511
1511
  var _state$gl$xr2;
1512
1512
 
1513
- if (!state) return roots.forEach(root => invalidate(root.store.getState()));
1513
+ if (!state) return roots.forEach(root => invalidate(root.store.getState()), frames);
1514
1514
  if ((_state$gl$xr2 = state.gl.xr) != null && _state$gl$xr2.isPresenting || !state.internal.active || state.frameloop === 'never') return; // Increase frames, do not go higher than 60
1515
1515
 
1516
- state.internal.frames = Math.min(60, state.internal.frames + 1); // If the render-loop isn't active, start it
1516
+ state.internal.frames = Math.min(60, state.internal.frames + frames); // If the render-loop isn't active, start it
1517
1517
 
1518
1518
  if (!running) {
1519
1519
  running = true;
@@ -1593,14 +1593,13 @@ function loadingFn(extensions, onProgress) {
1593
1593
  }, onProgress, error => reject(`Could not load ${input}: ${error.message}`)))));
1594
1594
  };
1595
1595
  }
1596
+
1596
1597
  /**
1597
1598
  * Synchronously loads and caches assets with a three loader.
1598
1599
  *
1599
1600
  * Note: this hook's caller must be wrapped with `React.Suspense`
1600
1601
  * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
1601
1602
  */
1602
-
1603
-
1604
1603
  function useLoader(Proto, input, extensions, onProgress) {
1605
1604
  // Use suspense to load async assets
1606
1605
  const keys = Array.isArray(input) ? input : [input];
@@ -1653,23 +1652,22 @@ const createRendererInstance = (gl, canvas) => {
1653
1652
  });
1654
1653
  };
1655
1654
 
1656
- const logRecoverableError = typeof reportError === 'function' ? // In modern browsers, reportError will dispatch an error event,
1657
- // emulating an uncaught JavaScript error.
1658
- reportError : error => {
1659
- // In older browsers and test environments, fallback to console.error.
1660
- console.error(error);
1661
- };
1662
-
1663
1655
  function createRoot(canvas) {
1664
1656
  // Check against mistaken use of createRoot
1665
1657
  let prevRoot = roots.get(canvas);
1666
1658
  let prevFiber = prevRoot == null ? void 0 : prevRoot.fiber;
1667
1659
  let prevStore = prevRoot == null ? void 0 : prevRoot.store;
1668
- if (prevRoot) console.warn('R3F.createRoot should only be called once!'); // Create store
1660
+ if (prevRoot) console.warn('R3F.createRoot should only be called once!'); // Report when an error was detected in a previous render
1661
+ // https://github.com/pmndrs/react-three-fiber/pull/2261
1662
+
1663
+ const logRecoverableError = typeof reportError === 'function' ? // In modern browsers, reportError will dispatch an error event,
1664
+ // emulating an uncaught JavaScript error.
1665
+ reportError : // In older browsers and test environments, fallback to console.error.
1666
+ console.error; // Create store
1669
1667
 
1670
1668
  const store = prevStore || createStore(invalidate, advance); // Create renderer
1671
1669
 
1672
- const fiber = prevFiber || reconciler.createContainer(store, constants.ConcurrentRoot, null, false, null, null, logRecoverableError, null); // Map it
1670
+ const fiber = prevFiber || reconciler.createContainer(store, constants.ConcurrentRoot, null, false, null, '', logRecoverableError, null); // Map it
1673
1671
 
1674
1672
  if (!prevRoot) roots.set(canvas, {
1675
1673
  fiber,
@@ -2,11 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-cf0e5bff.cjs.dev.js');
5
+ var index = require('./index-f3176a33.cjs.dev.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
9
- var mergeRefs = require('react-merge-refs');
10
9
  var useMeasure = require('react-use-measure');
11
10
  require('react-reconciler/constants');
12
11
  require('zustand');
@@ -36,7 +35,6 @@ function _interopNamespace(e) {
36
35
 
37
36
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
38
37
  var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
39
- var mergeRefs__default = /*#__PURE__*/_interopDefault(mergeRefs);
40
38
  var useMeasure__default = /*#__PURE__*/_interopDefault(useMeasure);
41
39
 
42
40
  const DOM_EVENTS = {
@@ -158,8 +156,9 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
158
156
  ...resize
159
157
  });
160
158
  const canvasRef = React__namespace.useRef(null);
161
- const meshRef = React__namespace.useRef(null);
159
+ const divRef = React__namespace.useRef(null);
162
160
  const [canvas, setCanvas] = React__namespace.useState(null);
161
+ React__namespace.useImperativeHandle(forwardedRef, () => canvasRef.current);
163
162
  const handlePointerMissed = index.useMutableCallback(onPointerMissed);
164
163
  const [block, setBlock] = React__namespace.useState(false);
165
164
  const [error, setError] = React__namespace.useState(false); // Suspend this component if block is a promise (2nd run)
@@ -191,7 +190,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
191
190
  // Pass mutable reference to onPointerMissed so it's free to update
192
191
  onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
193
192
  onCreated: state => {
194
- state.events.connect == null ? void 0 : state.events.connect(meshRef.current);
193
+ state.events.connect == null ? void 0 : state.events.connect(divRef.current);
195
194
  onCreated == null ? void 0 : onCreated(state);
196
195
  }
197
196
  });
@@ -211,7 +210,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
211
210
  if (canvas) return () => index.unmountComponentAtNode(canvas);
212
211
  }, [canvas]);
213
212
  return /*#__PURE__*/React__namespace.createElement("div", _extends({
214
- ref: mergeRefs__default["default"]([meshRef, containerRef]),
213
+ ref: divRef,
215
214
  style: {
216
215
  position: 'relative',
217
216
  width: '100%',
@@ -219,12 +218,18 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
219
218
  overflow: 'hidden',
220
219
  ...style
221
220
  }
222
- }, props), /*#__PURE__*/React__namespace.createElement("canvas", {
223
- ref: mergeRefs__default["default"]([canvasRef, forwardedRef]),
221
+ }, props), /*#__PURE__*/React__namespace.createElement("div", {
222
+ ref: containerRef,
223
+ style: {
224
+ width: '100%',
225
+ height: '100%'
226
+ }
227
+ }, /*#__PURE__*/React__namespace.createElement("canvas", {
228
+ ref: canvasRef,
224
229
  style: {
225
230
  display: 'block'
226
231
  }
227
- }, fallback));
232
+ }, fallback)));
228
233
  });
229
234
 
230
235
  exports.ReactThreeFiber = index.threeTypes;
@@ -2,11 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-5844e9ba.cjs.prod.js');
5
+ var index = require('./index-4e1c76e5.cjs.prod.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
9
- var mergeRefs = require('react-merge-refs');
10
9
  var useMeasure = require('react-use-measure');
11
10
  require('react-reconciler/constants');
12
11
  require('zustand');
@@ -36,7 +35,6 @@ function _interopNamespace(e) {
36
35
 
37
36
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
38
37
  var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
39
- var mergeRefs__default = /*#__PURE__*/_interopDefault(mergeRefs);
40
38
  var useMeasure__default = /*#__PURE__*/_interopDefault(useMeasure);
41
39
 
42
40
  const DOM_EVENTS = {
@@ -158,8 +156,9 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
158
156
  ...resize
159
157
  });
160
158
  const canvasRef = React__namespace.useRef(null);
161
- const meshRef = React__namespace.useRef(null);
159
+ const divRef = React__namespace.useRef(null);
162
160
  const [canvas, setCanvas] = React__namespace.useState(null);
161
+ React__namespace.useImperativeHandle(forwardedRef, () => canvasRef.current);
163
162
  const handlePointerMissed = index.useMutableCallback(onPointerMissed);
164
163
  const [block, setBlock] = React__namespace.useState(false);
165
164
  const [error, setError] = React__namespace.useState(false); // Suspend this component if block is a promise (2nd run)
@@ -191,7 +190,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
191
190
  // Pass mutable reference to onPointerMissed so it's free to update
192
191
  onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
193
192
  onCreated: state => {
194
- state.events.connect == null ? void 0 : state.events.connect(meshRef.current);
193
+ state.events.connect == null ? void 0 : state.events.connect(divRef.current);
195
194
  onCreated == null ? void 0 : onCreated(state);
196
195
  }
197
196
  });
@@ -211,7 +210,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
211
210
  if (canvas) return () => index.unmountComponentAtNode(canvas);
212
211
  }, [canvas]);
213
212
  return /*#__PURE__*/React__namespace.createElement("div", _extends({
214
- ref: mergeRefs__default["default"]([meshRef, containerRef]),
213
+ ref: divRef,
215
214
  style: {
216
215
  position: 'relative',
217
216
  width: '100%',
@@ -219,12 +218,18 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
219
218
  overflow: 'hidden',
220
219
  ...style
221
220
  }
222
- }, props), /*#__PURE__*/React__namespace.createElement("canvas", {
223
- ref: mergeRefs__default["default"]([canvasRef, forwardedRef]),
221
+ }, props), /*#__PURE__*/React__namespace.createElement("div", {
222
+ ref: containerRef,
223
+ style: {
224
+ width: '100%',
225
+ height: '100%'
226
+ }
227
+ }, /*#__PURE__*/React__namespace.createElement("canvas", {
228
+ ref: canvasRef,
224
229
  style: {
225
230
  display: 'block'
226
231
  }
227
- }, fallback));
232
+ }, fallback)));
228
233
  });
229
234
 
230
235
  exports.ReactThreeFiber = index.threeTypes;
@@ -1,9 +1,8 @@
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-c0771a1d.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, 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-c0771a1d.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-136ca0b0.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, 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-136ca0b0.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';
6
- import mergeRefs from 'react-merge-refs';
7
6
  import useMeasure from 'react-use-measure';
8
7
  import 'react-reconciler/constants';
9
8
  import 'zustand';
@@ -130,8 +129,9 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
130
129
  ...resize
131
130
  });
132
131
  const canvasRef = React.useRef(null);
133
- const meshRef = React.useRef(null);
132
+ const divRef = React.useRef(null);
134
133
  const [canvas, setCanvas] = React.useState(null);
134
+ React.useImperativeHandle(forwardedRef, () => canvasRef.current);
135
135
  const handlePointerMissed = useMutableCallback(onPointerMissed);
136
136
  const [block, setBlock] = React.useState(false);
137
137
  const [error, setError] = React.useState(false); // Suspend this component if block is a promise (2nd run)
@@ -163,7 +163,7 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
163
163
  // Pass mutable reference to onPointerMissed so it's free to update
164
164
  onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
165
165
  onCreated: state => {
166
- state.events.connect == null ? void 0 : state.events.connect(meshRef.current);
166
+ state.events.connect == null ? void 0 : state.events.connect(divRef.current);
167
167
  onCreated == null ? void 0 : onCreated(state);
168
168
  }
169
169
  });
@@ -183,7 +183,7 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
183
183
  if (canvas) return () => unmountComponentAtNode(canvas);
184
184
  }, [canvas]);
185
185
  return /*#__PURE__*/React.createElement("div", _extends({
186
- ref: mergeRefs([meshRef, containerRef]),
186
+ ref: divRef,
187
187
  style: {
188
188
  position: 'relative',
189
189
  width: '100%',
@@ -191,12 +191,18 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
191
191
  overflow: 'hidden',
192
192
  ...style
193
193
  }
194
- }, props), /*#__PURE__*/React.createElement("canvas", {
195
- ref: mergeRefs([canvasRef, forwardedRef]),
194
+ }, props), /*#__PURE__*/React.createElement("div", {
195
+ ref: containerRef,
196
+ style: {
197
+ width: '100%',
198
+ height: '100%'
199
+ }
200
+ }, /*#__PURE__*/React.createElement("canvas", {
201
+ ref: canvasRef,
196
202
  style: {
197
203
  display: 'block'
198
204
  }
199
- }, fallback));
205
+ }, fallback)));
200
206
  });
201
207
 
202
208
  export { Canvas, createPointerEvents as events };