@react-three/fiber 8.17.9 → 8.17.10
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
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { EventHandlers } from './core/events';
|
|
3
3
|
import { AttachType } from './core/renderer';
|
|
4
|
-
export declare type Properties<T> =
|
|
5
|
-
[K in keyof T
|
|
6
|
-
}
|
|
4
|
+
export declare type Properties<T> = {
|
|
5
|
+
[K in keyof T as T[K] extends (...args: Array<any>) => any ? never : K]: T[K];
|
|
6
|
+
};
|
|
7
7
|
export declare type NonFunctionKeys<T> = {
|
|
8
8
|
[K in keyof T]-?: T[K] extends Function ? never : K;
|
|
9
9
|
}[keyof T];
|
|
@@ -135,24 +135,39 @@ function useMeasure({
|
|
|
135
135
|
state.current.resizeObserver = null;
|
|
136
136
|
}
|
|
137
137
|
if (state.current.orientationHandler) {
|
|
138
|
-
|
|
138
|
+
if ('orientation' in screen && 'removeEventListener' in screen.orientation) {
|
|
139
|
+
screen.orientation.removeEventListener('change', state.current.orientationHandler);
|
|
140
|
+
} else if ('onorientationchange' in window) {
|
|
141
|
+
window.removeEventListener('orientationchange', state.current.orientationHandler);
|
|
142
|
+
}
|
|
139
143
|
}
|
|
140
144
|
}
|
|
141
145
|
|
|
142
146
|
// add scroll-listeners / observers
|
|
143
147
|
function addListeners() {
|
|
148
|
+
var _state$current$resize;
|
|
144
149
|
if (!state.current.element) return;
|
|
145
|
-
state.current.resizeObserver = new ResizeObserver(
|
|
146
|
-
state.current.resizeObserver.observe(state.current.element);
|
|
150
|
+
state.current.resizeObserver = new ResizeObserver(resizeChange);
|
|
151
|
+
(_state$current$resize = state.current.resizeObserver) == null ? void 0 : _state$current$resize.observe(state.current.element);
|
|
147
152
|
if (scroll && state.current.scrollContainers) {
|
|
148
153
|
state.current.scrollContainers.forEach(scrollContainer => scrollContainer.addEventListener('scroll', scrollChange, {
|
|
149
154
|
capture: true,
|
|
150
155
|
passive: true
|
|
151
156
|
}));
|
|
152
157
|
}
|
|
158
|
+
|
|
159
|
+
// Handle orientation changes
|
|
153
160
|
state.current.orientationHandler = () => {
|
|
154
161
|
scrollChange();
|
|
155
162
|
};
|
|
163
|
+
|
|
164
|
+
// Use screen.orientation if available
|
|
165
|
+
if ('orientation' in screen && 'addEventListener' in screen.orientation) {
|
|
166
|
+
screen.orientation.addEventListener('change', state.current.orientationHandler);
|
|
167
|
+
} else if ('onorientationchange' in window) {
|
|
168
|
+
// Fallback to orientationchange event
|
|
169
|
+
window.addEventListener('orientationchange', state.current.orientationHandler);
|
|
170
|
+
}
|
|
156
171
|
}
|
|
157
172
|
|
|
158
173
|
// the ref we expose to the user
|
|
@@ -135,24 +135,39 @@ function useMeasure({
|
|
|
135
135
|
state.current.resizeObserver = null;
|
|
136
136
|
}
|
|
137
137
|
if (state.current.orientationHandler) {
|
|
138
|
-
|
|
138
|
+
if ('orientation' in screen && 'removeEventListener' in screen.orientation) {
|
|
139
|
+
screen.orientation.removeEventListener('change', state.current.orientationHandler);
|
|
140
|
+
} else if ('onorientationchange' in window) {
|
|
141
|
+
window.removeEventListener('orientationchange', state.current.orientationHandler);
|
|
142
|
+
}
|
|
139
143
|
}
|
|
140
144
|
}
|
|
141
145
|
|
|
142
146
|
// add scroll-listeners / observers
|
|
143
147
|
function addListeners() {
|
|
148
|
+
var _state$current$resize;
|
|
144
149
|
if (!state.current.element) return;
|
|
145
|
-
state.current.resizeObserver = new ResizeObserver(
|
|
146
|
-
state.current.resizeObserver.observe(state.current.element);
|
|
150
|
+
state.current.resizeObserver = new ResizeObserver(resizeChange);
|
|
151
|
+
(_state$current$resize = state.current.resizeObserver) == null ? void 0 : _state$current$resize.observe(state.current.element);
|
|
147
152
|
if (scroll && state.current.scrollContainers) {
|
|
148
153
|
state.current.scrollContainers.forEach(scrollContainer => scrollContainer.addEventListener('scroll', scrollChange, {
|
|
149
154
|
capture: true,
|
|
150
155
|
passive: true
|
|
151
156
|
}));
|
|
152
157
|
}
|
|
158
|
+
|
|
159
|
+
// Handle orientation changes
|
|
153
160
|
state.current.orientationHandler = () => {
|
|
154
161
|
scrollChange();
|
|
155
162
|
};
|
|
163
|
+
|
|
164
|
+
// Use screen.orientation if available
|
|
165
|
+
if ('orientation' in screen && 'addEventListener' in screen.orientation) {
|
|
166
|
+
screen.orientation.addEventListener('change', state.current.orientationHandler);
|
|
167
|
+
} else if ('onorientationchange' in window) {
|
|
168
|
+
// Fallback to orientationchange event
|
|
169
|
+
window.addEventListener('orientationchange', state.current.orientationHandler);
|
|
170
|
+
}
|
|
156
171
|
}
|
|
157
172
|
|
|
158
173
|
// the ref we expose to the user
|
|
@@ -109,24 +109,39 @@ function useMeasure({
|
|
|
109
109
|
state.current.resizeObserver = null;
|
|
110
110
|
}
|
|
111
111
|
if (state.current.orientationHandler) {
|
|
112
|
-
|
|
112
|
+
if ('orientation' in screen && 'removeEventListener' in screen.orientation) {
|
|
113
|
+
screen.orientation.removeEventListener('change', state.current.orientationHandler);
|
|
114
|
+
} else if ('onorientationchange' in window) {
|
|
115
|
+
window.removeEventListener('orientationchange', state.current.orientationHandler);
|
|
116
|
+
}
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
// add scroll-listeners / observers
|
|
117
121
|
function addListeners() {
|
|
122
|
+
var _state$current$resize;
|
|
118
123
|
if (!state.current.element) return;
|
|
119
|
-
state.current.resizeObserver = new ResizeObserver(
|
|
120
|
-
state.current.resizeObserver.observe(state.current.element);
|
|
124
|
+
state.current.resizeObserver = new ResizeObserver(resizeChange);
|
|
125
|
+
(_state$current$resize = state.current.resizeObserver) == null ? void 0 : _state$current$resize.observe(state.current.element);
|
|
121
126
|
if (scroll && state.current.scrollContainers) {
|
|
122
127
|
state.current.scrollContainers.forEach(scrollContainer => scrollContainer.addEventListener('scroll', scrollChange, {
|
|
123
128
|
capture: true,
|
|
124
129
|
passive: true
|
|
125
130
|
}));
|
|
126
131
|
}
|
|
132
|
+
|
|
133
|
+
// Handle orientation changes
|
|
127
134
|
state.current.orientationHandler = () => {
|
|
128
135
|
scrollChange();
|
|
129
136
|
};
|
|
137
|
+
|
|
138
|
+
// Use screen.orientation if available
|
|
139
|
+
if ('orientation' in screen && 'addEventListener' in screen.orientation) {
|
|
140
|
+
screen.orientation.addEventListener('change', state.current.orientationHandler);
|
|
141
|
+
} else if ('onorientationchange' in window) {
|
|
142
|
+
// Fallback to orientationchange event
|
|
143
|
+
window.addEventListener('orientationchange', state.current.orientationHandler);
|
|
144
|
+
}
|
|
130
145
|
}
|
|
131
146
|
|
|
132
147
|
// the ref we expose to the user
|