@react-three/fiber 8.0.19 → 8.0.20
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/declarations/src/core/renderer.d.ts +1 -1
- package/dist/{index-1e2a4313.esm.js → index-2de7e188.esm.js} +59 -56
- package/dist/{index-dcd9befe.cjs.prod.js → index-d2826534.cjs.prod.js} +59 -56
- package/dist/{index-88f08658.cjs.dev.js → index-f796b922.cjs.dev.js} +59 -56
- package/dist/react-three-fiber.cjs.dev.js +2 -2
- package/dist/react-three-fiber.cjs.prod.js +2 -2
- package/dist/react-three-fiber.esm.js +3 -3
- package/native/dist/react-three-fiber-native.cjs.dev.js +7 -5
- package/native/dist/react-three-fiber-native.cjs.prod.js +7 -5
- package/native/dist/react-three-fiber-native.esm.js +8 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -137,7 +137,7 @@ function dispose(obj) {
|
|
|
137
137
|
function prepare(object, state) {
|
|
138
138
|
const instance = object;
|
|
139
139
|
|
|
140
|
-
if (
|
|
140
|
+
if (!instance.__r3f) {
|
|
141
141
|
instance.__r3f = {
|
|
142
142
|
type: '',
|
|
143
143
|
root: null,
|
|
@@ -146,7 +146,7 @@ function prepare(object, state) {
|
|
|
146
146
|
eventCount: 0,
|
|
147
147
|
handlers: {},
|
|
148
148
|
objects: [],
|
|
149
|
-
|
|
149
|
+
parents: [],
|
|
150
150
|
...state
|
|
151
151
|
};
|
|
152
152
|
}
|
|
@@ -260,10 +260,10 @@ function diffProps(instance, {
|
|
|
260
260
|
} // This function applies a set of changes to the instance
|
|
261
261
|
|
|
262
262
|
function applyProps$1(instance, data) {
|
|
263
|
-
var _instance$__r3f3, _root$getState;
|
|
263
|
+
var _instance$__r3f3, _root$getState, _localState$parents;
|
|
264
264
|
|
|
265
265
|
// Filter equals, events and reserved props
|
|
266
|
-
const localState = (_instance$__r3f3 = instance
|
|
266
|
+
const localState = (_instance$__r3f3 = instance.__r3f) != null ? _instance$__r3f3 : {};
|
|
267
267
|
const root = localState.root;
|
|
268
268
|
const rootState = (_root$getState = root == null ? void 0 : root.getState == null ? void 0 : root.getState()) != null ? _root$getState : {};
|
|
269
269
|
const {
|
|
@@ -351,7 +351,7 @@ function applyProps$1(instance, data) {
|
|
|
351
351
|
invalidateInstance(instance);
|
|
352
352
|
});
|
|
353
353
|
|
|
354
|
-
if (localState.
|
|
354
|
+
if ((_localState$parents = localState.parents) != null && _localState$parents.length && rootState.internal && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
355
355
|
// Pre-emptively remove the instance from the interaction manager
|
|
356
356
|
const index = rootState.internal.interaction.indexOf(instance);
|
|
357
357
|
if (index > -1) rootState.internal.interaction.splice(index, 1); // Add the instance to the interaction manager only when it has handlers
|
|
@@ -453,7 +453,6 @@ function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
|
|
|
453
453
|
|
|
454
454
|
function removeInteractivity(store, object) {
|
|
455
455
|
const {
|
|
456
|
-
events,
|
|
457
456
|
internal
|
|
458
457
|
} = store.getState(); // Removes every trace of an object from the data store
|
|
459
458
|
|
|
@@ -680,14 +679,14 @@ function createEvents(store) {
|
|
|
680
679
|
return intersections;
|
|
681
680
|
}
|
|
682
681
|
|
|
683
|
-
function cancelPointer(
|
|
682
|
+
function cancelPointer(intersections) {
|
|
684
683
|
const {
|
|
685
684
|
internal
|
|
686
685
|
} = store.getState();
|
|
687
686
|
Array.from(internal.hovered.values()).forEach(hoveredObj => {
|
|
688
687
|
// When no objects were hit or the the hovered object wasn't found underneath the cursor
|
|
689
688
|
// we call onPointerOut and delete the object from the hovered-elements map
|
|
690
|
-
if (!
|
|
689
|
+
if (!intersections.length || !intersections.find(hit => hit.object === hoveredObj.object && hit.index === hoveredObj.index && hit.instanceId === hoveredObj.instanceId)) {
|
|
691
690
|
const eventObject = hoveredObj.eventObject;
|
|
692
691
|
const instance = eventObject.__r3f;
|
|
693
692
|
const handlers = instance == null ? void 0 : instance.handlers;
|
|
@@ -696,7 +695,7 @@ function createEvents(store) {
|
|
|
696
695
|
if (instance != null && instance.eventCount) {
|
|
697
696
|
// Clear out intersects, they are outdated by now
|
|
698
697
|
const data = { ...hoveredObj,
|
|
699
|
-
intersections
|
|
698
|
+
intersections
|
|
700
699
|
};
|
|
701
700
|
handlers.onPointerOut == null ? void 0 : handlers.onPointerOut(data);
|
|
702
701
|
handlers.onPointerLeave == null ? void 0 : handlers.onPointerLeave(data);
|
|
@@ -899,7 +898,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
899
898
|
|
|
900
899
|
if (!added) (_parentInstance$__r3f = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f.objects.push(child);
|
|
901
900
|
if (!child.__r3f) prepare(child, {});
|
|
902
|
-
|
|
901
|
+
|
|
902
|
+
child.__r3f.parents.push(parentInstance);
|
|
903
|
+
|
|
903
904
|
updateInstance(child);
|
|
904
905
|
invalidateInstance(child);
|
|
905
906
|
}
|
|
@@ -911,9 +912,7 @@ function createRenderer(roots, getEventPriority) {
|
|
|
911
912
|
if (child) {
|
|
912
913
|
var _child$__r3f2, _parentInstance$__r3f2;
|
|
913
914
|
|
|
914
|
-
if ((_child$__r3f2 = child.__r3f) != null && _child$__r3f2.attach) {
|
|
915
|
-
attach(parentInstance, child, child.__r3f.attach);
|
|
916
|
-
} else if (child.isObject3D && parentInstance.isObject3D) {
|
|
915
|
+
if (!((_child$__r3f2 = child.__r3f) != null && _child$__r3f2.attach) && child.isObject3D && parentInstance.isObject3D) {
|
|
917
916
|
child.parent = parentInstance;
|
|
918
917
|
child.dispatchEvent({
|
|
919
918
|
type: 'added'
|
|
@@ -926,7 +925,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
926
925
|
|
|
927
926
|
if (!added) (_parentInstance$__r3f2 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f2.objects.push(child);
|
|
928
927
|
if (!child.__r3f) prepare(child, {});
|
|
929
|
-
|
|
928
|
+
|
|
929
|
+
child.__r3f.parents.push(parentInstance);
|
|
930
|
+
|
|
930
931
|
updateInstance(child);
|
|
931
932
|
invalidateInstance(child);
|
|
932
933
|
}
|
|
@@ -941,7 +942,7 @@ function createRenderer(roots, getEventPriority) {
|
|
|
941
942
|
var _parentInstance$__r3f3, _child$__r3f3, _child$__r3f5;
|
|
942
943
|
|
|
943
944
|
// Clear the parent reference
|
|
944
|
-
if (child.__r3f) child.__r3f.
|
|
945
|
+
if (child.__r3f) child.__r3f.parents = child.__r3f.parents.filter(parent => parent !== parentInstance); // Remove child from the parents objects
|
|
945
946
|
|
|
946
947
|
if ((_parentInstance$__r3f3 = parentInstance.__r3f) != null && _parentInstance$__r3f3.objects) parentInstance.__r3f.objects = parentInstance.__r3f.objects.filter(x => x !== child); // Remove attachment
|
|
947
948
|
|
|
@@ -1002,11 +1003,11 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1002
1003
|
}
|
|
1003
1004
|
|
|
1004
1005
|
function switchInstance(instance, type, newProps, fiber) {
|
|
1005
|
-
var _instance$__r3f,
|
|
1006
|
+
var _instance$__r3f, _newInstance$__r3f;
|
|
1006
1007
|
|
|
1007
|
-
const
|
|
1008
|
-
if (!
|
|
1009
|
-
const newInstance = createInstance(type, newProps,
|
|
1008
|
+
const parents = (_instance$__r3f = instance.__r3f) == null ? void 0 : _instance$__r3f.parents;
|
|
1009
|
+
if (!(parents != null && parents.length)) return;
|
|
1010
|
+
const newInstance = createInstance(type, newProps, instance.__r3f.root); // https://github.com/pmndrs/react-three-fiber/issues/1348
|
|
1010
1011
|
// When args change the instance has to be re-constructed, which then
|
|
1011
1012
|
// forces r3f to re-parent the children and non-scene objects
|
|
1012
1013
|
// This can not include primitives, which should not have declarative children
|
|
@@ -1019,8 +1020,12 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1019
1020
|
instance.__r3f.objects.forEach(child => appendChild(newInstance, child));
|
|
1020
1021
|
|
|
1021
1022
|
instance.__r3f.objects = [];
|
|
1022
|
-
|
|
1023
|
-
|
|
1023
|
+
|
|
1024
|
+
for (const parent of parents) {
|
|
1025
|
+
removeChild(parent, instance);
|
|
1026
|
+
appendChild(parent, newInstance);
|
|
1027
|
+
} // Re-bind event handlers
|
|
1028
|
+
|
|
1024
1029
|
|
|
1025
1030
|
if (newInstance.raycast && newInstance.__r3f.eventCount) {
|
|
1026
1031
|
const rootState = newInstance.__r3f.root.getState();
|
|
@@ -1030,7 +1035,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1030
1035
|
|
|
1031
1036
|
|
|
1032
1037
|
if ((_newInstance$__r3f = newInstance.__r3f) != null && _newInstance$__r3f.attach) {
|
|
1033
|
-
|
|
1038
|
+
for (const parent of parents) {
|
|
1039
|
+
attach(parent, newInstance, newInstance.__r3f.attach);
|
|
1040
|
+
}
|
|
1034
1041
|
} // This evil hack switches the react-internal fiber node
|
|
1035
1042
|
[fiber, fiber.alternate].forEach(fiber => {
|
|
1036
1043
|
if (fiber !== null) {
|
|
@@ -1066,9 +1073,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1066
1073
|
getChildHostContext: parentHostContext => parentHostContext,
|
|
1067
1074
|
|
|
1068
1075
|
finalizeInitialChildren(instance) {
|
|
1069
|
-
var _instance$
|
|
1076
|
+
var _instance$__r3f2;
|
|
1070
1077
|
|
|
1071
|
-
const localState = (_instance$
|
|
1078
|
+
const localState = (_instance$__r3f2 = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f2 : {}; // https://github.com/facebook/react/issues/20271
|
|
1072
1079
|
// Returning true will trigger commitMount
|
|
1073
1080
|
|
|
1074
1081
|
return !!localState.handlers || !!localState.attach;
|
|
@@ -1109,11 +1116,11 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1109
1116
|
},
|
|
1110
1117
|
|
|
1111
1118
|
commitMount(instance, type, props, int) {
|
|
1112
|
-
var _instance$
|
|
1119
|
+
var _instance$__r3f3;
|
|
1113
1120
|
|
|
1114
1121
|
// https://github.com/facebook/react/issues/20271
|
|
1115
1122
|
// This will make sure events are only added once to the central container
|
|
1116
|
-
const localState = (_instance$
|
|
1123
|
+
const localState = (_instance$__r3f3 = instance.__r3f) != null ? _instance$__r3f3 : {};
|
|
1117
1124
|
|
|
1118
1125
|
if (instance.raycast && localState.handlers && localState.eventCount) {
|
|
1119
1126
|
instance.__r3f.root.getState().internal.interaction.push(instance);
|
|
@@ -1121,7 +1128,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1121
1128
|
|
|
1122
1129
|
|
|
1123
1130
|
if (localState.attach) {
|
|
1124
|
-
|
|
1131
|
+
for (const parent of localState.parents) {
|
|
1132
|
+
attach(parent, instance, localState.attach);
|
|
1133
|
+
}
|
|
1125
1134
|
}
|
|
1126
1135
|
},
|
|
1127
1136
|
|
|
@@ -1326,35 +1335,29 @@ const createStore = (invalidate, advance) => {
|
|
|
1326
1335
|
initialHits: [],
|
|
1327
1336
|
capturedMap: new Map(),
|
|
1328
1337
|
subscribe: (ref, priority, store) => {
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
store
|
|
1344
|
-
}].sort((a, b) => a.priority - b.priority)
|
|
1345
|
-
}
|
|
1346
|
-
}));
|
|
1338
|
+
const internal = get().internal; // If this subscription was given a priority, it takes rendering into its own hands
|
|
1339
|
+
// For that reason we switch off automatic rendering and increase the manual flag
|
|
1340
|
+
// As long as this flag is positive there can be no internal rendering at all
|
|
1341
|
+
// because there could be multiple render subscriptions
|
|
1342
|
+
|
|
1343
|
+
internal.priority = internal.priority + (priority > 0 ? 1 : 0);
|
|
1344
|
+
internal.subscribers.push({
|
|
1345
|
+
ref,
|
|
1346
|
+
priority,
|
|
1347
|
+
store
|
|
1348
|
+
}); // Register subscriber and sort layers from lowest to highest, meaning,
|
|
1349
|
+
// highest priority renders last (on top of the other frames)
|
|
1350
|
+
|
|
1351
|
+
internal.subscribers = internal.subscribers.sort((a, b) => a.priority - b.priority);
|
|
1347
1352
|
return () => {
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
}
|
|
1357
|
-
}));
|
|
1353
|
+
const internal = get().internal;
|
|
1354
|
+
|
|
1355
|
+
if (internal != null && internal.subscribers) {
|
|
1356
|
+
// Decrease manual flag if this subscription had a priority
|
|
1357
|
+
internal.priority = internal.priority - (priority > 0 ? 1 : 0); // Remove subscriber from list
|
|
1358
|
+
|
|
1359
|
+
internal.subscribers = internal.subscribers.filter(s => s.ref !== ref);
|
|
1360
|
+
}
|
|
1358
1361
|
};
|
|
1359
1362
|
}
|
|
1360
1363
|
}
|
|
@@ -2018,7 +2021,7 @@ function Portal({
|
|
|
2018
2021
|
reconciler.injectIntoDevTools({
|
|
2019
2022
|
bundleType: process.env.NODE_ENV === 'production' ? 0 : 1,
|
|
2020
2023
|
rendererPackageName: '@react-three/fiber',
|
|
2021
|
-
version:
|
|
2024
|
+
version: React.version
|
|
2022
2025
|
});
|
|
2023
2026
|
const act = React.unstable_act;
|
|
2024
2027
|
|
|
@@ -164,7 +164,7 @@ function dispose(obj) {
|
|
|
164
164
|
function prepare(object, state) {
|
|
165
165
|
const instance = object;
|
|
166
166
|
|
|
167
|
-
if (
|
|
167
|
+
if (!instance.__r3f) {
|
|
168
168
|
instance.__r3f = {
|
|
169
169
|
type: '',
|
|
170
170
|
root: null,
|
|
@@ -173,7 +173,7 @@ function prepare(object, state) {
|
|
|
173
173
|
eventCount: 0,
|
|
174
174
|
handlers: {},
|
|
175
175
|
objects: [],
|
|
176
|
-
|
|
176
|
+
parents: [],
|
|
177
177
|
...state
|
|
178
178
|
};
|
|
179
179
|
}
|
|
@@ -287,10 +287,10 @@ function diffProps(instance, {
|
|
|
287
287
|
} // This function applies a set of changes to the instance
|
|
288
288
|
|
|
289
289
|
function applyProps$1(instance, data) {
|
|
290
|
-
var _instance$__r3f3, _root$getState;
|
|
290
|
+
var _instance$__r3f3, _root$getState, _localState$parents;
|
|
291
291
|
|
|
292
292
|
// Filter equals, events and reserved props
|
|
293
|
-
const localState = (_instance$__r3f3 = instance
|
|
293
|
+
const localState = (_instance$__r3f3 = instance.__r3f) != null ? _instance$__r3f3 : {};
|
|
294
294
|
const root = localState.root;
|
|
295
295
|
const rootState = (_root$getState = root == null ? void 0 : root.getState == null ? void 0 : root.getState()) != null ? _root$getState : {};
|
|
296
296
|
const {
|
|
@@ -378,7 +378,7 @@ function applyProps$1(instance, data) {
|
|
|
378
378
|
invalidateInstance(instance);
|
|
379
379
|
});
|
|
380
380
|
|
|
381
|
-
if (localState.
|
|
381
|
+
if ((_localState$parents = localState.parents) != null && _localState$parents.length && rootState.internal && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
382
382
|
// Pre-emptively remove the instance from the interaction manager
|
|
383
383
|
const index = rootState.internal.interaction.indexOf(instance);
|
|
384
384
|
if (index > -1) rootState.internal.interaction.splice(index, 1); // Add the instance to the interaction manager only when it has handlers
|
|
@@ -480,7 +480,6 @@ function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
|
|
|
480
480
|
|
|
481
481
|
function removeInteractivity(store, object) {
|
|
482
482
|
const {
|
|
483
|
-
events,
|
|
484
483
|
internal
|
|
485
484
|
} = store.getState(); // Removes every trace of an object from the data store
|
|
486
485
|
|
|
@@ -707,14 +706,14 @@ function createEvents(store) {
|
|
|
707
706
|
return intersections;
|
|
708
707
|
}
|
|
709
708
|
|
|
710
|
-
function cancelPointer(
|
|
709
|
+
function cancelPointer(intersections) {
|
|
711
710
|
const {
|
|
712
711
|
internal
|
|
713
712
|
} = store.getState();
|
|
714
713
|
Array.from(internal.hovered.values()).forEach(hoveredObj => {
|
|
715
714
|
// When no objects were hit or the the hovered object wasn't found underneath the cursor
|
|
716
715
|
// we call onPointerOut and delete the object from the hovered-elements map
|
|
717
|
-
if (!
|
|
716
|
+
if (!intersections.length || !intersections.find(hit => hit.object === hoveredObj.object && hit.index === hoveredObj.index && hit.instanceId === hoveredObj.instanceId)) {
|
|
718
717
|
const eventObject = hoveredObj.eventObject;
|
|
719
718
|
const instance = eventObject.__r3f;
|
|
720
719
|
const handlers = instance == null ? void 0 : instance.handlers;
|
|
@@ -723,7 +722,7 @@ function createEvents(store) {
|
|
|
723
722
|
if (instance != null && instance.eventCount) {
|
|
724
723
|
// Clear out intersects, they are outdated by now
|
|
725
724
|
const data = { ...hoveredObj,
|
|
726
|
-
intersections
|
|
725
|
+
intersections
|
|
727
726
|
};
|
|
728
727
|
handlers.onPointerOut == null ? void 0 : handlers.onPointerOut(data);
|
|
729
728
|
handlers.onPointerLeave == null ? void 0 : handlers.onPointerLeave(data);
|
|
@@ -926,7 +925,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
926
925
|
|
|
927
926
|
if (!added) (_parentInstance$__r3f = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f.objects.push(child);
|
|
928
927
|
if (!child.__r3f) prepare(child, {});
|
|
929
|
-
|
|
928
|
+
|
|
929
|
+
child.__r3f.parents.push(parentInstance);
|
|
930
|
+
|
|
930
931
|
updateInstance(child);
|
|
931
932
|
invalidateInstance(child);
|
|
932
933
|
}
|
|
@@ -938,9 +939,7 @@ function createRenderer(roots, getEventPriority) {
|
|
|
938
939
|
if (child) {
|
|
939
940
|
var _child$__r3f2, _parentInstance$__r3f2;
|
|
940
941
|
|
|
941
|
-
if ((_child$__r3f2 = child.__r3f) != null && _child$__r3f2.attach) {
|
|
942
|
-
attach(parentInstance, child, child.__r3f.attach);
|
|
943
|
-
} else if (child.isObject3D && parentInstance.isObject3D) {
|
|
942
|
+
if (!((_child$__r3f2 = child.__r3f) != null && _child$__r3f2.attach) && child.isObject3D && parentInstance.isObject3D) {
|
|
944
943
|
child.parent = parentInstance;
|
|
945
944
|
child.dispatchEvent({
|
|
946
945
|
type: 'added'
|
|
@@ -953,7 +952,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
953
952
|
|
|
954
953
|
if (!added) (_parentInstance$__r3f2 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f2.objects.push(child);
|
|
955
954
|
if (!child.__r3f) prepare(child, {});
|
|
956
|
-
|
|
955
|
+
|
|
956
|
+
child.__r3f.parents.push(parentInstance);
|
|
957
|
+
|
|
957
958
|
updateInstance(child);
|
|
958
959
|
invalidateInstance(child);
|
|
959
960
|
}
|
|
@@ -968,7 +969,7 @@ function createRenderer(roots, getEventPriority) {
|
|
|
968
969
|
var _parentInstance$__r3f3, _child$__r3f3, _child$__r3f5;
|
|
969
970
|
|
|
970
971
|
// Clear the parent reference
|
|
971
|
-
if (child.__r3f) child.__r3f.
|
|
972
|
+
if (child.__r3f) child.__r3f.parents = child.__r3f.parents.filter(parent => parent !== parentInstance); // Remove child from the parents objects
|
|
972
973
|
|
|
973
974
|
if ((_parentInstance$__r3f3 = parentInstance.__r3f) != null && _parentInstance$__r3f3.objects) parentInstance.__r3f.objects = parentInstance.__r3f.objects.filter(x => x !== child); // Remove attachment
|
|
974
975
|
|
|
@@ -1029,11 +1030,11 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1029
1030
|
}
|
|
1030
1031
|
|
|
1031
1032
|
function switchInstance(instance, type, newProps, fiber) {
|
|
1032
|
-
var _instance$__r3f,
|
|
1033
|
+
var _instance$__r3f, _newInstance$__r3f;
|
|
1033
1034
|
|
|
1034
|
-
const
|
|
1035
|
-
if (!
|
|
1036
|
-
const newInstance = createInstance(type, newProps,
|
|
1035
|
+
const parents = (_instance$__r3f = instance.__r3f) == null ? void 0 : _instance$__r3f.parents;
|
|
1036
|
+
if (!(parents != null && parents.length)) return;
|
|
1037
|
+
const newInstance = createInstance(type, newProps, instance.__r3f.root); // https://github.com/pmndrs/react-three-fiber/issues/1348
|
|
1037
1038
|
// When args change the instance has to be re-constructed, which then
|
|
1038
1039
|
// forces r3f to re-parent the children and non-scene objects
|
|
1039
1040
|
// This can not include primitives, which should not have declarative children
|
|
@@ -1046,8 +1047,12 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1046
1047
|
instance.__r3f.objects.forEach(child => appendChild(newInstance, child));
|
|
1047
1048
|
|
|
1048
1049
|
instance.__r3f.objects = [];
|
|
1049
|
-
|
|
1050
|
-
|
|
1050
|
+
|
|
1051
|
+
for (const parent of parents) {
|
|
1052
|
+
removeChild(parent, instance);
|
|
1053
|
+
appendChild(parent, newInstance);
|
|
1054
|
+
} // Re-bind event handlers
|
|
1055
|
+
|
|
1051
1056
|
|
|
1052
1057
|
if (newInstance.raycast && newInstance.__r3f.eventCount) {
|
|
1053
1058
|
const rootState = newInstance.__r3f.root.getState();
|
|
@@ -1057,7 +1062,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1057
1062
|
|
|
1058
1063
|
|
|
1059
1064
|
if ((_newInstance$__r3f = newInstance.__r3f) != null && _newInstance$__r3f.attach) {
|
|
1060
|
-
|
|
1065
|
+
for (const parent of parents) {
|
|
1066
|
+
attach(parent, newInstance, newInstance.__r3f.attach);
|
|
1067
|
+
}
|
|
1061
1068
|
} // This evil hack switches the react-internal fiber node
|
|
1062
1069
|
[fiber, fiber.alternate].forEach(fiber => {
|
|
1063
1070
|
if (fiber !== null) {
|
|
@@ -1093,9 +1100,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1093
1100
|
getChildHostContext: parentHostContext => parentHostContext,
|
|
1094
1101
|
|
|
1095
1102
|
finalizeInitialChildren(instance) {
|
|
1096
|
-
var _instance$
|
|
1103
|
+
var _instance$__r3f2;
|
|
1097
1104
|
|
|
1098
|
-
const localState = (_instance$
|
|
1105
|
+
const localState = (_instance$__r3f2 = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f2 : {}; // https://github.com/facebook/react/issues/20271
|
|
1099
1106
|
// Returning true will trigger commitMount
|
|
1100
1107
|
|
|
1101
1108
|
return !!localState.handlers || !!localState.attach;
|
|
@@ -1136,11 +1143,11 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1136
1143
|
},
|
|
1137
1144
|
|
|
1138
1145
|
commitMount(instance, type, props, int) {
|
|
1139
|
-
var _instance$
|
|
1146
|
+
var _instance$__r3f3;
|
|
1140
1147
|
|
|
1141
1148
|
// https://github.com/facebook/react/issues/20271
|
|
1142
1149
|
// This will make sure events are only added once to the central container
|
|
1143
|
-
const localState = (_instance$
|
|
1150
|
+
const localState = (_instance$__r3f3 = instance.__r3f) != null ? _instance$__r3f3 : {};
|
|
1144
1151
|
|
|
1145
1152
|
if (instance.raycast && localState.handlers && localState.eventCount) {
|
|
1146
1153
|
instance.__r3f.root.getState().internal.interaction.push(instance);
|
|
@@ -1148,7 +1155,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1148
1155
|
|
|
1149
1156
|
|
|
1150
1157
|
if (localState.attach) {
|
|
1151
|
-
|
|
1158
|
+
for (const parent of localState.parents) {
|
|
1159
|
+
attach(parent, instance, localState.attach);
|
|
1160
|
+
}
|
|
1152
1161
|
}
|
|
1153
1162
|
},
|
|
1154
1163
|
|
|
@@ -1353,35 +1362,29 @@ const createStore = (invalidate, advance) => {
|
|
|
1353
1362
|
initialHits: [],
|
|
1354
1363
|
capturedMap: new Map(),
|
|
1355
1364
|
subscribe: (ref, priority, store) => {
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
store
|
|
1371
|
-
}].sort((a, b) => a.priority - b.priority)
|
|
1372
|
-
}
|
|
1373
|
-
}));
|
|
1365
|
+
const internal = get().internal; // If this subscription was given a priority, it takes rendering into its own hands
|
|
1366
|
+
// For that reason we switch off automatic rendering and increase the manual flag
|
|
1367
|
+
// As long as this flag is positive there can be no internal rendering at all
|
|
1368
|
+
// because there could be multiple render subscriptions
|
|
1369
|
+
|
|
1370
|
+
internal.priority = internal.priority + (priority > 0 ? 1 : 0);
|
|
1371
|
+
internal.subscribers.push({
|
|
1372
|
+
ref,
|
|
1373
|
+
priority,
|
|
1374
|
+
store
|
|
1375
|
+
}); // Register subscriber and sort layers from lowest to highest, meaning,
|
|
1376
|
+
// highest priority renders last (on top of the other frames)
|
|
1377
|
+
|
|
1378
|
+
internal.subscribers = internal.subscribers.sort((a, b) => a.priority - b.priority);
|
|
1374
1379
|
return () => {
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
}
|
|
1384
|
-
}));
|
|
1380
|
+
const internal = get().internal;
|
|
1381
|
+
|
|
1382
|
+
if (internal != null && internal.subscribers) {
|
|
1383
|
+
// Decrease manual flag if this subscription had a priority
|
|
1384
|
+
internal.priority = internal.priority - (priority > 0 ? 1 : 0); // Remove subscriber from list
|
|
1385
|
+
|
|
1386
|
+
internal.subscribers = internal.subscribers.filter(s => s.ref !== ref);
|
|
1387
|
+
}
|
|
1385
1388
|
};
|
|
1386
1389
|
}
|
|
1387
1390
|
}
|
|
@@ -2045,7 +2048,7 @@ function Portal({
|
|
|
2045
2048
|
reconciler.injectIntoDevTools({
|
|
2046
2049
|
bundleType: 0 ,
|
|
2047
2050
|
rendererPackageName: '@react-three/fiber',
|
|
2048
|
-
version:
|
|
2051
|
+
version: React__namespace.version
|
|
2049
2052
|
});
|
|
2050
2053
|
const act = React__namespace.unstable_act;
|
|
2051
2054
|
|
|
@@ -164,7 +164,7 @@ function dispose(obj) {
|
|
|
164
164
|
function prepare(object, state) {
|
|
165
165
|
const instance = object;
|
|
166
166
|
|
|
167
|
-
if (
|
|
167
|
+
if (!instance.__r3f) {
|
|
168
168
|
instance.__r3f = {
|
|
169
169
|
type: '',
|
|
170
170
|
root: null,
|
|
@@ -173,7 +173,7 @@ function prepare(object, state) {
|
|
|
173
173
|
eventCount: 0,
|
|
174
174
|
handlers: {},
|
|
175
175
|
objects: [],
|
|
176
|
-
|
|
176
|
+
parents: [],
|
|
177
177
|
...state
|
|
178
178
|
};
|
|
179
179
|
}
|
|
@@ -287,10 +287,10 @@ function diffProps(instance, {
|
|
|
287
287
|
} // This function applies a set of changes to the instance
|
|
288
288
|
|
|
289
289
|
function applyProps$1(instance, data) {
|
|
290
|
-
var _instance$__r3f3, _root$getState;
|
|
290
|
+
var _instance$__r3f3, _root$getState, _localState$parents;
|
|
291
291
|
|
|
292
292
|
// Filter equals, events and reserved props
|
|
293
|
-
const localState = (_instance$__r3f3 = instance
|
|
293
|
+
const localState = (_instance$__r3f3 = instance.__r3f) != null ? _instance$__r3f3 : {};
|
|
294
294
|
const root = localState.root;
|
|
295
295
|
const rootState = (_root$getState = root == null ? void 0 : root.getState == null ? void 0 : root.getState()) != null ? _root$getState : {};
|
|
296
296
|
const {
|
|
@@ -378,7 +378,7 @@ function applyProps$1(instance, data) {
|
|
|
378
378
|
invalidateInstance(instance);
|
|
379
379
|
});
|
|
380
380
|
|
|
381
|
-
if (localState.
|
|
381
|
+
if ((_localState$parents = localState.parents) != null && _localState$parents.length && rootState.internal && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
382
382
|
// Pre-emptively remove the instance from the interaction manager
|
|
383
383
|
const index = rootState.internal.interaction.indexOf(instance);
|
|
384
384
|
if (index > -1) rootState.internal.interaction.splice(index, 1); // Add the instance to the interaction manager only when it has handlers
|
|
@@ -480,7 +480,6 @@ function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
|
|
|
480
480
|
|
|
481
481
|
function removeInteractivity(store, object) {
|
|
482
482
|
const {
|
|
483
|
-
events,
|
|
484
483
|
internal
|
|
485
484
|
} = store.getState(); // Removes every trace of an object from the data store
|
|
486
485
|
|
|
@@ -707,14 +706,14 @@ function createEvents(store) {
|
|
|
707
706
|
return intersections;
|
|
708
707
|
}
|
|
709
708
|
|
|
710
|
-
function cancelPointer(
|
|
709
|
+
function cancelPointer(intersections) {
|
|
711
710
|
const {
|
|
712
711
|
internal
|
|
713
712
|
} = store.getState();
|
|
714
713
|
Array.from(internal.hovered.values()).forEach(hoveredObj => {
|
|
715
714
|
// When no objects were hit or the the hovered object wasn't found underneath the cursor
|
|
716
715
|
// we call onPointerOut and delete the object from the hovered-elements map
|
|
717
|
-
if (!
|
|
716
|
+
if (!intersections.length || !intersections.find(hit => hit.object === hoveredObj.object && hit.index === hoveredObj.index && hit.instanceId === hoveredObj.instanceId)) {
|
|
718
717
|
const eventObject = hoveredObj.eventObject;
|
|
719
718
|
const instance = eventObject.__r3f;
|
|
720
719
|
const handlers = instance == null ? void 0 : instance.handlers;
|
|
@@ -723,7 +722,7 @@ function createEvents(store) {
|
|
|
723
722
|
if (instance != null && instance.eventCount) {
|
|
724
723
|
// Clear out intersects, they are outdated by now
|
|
725
724
|
const data = { ...hoveredObj,
|
|
726
|
-
intersections
|
|
725
|
+
intersections
|
|
727
726
|
};
|
|
728
727
|
handlers.onPointerOut == null ? void 0 : handlers.onPointerOut(data);
|
|
729
728
|
handlers.onPointerLeave == null ? void 0 : handlers.onPointerLeave(data);
|
|
@@ -926,7 +925,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
926
925
|
|
|
927
926
|
if (!added) (_parentInstance$__r3f = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f.objects.push(child);
|
|
928
927
|
if (!child.__r3f) prepare(child, {});
|
|
929
|
-
|
|
928
|
+
|
|
929
|
+
child.__r3f.parents.push(parentInstance);
|
|
930
|
+
|
|
930
931
|
updateInstance(child);
|
|
931
932
|
invalidateInstance(child);
|
|
932
933
|
}
|
|
@@ -938,9 +939,7 @@ function createRenderer(roots, getEventPriority) {
|
|
|
938
939
|
if (child) {
|
|
939
940
|
var _child$__r3f2, _parentInstance$__r3f2;
|
|
940
941
|
|
|
941
|
-
if ((_child$__r3f2 = child.__r3f) != null && _child$__r3f2.attach) {
|
|
942
|
-
attach(parentInstance, child, child.__r3f.attach);
|
|
943
|
-
} else if (child.isObject3D && parentInstance.isObject3D) {
|
|
942
|
+
if (!((_child$__r3f2 = child.__r3f) != null && _child$__r3f2.attach) && child.isObject3D && parentInstance.isObject3D) {
|
|
944
943
|
child.parent = parentInstance;
|
|
945
944
|
child.dispatchEvent({
|
|
946
945
|
type: 'added'
|
|
@@ -953,7 +952,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
953
952
|
|
|
954
953
|
if (!added) (_parentInstance$__r3f2 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f2.objects.push(child);
|
|
955
954
|
if (!child.__r3f) prepare(child, {});
|
|
956
|
-
|
|
955
|
+
|
|
956
|
+
child.__r3f.parents.push(parentInstance);
|
|
957
|
+
|
|
957
958
|
updateInstance(child);
|
|
958
959
|
invalidateInstance(child);
|
|
959
960
|
}
|
|
@@ -968,7 +969,7 @@ function createRenderer(roots, getEventPriority) {
|
|
|
968
969
|
var _parentInstance$__r3f3, _child$__r3f3, _child$__r3f5;
|
|
969
970
|
|
|
970
971
|
// Clear the parent reference
|
|
971
|
-
if (child.__r3f) child.__r3f.
|
|
972
|
+
if (child.__r3f) child.__r3f.parents = child.__r3f.parents.filter(parent => parent !== parentInstance); // Remove child from the parents objects
|
|
972
973
|
|
|
973
974
|
if ((_parentInstance$__r3f3 = parentInstance.__r3f) != null && _parentInstance$__r3f3.objects) parentInstance.__r3f.objects = parentInstance.__r3f.objects.filter(x => x !== child); // Remove attachment
|
|
974
975
|
|
|
@@ -1029,11 +1030,11 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1029
1030
|
}
|
|
1030
1031
|
|
|
1031
1032
|
function switchInstance(instance, type, newProps, fiber) {
|
|
1032
|
-
var _instance$__r3f,
|
|
1033
|
+
var _instance$__r3f, _newInstance$__r3f;
|
|
1033
1034
|
|
|
1034
|
-
const
|
|
1035
|
-
if (!
|
|
1036
|
-
const newInstance = createInstance(type, newProps,
|
|
1035
|
+
const parents = (_instance$__r3f = instance.__r3f) == null ? void 0 : _instance$__r3f.parents;
|
|
1036
|
+
if (!(parents != null && parents.length)) return;
|
|
1037
|
+
const newInstance = createInstance(type, newProps, instance.__r3f.root); // https://github.com/pmndrs/react-three-fiber/issues/1348
|
|
1037
1038
|
// When args change the instance has to be re-constructed, which then
|
|
1038
1039
|
// forces r3f to re-parent the children and non-scene objects
|
|
1039
1040
|
// This can not include primitives, which should not have declarative children
|
|
@@ -1046,8 +1047,12 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1046
1047
|
instance.__r3f.objects.forEach(child => appendChild(newInstance, child));
|
|
1047
1048
|
|
|
1048
1049
|
instance.__r3f.objects = [];
|
|
1049
|
-
|
|
1050
|
-
|
|
1050
|
+
|
|
1051
|
+
for (const parent of parents) {
|
|
1052
|
+
removeChild(parent, instance);
|
|
1053
|
+
appendChild(parent, newInstance);
|
|
1054
|
+
} // Re-bind event handlers
|
|
1055
|
+
|
|
1051
1056
|
|
|
1052
1057
|
if (newInstance.raycast && newInstance.__r3f.eventCount) {
|
|
1053
1058
|
const rootState = newInstance.__r3f.root.getState();
|
|
@@ -1057,7 +1062,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1057
1062
|
|
|
1058
1063
|
|
|
1059
1064
|
if ((_newInstance$__r3f = newInstance.__r3f) != null && _newInstance$__r3f.attach) {
|
|
1060
|
-
|
|
1065
|
+
for (const parent of parents) {
|
|
1066
|
+
attach(parent, newInstance, newInstance.__r3f.attach);
|
|
1067
|
+
}
|
|
1061
1068
|
} // This evil hack switches the react-internal fiber node
|
|
1062
1069
|
[fiber, fiber.alternate].forEach(fiber => {
|
|
1063
1070
|
if (fiber !== null) {
|
|
@@ -1093,9 +1100,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1093
1100
|
getChildHostContext: parentHostContext => parentHostContext,
|
|
1094
1101
|
|
|
1095
1102
|
finalizeInitialChildren(instance) {
|
|
1096
|
-
var _instance$
|
|
1103
|
+
var _instance$__r3f2;
|
|
1097
1104
|
|
|
1098
|
-
const localState = (_instance$
|
|
1105
|
+
const localState = (_instance$__r3f2 = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f2 : {}; // https://github.com/facebook/react/issues/20271
|
|
1099
1106
|
// Returning true will trigger commitMount
|
|
1100
1107
|
|
|
1101
1108
|
return !!localState.handlers || !!localState.attach;
|
|
@@ -1136,11 +1143,11 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1136
1143
|
},
|
|
1137
1144
|
|
|
1138
1145
|
commitMount(instance, type, props, int) {
|
|
1139
|
-
var _instance$
|
|
1146
|
+
var _instance$__r3f3;
|
|
1140
1147
|
|
|
1141
1148
|
// https://github.com/facebook/react/issues/20271
|
|
1142
1149
|
// This will make sure events are only added once to the central container
|
|
1143
|
-
const localState = (_instance$
|
|
1150
|
+
const localState = (_instance$__r3f3 = instance.__r3f) != null ? _instance$__r3f3 : {};
|
|
1144
1151
|
|
|
1145
1152
|
if (instance.raycast && localState.handlers && localState.eventCount) {
|
|
1146
1153
|
instance.__r3f.root.getState().internal.interaction.push(instance);
|
|
@@ -1148,7 +1155,9 @@ function createRenderer(roots, getEventPriority) {
|
|
|
1148
1155
|
|
|
1149
1156
|
|
|
1150
1157
|
if (localState.attach) {
|
|
1151
|
-
|
|
1158
|
+
for (const parent of localState.parents) {
|
|
1159
|
+
attach(parent, instance, localState.attach);
|
|
1160
|
+
}
|
|
1152
1161
|
}
|
|
1153
1162
|
},
|
|
1154
1163
|
|
|
@@ -1353,35 +1362,29 @@ const createStore = (invalidate, advance) => {
|
|
|
1353
1362
|
initialHits: [],
|
|
1354
1363
|
capturedMap: new Map(),
|
|
1355
1364
|
subscribe: (ref, priority, store) => {
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
store
|
|
1371
|
-
}].sort((a, b) => a.priority - b.priority)
|
|
1372
|
-
}
|
|
1373
|
-
}));
|
|
1365
|
+
const internal = get().internal; // If this subscription was given a priority, it takes rendering into its own hands
|
|
1366
|
+
// For that reason we switch off automatic rendering and increase the manual flag
|
|
1367
|
+
// As long as this flag is positive there can be no internal rendering at all
|
|
1368
|
+
// because there could be multiple render subscriptions
|
|
1369
|
+
|
|
1370
|
+
internal.priority = internal.priority + (priority > 0 ? 1 : 0);
|
|
1371
|
+
internal.subscribers.push({
|
|
1372
|
+
ref,
|
|
1373
|
+
priority,
|
|
1374
|
+
store
|
|
1375
|
+
}); // Register subscriber and sort layers from lowest to highest, meaning,
|
|
1376
|
+
// highest priority renders last (on top of the other frames)
|
|
1377
|
+
|
|
1378
|
+
internal.subscribers = internal.subscribers.sort((a, b) => a.priority - b.priority);
|
|
1374
1379
|
return () => {
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
}
|
|
1384
|
-
}));
|
|
1380
|
+
const internal = get().internal;
|
|
1381
|
+
|
|
1382
|
+
if (internal != null && internal.subscribers) {
|
|
1383
|
+
// Decrease manual flag if this subscription had a priority
|
|
1384
|
+
internal.priority = internal.priority - (priority > 0 ? 1 : 0); // Remove subscriber from list
|
|
1385
|
+
|
|
1386
|
+
internal.subscribers = internal.subscribers.filter(s => s.ref !== ref);
|
|
1387
|
+
}
|
|
1385
1388
|
};
|
|
1386
1389
|
}
|
|
1387
1390
|
}
|
|
@@ -2045,7 +2048,7 @@ function Portal({
|
|
|
2045
2048
|
reconciler.injectIntoDevTools({
|
|
2046
2049
|
bundleType: process.env.NODE_ENV === 'production' ? 0 : 1,
|
|
2047
2050
|
rendererPackageName: '@react-three/fiber',
|
|
2048
|
-
version:
|
|
2051
|
+
version: React__namespace.version
|
|
2049
2052
|
});
|
|
2050
2053
|
const act = React__namespace.unstable_act;
|
|
2051
2054
|
|
|
@@ -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-f796b922.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -83,7 +83,7 @@ function createPointerEvents(store) {
|
|
|
83
83
|
connected: target
|
|
84
84
|
}
|
|
85
85
|
}));
|
|
86
|
-
Object.entries((_events$handlers = events
|
|
86
|
+
Object.entries((_events$handlers = events.handlers) != null ? _events$handlers : []).forEach(([name, event]) => {
|
|
87
87
|
const [eventName, passive] = DOM_EVENTS[name];
|
|
88
88
|
target.addEventListener(eventName, event, {
|
|
89
89
|
passive
|
|
@@ -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-d2826534.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -83,7 +83,7 @@ function createPointerEvents(store) {
|
|
|
83
83
|
connected: target
|
|
84
84
|
}
|
|
85
85
|
}));
|
|
86
|
-
Object.entries((_events$handlers = events
|
|
86
|
+
Object.entries((_events$handlers = events.handlers) != null ? _events$handlers : []).forEach(([name, event]) => {
|
|
87
87
|
const [eventName, passive] = DOM_EVENTS[name];
|
|
88
88
|
target.addEventListener(eventName, event, {
|
|
89
89
|
passive
|
|
@@ -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-
|
|
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-
|
|
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-2de7e188.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-2de7e188.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';
|
|
@@ -56,7 +56,7 @@ function createPointerEvents(store) {
|
|
|
56
56
|
connected: target
|
|
57
57
|
}
|
|
58
58
|
}));
|
|
59
|
-
Object.entries((_events$handlers = events
|
|
59
|
+
Object.entries((_events$handlers = events.handlers) != null ? _events$handlers : []).forEach(([name, event]) => {
|
|
60
60
|
const [eventName, passive] = DOM_EVENTS[name];
|
|
61
61
|
target.addEventListener(eventName, event, {
|
|
62
62
|
passive
|
|
@@ -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-f796b922.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -95,7 +95,7 @@ function createTouchEvents(store) {
|
|
|
95
95
|
events
|
|
96
96
|
} = store.getState();
|
|
97
97
|
events.disconnect == null ? void 0 : events.disconnect();
|
|
98
|
-
const connected = new Pressability__default["default"](events
|
|
98
|
+
const connected = new Pressability__default["default"](events.handlers);
|
|
99
99
|
set(state => ({
|
|
100
100
|
events: { ...state.events,
|
|
101
101
|
connected
|
|
@@ -286,7 +286,9 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
286
286
|
width,
|
|
287
287
|
height
|
|
288
288
|
});
|
|
289
|
-
}, []);
|
|
289
|
+
}, []); // Called on context create or swap
|
|
290
|
+
// https://github.com/pmndrs/react-three-fiber/pull/2297
|
|
291
|
+
|
|
290
292
|
const onContextCreate = React__namespace.useCallback(context => {
|
|
291
293
|
const canvasShim = {
|
|
292
294
|
width: context.drawingBufferWidth,
|
|
@@ -297,11 +299,11 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
297
299
|
clientHeight: context.drawingBufferHeight,
|
|
298
300
|
getContext: () => context
|
|
299
301
|
};
|
|
302
|
+
root.current = index.createRoot(canvasShim);
|
|
300
303
|
setCanvas(canvasShim);
|
|
301
304
|
}, []);
|
|
302
305
|
|
|
303
|
-
if (width > 0 && height > 0
|
|
304
|
-
if (!root.current) root.current = index.createRoot(canvas);
|
|
306
|
+
if (root.current && width > 0 && height > 0) {
|
|
305
307
|
root.current.configure({
|
|
306
308
|
gl,
|
|
307
309
|
events,
|
|
@@ -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-d2826534.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -95,7 +95,7 @@ function createTouchEvents(store) {
|
|
|
95
95
|
events
|
|
96
96
|
} = store.getState();
|
|
97
97
|
events.disconnect == null ? void 0 : events.disconnect();
|
|
98
|
-
const connected = new Pressability__default["default"](events
|
|
98
|
+
const connected = new Pressability__default["default"](events.handlers);
|
|
99
99
|
set(state => ({
|
|
100
100
|
events: { ...state.events,
|
|
101
101
|
connected
|
|
@@ -286,7 +286,9 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
286
286
|
width,
|
|
287
287
|
height
|
|
288
288
|
});
|
|
289
|
-
}, []);
|
|
289
|
+
}, []); // Called on context create or swap
|
|
290
|
+
// https://github.com/pmndrs/react-three-fiber/pull/2297
|
|
291
|
+
|
|
290
292
|
const onContextCreate = React__namespace.useCallback(context => {
|
|
291
293
|
const canvasShim = {
|
|
292
294
|
width: context.drawingBufferWidth,
|
|
@@ -297,11 +299,11 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
297
299
|
clientHeight: context.drawingBufferHeight,
|
|
298
300
|
getContext: () => context
|
|
299
301
|
};
|
|
302
|
+
root.current = index.createRoot(canvasShim);
|
|
300
303
|
setCanvas(canvasShim);
|
|
301
304
|
}, []);
|
|
302
305
|
|
|
303
|
-
if (width > 0 && height > 0
|
|
304
|
-
if (!root.current) root.current = index.createRoot(canvas);
|
|
306
|
+
if (root.current && width > 0 && height > 0) {
|
|
305
307
|
root.current.configure({
|
|
306
308
|
gl,
|
|
307
309
|
events,
|
|
@@ -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, 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 '../../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-2de7e188.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 '../../dist/index-2de7e188.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';
|
|
@@ -68,7 +68,7 @@ function createTouchEvents(store) {
|
|
|
68
68
|
events
|
|
69
69
|
} = store.getState();
|
|
70
70
|
events.disconnect == null ? void 0 : events.disconnect();
|
|
71
|
-
const connected = new Pressability(events
|
|
71
|
+
const connected = new Pressability(events.handlers);
|
|
72
72
|
set(state => ({
|
|
73
73
|
events: { ...state.events,
|
|
74
74
|
connected
|
|
@@ -259,7 +259,9 @@ const Canvas = /*#__PURE__*/React.forwardRef(({
|
|
|
259
259
|
width,
|
|
260
260
|
height
|
|
261
261
|
});
|
|
262
|
-
}, []);
|
|
262
|
+
}, []); // Called on context create or swap
|
|
263
|
+
// https://github.com/pmndrs/react-three-fiber/pull/2297
|
|
264
|
+
|
|
263
265
|
const onContextCreate = React.useCallback(context => {
|
|
264
266
|
const canvasShim = {
|
|
265
267
|
width: context.drawingBufferWidth,
|
|
@@ -270,11 +272,11 @@ const Canvas = /*#__PURE__*/React.forwardRef(({
|
|
|
270
272
|
clientHeight: context.drawingBufferHeight,
|
|
271
273
|
getContext: () => context
|
|
272
274
|
};
|
|
275
|
+
root.current = createRoot(canvasShim);
|
|
273
276
|
setCanvas(canvasShim);
|
|
274
277
|
}, []);
|
|
275
278
|
|
|
276
|
-
if (width > 0 && height > 0
|
|
277
|
-
if (!root.current) root.current = createRoot(canvas);
|
|
279
|
+
if (root.current && width > 0 && height > 0) {
|
|
278
280
|
root.current.configure({
|
|
279
281
|
gl,
|
|
280
282
|
events,
|