react-three-game 0.0.63 → 0.0.64
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.
|
@@ -12,6 +12,7 @@ export interface PrefabEditorRef {
|
|
|
12
12
|
screenshot: () => void;
|
|
13
13
|
exportGLB: (options?: ExportGLBOptions) => Promise<ArrayBuffer | object | undefined>;
|
|
14
14
|
exportGLBData: () => Promise<ArrayBuffer | undefined>;
|
|
15
|
+
clearSelection: () => Promise<void>;
|
|
15
16
|
prefab: Prefab;
|
|
16
17
|
setPrefab: (prefab: Prefab) => void;
|
|
17
18
|
replacePrefab: (prefab: Prefab) => void;
|
|
@@ -162,8 +162,19 @@ const PrefabEditor = forwardRef(({ basePath, initialPrefab, physics = true, onPr
|
|
|
162
162
|
URL.revokeObjectURL(url);
|
|
163
163
|
});
|
|
164
164
|
};
|
|
165
|
+
const clearSelection = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
166
|
+
if (!selectedId)
|
|
167
|
+
return;
|
|
168
|
+
setSelectedId(null);
|
|
169
|
+
yield new Promise(resolve => {
|
|
170
|
+
requestAnimationFrame(() => {
|
|
171
|
+
requestAnimationFrame(() => resolve());
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
});
|
|
165
175
|
const handleExportGLB = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (options = {}) {
|
|
166
176
|
var _a;
|
|
177
|
+
yield clearSelection();
|
|
167
178
|
const sceneRoot = (_a = prefabRootRef.current) === null || _a === void 0 ? void 0 : _a.root;
|
|
168
179
|
if (!sceneRoot)
|
|
169
180
|
return;
|
|
@@ -171,6 +182,7 @@ const PrefabEditor = forwardRef(({ basePath, initialPrefab, physics = true, onPr
|
|
|
171
182
|
});
|
|
172
183
|
const handleExportGLBData = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
173
184
|
var _a;
|
|
185
|
+
yield clearSelection();
|
|
174
186
|
const sceneRoot = (_a = prefabRootRef.current) === null || _a === void 0 ? void 0 : _a.root;
|
|
175
187
|
if (!sceneRoot)
|
|
176
188
|
return;
|
|
@@ -220,6 +232,7 @@ const PrefabEditor = forwardRef(({ basePath, initialPrefab, physics = true, onPr
|
|
|
220
232
|
screenshot: handleScreenshot,
|
|
221
233
|
exportGLB: handleExportGLB,
|
|
222
234
|
exportGLBData: handleExportGLBData,
|
|
235
|
+
clearSelection,
|
|
223
236
|
prefab: loadedPrefab,
|
|
224
237
|
setPrefab: replacePrefab,
|
|
225
238
|
replacePrefab,
|