@webspatial/core-sdk 1.1.0 → 1.2.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.
- package/CHANGELOG.md +10 -0
- package/dist/iife/index.d.ts +29 -32
- package/dist/iife/index.global.js +3 -3
- package/dist/iife/index.global.js.map +1 -1
- package/dist/index.d.ts +29 -32
- package/dist/index.js +146 -69
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/JSBCommand.ts +1 -1
- package/src/SpatialScene.ts +2 -2
- package/src/SpatialSession.ts +7 -4
- package/src/SpatializedElement.ts +13 -53
- package/src/SpatializedStatic3DElement.ts +1 -1
- package/src/WebMsgCommand.ts +8 -3
- package/src/coverage-boost.test.ts +1060 -0
- package/src/jsbcommand.coverage.test.ts +542 -0
- package/src/platform-adapter/index.ts +31 -3
- package/src/platform-adapter/vision-os/VisionOSPlatform.ts +0 -1
- package/src/platform-adapter/xr/XRPlatform.ts +133 -0
- package/src/reality/component/index.ts +1 -1
- package/src/reality/entity/SpatialEntity.ts +2 -14
- package/src/reality/entity/index.ts +1 -1
- package/src/reality/geometry/SpatialBoxGeometry.ts +4 -1
- package/src/reality/geometry/index.ts +1 -1
- package/src/reality/material/index.ts +1 -1
- package/src/reality/resource/index.ts +1 -1
- package/src/scene-polyfill.ts +0 -4
- package/src/types/internal.ts +5 -5
- package/src/types/types.ts +23 -17
package/dist/index.d.ts
CHANGED
|
@@ -55,10 +55,8 @@ declare enum SpatialWebMsgType {
|
|
|
55
55
|
spatialdragstart = "spatialdragstart",
|
|
56
56
|
spatialdrag = "spatialdrag",
|
|
57
57
|
spatialdragend = "spatialdragend",
|
|
58
|
-
spatialrotatestart = "spatialrotatestart",
|
|
59
58
|
spatialrotate = "spatialrotate",
|
|
60
59
|
spatialrotateend = "spatialrotateend",
|
|
61
|
-
spatialmagnifystart = "spatialmagnifystart",
|
|
62
60
|
spatialmagnify = "spatialmagnify",
|
|
63
61
|
spatialmagnifyend = "spatialmagnifyend",
|
|
64
62
|
objectdestroy = "objectdestroy"
|
|
@@ -89,13 +87,17 @@ interface SpatialTapMsg {
|
|
|
89
87
|
type: SpatialWebMsgType.spatialtap;
|
|
90
88
|
detail: SpatialTapEventDetail;
|
|
91
89
|
}
|
|
90
|
+
interface SpatialDragStartMsg {
|
|
91
|
+
type: SpatialWebMsgType.spatialdragstart;
|
|
92
|
+
detail: SpatialDragStartEventDetail;
|
|
93
|
+
}
|
|
92
94
|
interface SpatialDragMsg {
|
|
93
95
|
type: SpatialWebMsgType.spatialdrag;
|
|
94
96
|
detail: SpatialDragEventDetail;
|
|
95
97
|
}
|
|
96
98
|
interface SpatialDragEndMsg {
|
|
97
99
|
type: SpatialWebMsgType.spatialdragend;
|
|
98
|
-
detail:
|
|
100
|
+
detail: SpatialDragEndEventDetail;
|
|
99
101
|
}
|
|
100
102
|
interface SpatialRotateMsg {
|
|
101
103
|
type: SpatialWebMsgType.spatialrotate;
|
|
@@ -167,26 +169,19 @@ declare abstract class SpatializedElement extends SpatialObject {
|
|
|
167
169
|
* Handles various spatial events like transforms, gestures, and interactions.
|
|
168
170
|
* @param data The event data received from the WebSpatial system
|
|
169
171
|
*/
|
|
170
|
-
protected onReceiveEvent(data: CubeInfoMsg | TransformMsg | SpatialTapMsg | SpatialDragMsg | SpatialDragEndMsg | SpatialRotateMsg | SpatialRotateEndMsg | ObjectDestroyMsg): void;
|
|
172
|
+
protected onReceiveEvent(data: CubeInfoMsg | TransformMsg | SpatialTapMsg | SpatialDragStartMsg | SpatialDragMsg | SpatialDragEndMsg | SpatialRotateMsg | SpatialRotateEndMsg | ObjectDestroyMsg): void;
|
|
171
173
|
private _onSpatialTap?;
|
|
172
174
|
set onSpatialTap(value: (event: SpatialTapEvent) => void | undefined);
|
|
173
|
-
private _isDragging;
|
|
174
175
|
private _onSpatialDragStart?;
|
|
175
|
-
set onSpatialDragStart(value: (event:
|
|
176
|
+
set onSpatialDragStart(value: (event: SpatialDragStartEvent) => void | undefined);
|
|
176
177
|
private _onSpatialDrag?;
|
|
177
178
|
set onSpatialDrag(value: (event: SpatialDragEvent) => void | undefined);
|
|
178
179
|
private _onSpatialDragEnd?;
|
|
179
180
|
set onSpatialDragEnd(value: ((event: SpatialDragEndEvent) => void) | undefined);
|
|
180
|
-
private _isRotating;
|
|
181
|
-
private _onSpatialRotateStart?;
|
|
182
|
-
set onSpatialRotateStart(value: ((event: SpatialRotateEvent) => void) | undefined);
|
|
183
181
|
private _onSpatialRotate?;
|
|
184
182
|
set onSpatialRotate(value: ((event: SpatialRotateEvent) => void) | undefined);
|
|
185
183
|
private _onSpatialRotateEnd?;
|
|
186
184
|
set onSpatialRotateEnd(value: ((event: SpatialRotateEndEvent) => void) | undefined);
|
|
187
|
-
private _isMagnify;
|
|
188
|
-
private _onSpatialMagnifyStart?;
|
|
189
|
-
set onSpatialMagnifyStart(value: ((event: SpatialMagnifyEvent) => void) | undefined);
|
|
190
185
|
private _onSpatialMagnify?;
|
|
191
186
|
set onSpatialMagnify(value: ((event: SpatialMagnifyEvent) => void) | undefined);
|
|
192
187
|
private _onSpatialMagnifyEnd?;
|
|
@@ -211,6 +206,12 @@ interface Vec3 {
|
|
|
211
206
|
z: number;
|
|
212
207
|
}
|
|
213
208
|
type Point3D = Vec3;
|
|
209
|
+
interface Quaternion {
|
|
210
|
+
x: number;
|
|
211
|
+
y: number;
|
|
212
|
+
z: number;
|
|
213
|
+
w: number;
|
|
214
|
+
}
|
|
214
215
|
/**
|
|
215
216
|
* Material type for SpatialDiv or HTML document.
|
|
216
217
|
*
|
|
@@ -259,10 +260,8 @@ interface SpatializedElementProperties {
|
|
|
259
260
|
enableDragStartGesture: boolean;
|
|
260
261
|
enableDragGesture: boolean;
|
|
261
262
|
enableDragEndGesture: boolean;
|
|
262
|
-
enableRotateStartGesture: boolean;
|
|
263
263
|
enableRotateGesture: boolean;
|
|
264
264
|
enableRotateEndGesture: boolean;
|
|
265
|
-
enableMagnifyStartGesture: boolean;
|
|
266
265
|
enableMagnifyGesture: boolean;
|
|
267
266
|
enableMagnifyEndGesture: boolean;
|
|
268
267
|
}
|
|
@@ -405,33 +404,31 @@ interface SpatialTapEventDetail {
|
|
|
405
404
|
location3D: Point3D;
|
|
406
405
|
}
|
|
407
406
|
type SpatialTapEvent = CustomEvent<SpatialTapEventDetail>;
|
|
408
|
-
interface
|
|
409
|
-
location3D: Point3D;
|
|
407
|
+
interface SpatialDragStartEventDetail {
|
|
410
408
|
startLocation3D: Point3D;
|
|
409
|
+
}
|
|
410
|
+
interface SpatialDragEventDetail {
|
|
411
411
|
translation3D: Vec3;
|
|
412
|
-
predictedEndTranslation3D: Vec3;
|
|
413
|
-
predictedEndLocation3D: Point3D;
|
|
414
|
-
velocity: Size;
|
|
415
412
|
}
|
|
413
|
+
interface SpatialDragEndEventDetail {
|
|
414
|
+
}
|
|
415
|
+
type SpatialDragStartEvent = CustomEvent<SpatialDragStartEventDetail>;
|
|
416
416
|
type SpatialDragEvent = CustomEvent<SpatialDragEventDetail>;
|
|
417
|
-
type SpatialDragEndEvent =
|
|
417
|
+
type SpatialDragEndEvent = CustomEvent<SpatialDragEndEventDetail>;
|
|
418
418
|
interface SpatialRotateEventDetail {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
startAnchor3D: Vec3;
|
|
423
|
-
startLocation3D: Point3D;
|
|
419
|
+
quaternion: Quaternion;
|
|
420
|
+
}
|
|
421
|
+
interface SpatialRotateEndEventDetail {
|
|
424
422
|
}
|
|
425
423
|
type SpatialRotateEvent = CustomEvent<SpatialRotateEventDetail>;
|
|
426
|
-
type SpatialRotateEndEvent =
|
|
424
|
+
type SpatialRotateEndEvent = CustomEvent<SpatialRotateEndEventDetail>;
|
|
427
425
|
interface SpatialMagnifyEventDetail {
|
|
428
426
|
magnification: number;
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
startLocation3D: Point3D;
|
|
427
|
+
}
|
|
428
|
+
interface SpatialMagnifyEndEventDetail {
|
|
432
429
|
}
|
|
433
430
|
type SpatialMagnifyEvent = CustomEvent<SpatialMagnifyEventDetail>;
|
|
434
|
-
type SpatialMagnifyEndEvent =
|
|
431
|
+
type SpatialMagnifyEndEvent = CustomEvent<SpatialMagnifyEndEventDetail>;
|
|
435
432
|
type SpatialEntityOrReality = SpatialEntity | SpatializedDynamic3DElement;
|
|
436
433
|
|
|
437
434
|
declare class SpatialComponent extends SpatialObject {
|
|
@@ -670,7 +667,7 @@ declare class SpatializedStatic3DElement extends SpatializedElement {
|
|
|
670
667
|
* @param callback Function to call when the model fails to load
|
|
671
668
|
*/
|
|
672
669
|
set onLoadFailureCallback(callback: undefined | (() => void));
|
|
673
|
-
updateModelTransform(transform:
|
|
670
|
+
updateModelTransform(transform: DOMMatrixReadOnly): void;
|
|
674
671
|
}
|
|
675
672
|
|
|
676
673
|
/**
|
|
@@ -859,4 +856,4 @@ declare global {
|
|
|
859
856
|
|
|
860
857
|
declare const isSSREnv: () => boolean;
|
|
861
858
|
|
|
862
|
-
export { type BackgroundMaterialType, type BaseplateVisibilityType, BaseplateVisibilityValues, type CornerRadius, CubeInfo$1 as CubeInfo, type ModelAssetOptions, ModelComponent, type ModelComponentOptions, type Point3D, type Size, type Size3D, Spatial, SpatialBoxGeometry, type SpatialBoxGeometryOptions, SpatialComponent, SpatialConeGeometry, type SpatialConeGeometryOptions, SpatialCylinderGeometry, type SpatialCylinderGeometryOptions, type SpatialDragEndEvent, type SpatialDragEvent, type SpatialDragEventDetail, SpatialEntity, type SpatialEntityEventType, type SpatialEntityOrReality, type SpatialEntityProperties, type SpatialEntityUserData, SpatialGeometry, type SpatialGeometryOptions, type SpatialGeometryType, type SpatialMagnifyEndEvent, type SpatialMagnifyEvent, type SpatialMagnifyEventDetail, SpatialMaterial, type SpatialMaterialType, SpatialModelAsset, type SpatialModelDragEvent, SpatialModelEntity, type SpatialModelEntityCreationOptions, SpatialObject, SpatialPlaneGeometry, type SpatialPlaneGeometryOptions, type SpatialRotateEndEvent, type SpatialRotateEvent, type SpatialRotateEventDetail, SpatialScene, type SpatialSceneCreationOptions$1 as SpatialSceneCreationOptions, type SpatialSceneProperties, SpatialSceneState$1 as SpatialSceneState, type SpatialSceneType$1 as SpatialSceneType, SpatialSceneValues, SpatialSession, SpatialSphereGeometry, type SpatialSphereGeometryOptions, type SpatialTapEvent, type SpatialTapEventDetail, SpatialUnlitMaterial, type SpatialUnlitMaterialOptions, Spatialized2DElement, type Spatialized2DElementProperties, SpatializedDynamic3DElement, SpatializedElement, type SpatializedElementProperties, SpatializedElementType, SpatializedStatic3DElement, type SpatializedStatic3DElementProperties, type Vec3, type WorldAlignmentType, WorldAlignmentValues, type WorldScalingType, WorldScalingValues, isSSREnv, isValidBaseplateVisibilityType, isValidSceneUnit, isValidSpatialSceneType, isValidWorldAlignmentType, isValidWorldScalingType };
|
|
859
|
+
export { type BackgroundMaterialType, type BaseplateVisibilityType, BaseplateVisibilityValues, type CornerRadius, CubeInfo$1 as CubeInfo, type ModelAssetOptions, ModelComponent, type ModelComponentOptions, type Point3D, type Quaternion, type Size, type Size3D, Spatial, SpatialBoxGeometry, type SpatialBoxGeometryOptions, SpatialComponent, SpatialConeGeometry, type SpatialConeGeometryOptions, SpatialCylinderGeometry, type SpatialCylinderGeometryOptions, type SpatialDragEndEvent, type SpatialDragEndEventDetail, type SpatialDragEvent, type SpatialDragEventDetail, type SpatialDragStartEvent, type SpatialDragStartEventDetail, SpatialEntity, type SpatialEntityEventType, type SpatialEntityOrReality, type SpatialEntityProperties, type SpatialEntityUserData, SpatialGeometry, type SpatialGeometryOptions, type SpatialGeometryType, type SpatialMagnifyEndEvent, type SpatialMagnifyEndEventDetail, type SpatialMagnifyEvent, type SpatialMagnifyEventDetail, SpatialMaterial, type SpatialMaterialType, SpatialModelAsset, type SpatialModelDragEvent, SpatialModelEntity, type SpatialModelEntityCreationOptions, SpatialObject, SpatialPlaneGeometry, type SpatialPlaneGeometryOptions, type SpatialRotateEndEvent, type SpatialRotateEndEventDetail, type SpatialRotateEvent, type SpatialRotateEventDetail, SpatialScene, type SpatialSceneCreationOptions$1 as SpatialSceneCreationOptions, type SpatialSceneProperties, SpatialSceneState$1 as SpatialSceneState, type SpatialSceneType$1 as SpatialSceneType, SpatialSceneValues, SpatialSession, SpatialSphereGeometry, type SpatialSphereGeometryOptions, type SpatialTapEvent, type SpatialTapEventDetail, SpatialUnlitMaterial, type SpatialUnlitMaterialOptions, Spatialized2DElement, type Spatialized2DElementProperties, SpatializedDynamic3DElement, SpatializedElement, type SpatializedElementProperties, SpatializedElementType, SpatializedStatic3DElement, type SpatializedStatic3DElementProperties, type Vec3, type WorldAlignmentType, WorldAlignmentValues, type WorldScalingType, WorldScalingValues, isSSREnv, isValidBaseplateVisibilityType, isValidSceneUnit, isValidSpatialSceneType, isValidWorldAlignmentType, isValidWorldScalingType };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
(function(){
|
|
3
3
|
if(typeof window === 'undefined') return;
|
|
4
4
|
if(!window.__webspatialsdk__) window.__webspatialsdk__ = {}
|
|
5
|
-
window.__webspatialsdk__['core-sdk-version'] = "1.
|
|
5
|
+
window.__webspatialsdk__['core-sdk-version'] = "1.2.0"
|
|
6
6
|
})()
|
|
7
7
|
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
@@ -115,16 +115,119 @@ var init_SpatialWebEvent = __esm({
|
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
|
|
118
|
+
// src/platform-adapter/xr/XRPlatform.ts
|
|
119
|
+
var XRPlatform_exports = {};
|
|
120
|
+
__export(XRPlatform_exports, {
|
|
121
|
+
XRPlatform: () => XRPlatform
|
|
122
|
+
});
|
|
123
|
+
function nextRequestId() {
|
|
124
|
+
requestId = (requestId + 1) % MAX_ID;
|
|
125
|
+
return `rId_${requestId}`;
|
|
126
|
+
}
|
|
127
|
+
var requestId, MAX_ID, XRPlatform;
|
|
128
|
+
var init_XRPlatform = __esm({
|
|
129
|
+
"src/platform-adapter/xr/XRPlatform.ts"() {
|
|
130
|
+
"use strict";
|
|
131
|
+
init_CommandResultUtils();
|
|
132
|
+
init_SpatialWebEvent();
|
|
133
|
+
requestId = 0;
|
|
134
|
+
MAX_ID = 1e5;
|
|
135
|
+
XRPlatform = class {
|
|
136
|
+
async callJSB(cmd, msg) {
|
|
137
|
+
return new Promise((resolve, reject) => {
|
|
138
|
+
try {
|
|
139
|
+
const rId = nextRequestId();
|
|
140
|
+
SpatialWebEvent.addEventReceiver(rId, (result) => {
|
|
141
|
+
SpatialWebEvent.removeEventReceiver(rId);
|
|
142
|
+
if (result.success) {
|
|
143
|
+
resolve(CommandResultSuccess(result.data));
|
|
144
|
+
} else {
|
|
145
|
+
const { code, message } = result.data;
|
|
146
|
+
resolve(CommandResultFailure(code, message));
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
const ans = window.webspatialBridge.postMessage(rId, cmd, msg);
|
|
150
|
+
if (ans !== "") {
|
|
151
|
+
SpatialWebEvent.removeEventReceiver(rId);
|
|
152
|
+
const result = JSON.parse(ans);
|
|
153
|
+
if (result.success) {
|
|
154
|
+
resolve(CommandResultSuccess(result.data));
|
|
155
|
+
} else {
|
|
156
|
+
const { code, message } = result.data;
|
|
157
|
+
resolve(CommandResultFailure(code, message));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} catch (error) {
|
|
161
|
+
console.error(`XRPlatform cmd: ${cmd}, msg: ${msg} error: ${error}`);
|
|
162
|
+
const { code, message } = error;
|
|
163
|
+
resolve(CommandResultFailure(code, message));
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
async callWebSpatialProtocol(command, query, target, features) {
|
|
168
|
+
return new Promise((resolve, reject) => {
|
|
169
|
+
const createdId = nextRequestId();
|
|
170
|
+
try {
|
|
171
|
+
let windowProxy = null;
|
|
172
|
+
SpatialWebEvent.addEventReceiver(
|
|
173
|
+
createdId,
|
|
174
|
+
(result) => {
|
|
175
|
+
console.log("createdId", createdId, result.spatialId);
|
|
176
|
+
resolve(
|
|
177
|
+
CommandResultSuccess({
|
|
178
|
+
windowProxy,
|
|
179
|
+
id: result.spatialId
|
|
180
|
+
})
|
|
181
|
+
);
|
|
182
|
+
SpatialWebEvent.removeEventReceiver(createdId);
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
windowProxy = this.openWindow(
|
|
186
|
+
command,
|
|
187
|
+
query,
|
|
188
|
+
target,
|
|
189
|
+
features
|
|
190
|
+
).windowProxy;
|
|
191
|
+
windowProxy?.open(`about:blank?rid=${createdId}`, "_self");
|
|
192
|
+
} catch (error) {
|
|
193
|
+
console.error(`open window error: ${error}`);
|
|
194
|
+
const { code, message } = error;
|
|
195
|
+
SpatialWebEvent.removeEventReceiver(createdId);
|
|
196
|
+
resolve(CommandResultFailure(code, message));
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
callWebSpatialProtocolSync(command, query, target, features) {
|
|
201
|
+
const { spatialId: id = "", windowProxy } = this.openWindow(
|
|
202
|
+
command,
|
|
203
|
+
query,
|
|
204
|
+
target,
|
|
205
|
+
features
|
|
206
|
+
);
|
|
207
|
+
return CommandResultSuccess({ windowProxy, id });
|
|
208
|
+
}
|
|
209
|
+
openWindow(command, query, target, features) {
|
|
210
|
+
const windowProxy = window.open(
|
|
211
|
+
`webspatial://${command}?${query || ""}`,
|
|
212
|
+
target,
|
|
213
|
+
features
|
|
214
|
+
);
|
|
215
|
+
return { spatialId: "", windowProxy };
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
|
|
118
221
|
// src/platform-adapter/android/AndroidPlatform.ts
|
|
119
222
|
var AndroidPlatform_exports = {};
|
|
120
223
|
__export(AndroidPlatform_exports, {
|
|
121
224
|
AndroidPlatform: () => AndroidPlatform
|
|
122
225
|
});
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
return `rId_${
|
|
226
|
+
function nextRequestId2() {
|
|
227
|
+
requestId2 = (requestId2 + 1) % MAX_ID2;
|
|
228
|
+
return `rId_${requestId2}`;
|
|
126
229
|
}
|
|
127
|
-
var creatingElementCount,
|
|
230
|
+
var creatingElementCount, requestId2, MAX_ID2, AndroidPlatform;
|
|
128
231
|
var init_AndroidPlatform = __esm({
|
|
129
232
|
"src/platform-adapter/android/AndroidPlatform.ts"() {
|
|
130
233
|
"use strict";
|
|
@@ -132,13 +235,13 @@ var init_AndroidPlatform = __esm({
|
|
|
132
235
|
init_JSBCommand();
|
|
133
236
|
init_SpatialWebEvent();
|
|
134
237
|
creatingElementCount = 0;
|
|
135
|
-
|
|
136
|
-
|
|
238
|
+
requestId2 = 0;
|
|
239
|
+
MAX_ID2 = 1e5;
|
|
137
240
|
AndroidPlatform = class {
|
|
138
241
|
async callJSB(cmd, msg) {
|
|
139
242
|
return new Promise((resolve, reject) => {
|
|
140
243
|
try {
|
|
141
|
-
const rId =
|
|
244
|
+
const rId = nextRequestId2();
|
|
142
245
|
SpatialWebEvent.addEventReceiver(rId, (result) => {
|
|
143
246
|
SpatialWebEvent.removeEventReceiver(rId);
|
|
144
247
|
if (result.success) {
|
|
@@ -270,11 +373,38 @@ var init_VisionOSPlatform = __esm({
|
|
|
270
373
|
});
|
|
271
374
|
|
|
272
375
|
// src/platform-adapter/index.ts
|
|
376
|
+
function getWebSpatialVersion(ua) {
|
|
377
|
+
const match = ua.match(/WebSpatial\/(\d+)\.(\d+)\.(\d+)/);
|
|
378
|
+
if (!match) {
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
return [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
382
|
+
}
|
|
383
|
+
function isVersionGreater(a, b) {
|
|
384
|
+
if (!a) {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
for (let index = 0; index < 3; index += 1) {
|
|
388
|
+
const diff = a[index] - b[index];
|
|
389
|
+
if (diff > 0) {
|
|
390
|
+
return true;
|
|
391
|
+
}
|
|
392
|
+
if (diff < 0) {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
273
398
|
function createPlatform() {
|
|
274
399
|
if (isSSREnv()) {
|
|
275
400
|
return new SSRPlatform();
|
|
276
401
|
}
|
|
277
|
-
|
|
402
|
+
const userAgent = window.navigator.userAgent;
|
|
403
|
+
const webSpatialVersion = getWebSpatialVersion(userAgent);
|
|
404
|
+
if (userAgent.includes("PicoWebApp") && isVersionGreater(webSpatialVersion, [0, 0, 1])) {
|
|
405
|
+
const XRPlatform2 = (init_XRPlatform(), __toCommonJS(XRPlatform_exports)).XRPlatform;
|
|
406
|
+
return new XRPlatform2();
|
|
407
|
+
} else if (userAgent.includes("Android") || userAgent.includes("Linux")) {
|
|
278
408
|
const AndroidPlatform2 = (init_AndroidPlatform(), __toCommonJS(AndroidPlatform_exports)).AndroidPlatform;
|
|
279
409
|
return new AndroidPlatform2();
|
|
280
410
|
} else {
|
|
@@ -1027,9 +1157,6 @@ var SceneManager = class _SceneManager {
|
|
|
1027
1157
|
const cfg = target ? this.getConfig(target) : void 0;
|
|
1028
1158
|
const cmd = new createSpatialSceneCommand(url, cfg, target, features);
|
|
1029
1159
|
const result = cmd.executeSync();
|
|
1030
|
-
if (typeof target === "string" && this.configMap[target]) {
|
|
1031
|
-
delete this.configMap[target];
|
|
1032
|
-
}
|
|
1033
1160
|
const id = result.data?.id;
|
|
1034
1161
|
if (id) {
|
|
1035
1162
|
let focusCmd = new FocusScene(id);
|
|
@@ -1353,64 +1480,43 @@ var SpatializedElement = class extends SpatialObject {
|
|
|
1353
1480
|
data.detail
|
|
1354
1481
|
);
|
|
1355
1482
|
this._onSpatialTap?.(event);
|
|
1483
|
+
} else if (type === "spatialdragstart" /* spatialdragstart */) {
|
|
1484
|
+
const dragStartEvent = createSpatialEvent(
|
|
1485
|
+
"spatialdragstart" /* spatialdragstart */,
|
|
1486
|
+
data.detail
|
|
1487
|
+
);
|
|
1488
|
+
this._onSpatialDragStart?.(dragStartEvent);
|
|
1356
1489
|
} else if (type === "spatialdrag" /* spatialdrag */) {
|
|
1357
|
-
if (!this._isDragging) {
|
|
1358
|
-
const dragStartEvent = createSpatialEvent(
|
|
1359
|
-
"spatialdragstart" /* spatialdragstart */,
|
|
1360
|
-
data.detail
|
|
1361
|
-
);
|
|
1362
|
-
this._onSpatialDragStart?.(dragStartEvent);
|
|
1363
|
-
}
|
|
1364
|
-
this._isDragging = true;
|
|
1365
1490
|
const event = createSpatialEvent(
|
|
1366
1491
|
"spatialdrag" /* spatialdrag */,
|
|
1367
1492
|
data.detail
|
|
1368
1493
|
);
|
|
1369
1494
|
this._onSpatialDrag?.(event);
|
|
1370
1495
|
} else if (type === "spatialdragend" /* spatialdragend */) {
|
|
1371
|
-
this._isDragging = false;
|
|
1372
1496
|
const event = createSpatialEvent(
|
|
1373
1497
|
"spatialdragend" /* spatialdragend */,
|
|
1374
1498
|
data.detail
|
|
1375
1499
|
);
|
|
1376
1500
|
this._onSpatialDragEnd?.(event);
|
|
1377
1501
|
} else if (type === "spatialrotate" /* spatialrotate */) {
|
|
1378
|
-
if (!this._isRotating) {
|
|
1379
|
-
const rotationStartEvent = createSpatialEvent(
|
|
1380
|
-
"spatialrotatestart" /* spatialrotatestart */,
|
|
1381
|
-
data.detail
|
|
1382
|
-
);
|
|
1383
|
-
this._onSpatialRotateStart?.(rotationStartEvent);
|
|
1384
|
-
}
|
|
1385
|
-
this._isRotating = true;
|
|
1386
1502
|
const event = createSpatialEvent(
|
|
1387
1503
|
"spatialrotate" /* spatialrotate */,
|
|
1388
1504
|
data.detail
|
|
1389
1505
|
);
|
|
1390
1506
|
this._onSpatialRotate?.(event);
|
|
1391
1507
|
} else if (type === "spatialrotateend" /* spatialrotateend */) {
|
|
1392
|
-
this._isRotating = false;
|
|
1393
1508
|
const event = createSpatialEvent(
|
|
1394
1509
|
"spatialrotateend" /* spatialrotateend */,
|
|
1395
1510
|
data.detail
|
|
1396
1511
|
);
|
|
1397
1512
|
this._onSpatialRotateEnd?.(event);
|
|
1398
1513
|
} else if (type === "spatialmagnify" /* spatialmagnify */) {
|
|
1399
|
-
if (!this._isMagnify) {
|
|
1400
|
-
const magnifyStartEvent = createSpatialEvent(
|
|
1401
|
-
"spatialmagnifystart" /* spatialmagnifystart */,
|
|
1402
|
-
data.detail
|
|
1403
|
-
);
|
|
1404
|
-
this._onSpatialMagnifyStart?.(magnifyStartEvent);
|
|
1405
|
-
}
|
|
1406
|
-
this._isMagnify = true;
|
|
1407
1514
|
const event = createSpatialEvent(
|
|
1408
1515
|
"spatialmagnify" /* spatialmagnify */,
|
|
1409
1516
|
data.detail
|
|
1410
1517
|
);
|
|
1411
1518
|
this._onSpatialMagnify?.(event);
|
|
1412
1519
|
} else if (type === "spatialmagnifyend" /* spatialmagnifyend */) {
|
|
1413
|
-
this._isMagnify = false;
|
|
1414
1520
|
const event = createSpatialEvent(
|
|
1415
1521
|
"spatialmagnifyend" /* spatialmagnifyend */,
|
|
1416
1522
|
data.detail
|
|
@@ -1425,7 +1531,6 @@ var SpatializedElement = class extends SpatialObject {
|
|
|
1425
1531
|
enableTapGesture: value !== void 0
|
|
1426
1532
|
});
|
|
1427
1533
|
}
|
|
1428
|
-
_isDragging = false;
|
|
1429
1534
|
_onSpatialDragStart;
|
|
1430
1535
|
set onSpatialDragStart(value) {
|
|
1431
1536
|
this._onSpatialDragStart = value;
|
|
@@ -1447,14 +1552,6 @@ var SpatializedElement = class extends SpatialObject {
|
|
|
1447
1552
|
enableDragEndGesture: value !== void 0
|
|
1448
1553
|
});
|
|
1449
1554
|
}
|
|
1450
|
-
_isRotating = false;
|
|
1451
|
-
_onSpatialRotateStart;
|
|
1452
|
-
set onSpatialRotateStart(value) {
|
|
1453
|
-
this._onSpatialRotateStart = value;
|
|
1454
|
-
this.updateProperties({
|
|
1455
|
-
enableRotateStartGesture: this._onSpatialRotateStart !== void 0
|
|
1456
|
-
});
|
|
1457
|
-
}
|
|
1458
1555
|
_onSpatialRotate;
|
|
1459
1556
|
set onSpatialRotate(value) {
|
|
1460
1557
|
this._onSpatialRotate = value;
|
|
@@ -1469,14 +1566,6 @@ var SpatializedElement = class extends SpatialObject {
|
|
|
1469
1566
|
enableRotateEndGesture: value !== void 0
|
|
1470
1567
|
});
|
|
1471
1568
|
}
|
|
1472
|
-
_isMagnify = false;
|
|
1473
|
-
_onSpatialMagnifyStart;
|
|
1474
|
-
set onSpatialMagnifyStart(value) {
|
|
1475
|
-
this._onSpatialMagnifyStart = value;
|
|
1476
|
-
this.updateProperties({
|
|
1477
|
-
enableMagnifyStartGesture: value !== void 0
|
|
1478
|
-
});
|
|
1479
|
-
}
|
|
1480
1569
|
_onSpatialMagnify;
|
|
1481
1570
|
set onSpatialMagnify(value) {
|
|
1482
1571
|
this._onSpatialMagnify = value;
|
|
@@ -1787,12 +1876,6 @@ var SpatialEntity = class _SpatialEntity extends SpatialObject {
|
|
|
1787
1876
|
data.detail
|
|
1788
1877
|
);
|
|
1789
1878
|
this.dispatchEvent(evt);
|
|
1790
|
-
} else if (type === "spatialrotatestart" /* spatialrotatestart */) {
|
|
1791
|
-
const evt = createSpatialEvent(
|
|
1792
|
-
"spatialrotatestart" /* spatialrotatestart */,
|
|
1793
|
-
data.detail
|
|
1794
|
-
);
|
|
1795
|
-
this.dispatchEvent(evt);
|
|
1796
1879
|
} else if (type === "spatialrotate" /* spatialrotate */) {
|
|
1797
1880
|
const evt = createSpatialEvent(
|
|
1798
1881
|
"spatialrotate" /* spatialrotate */,
|
|
@@ -1805,12 +1888,6 @@ var SpatialEntity = class _SpatialEntity extends SpatialObject {
|
|
|
1805
1888
|
data.detail
|
|
1806
1889
|
);
|
|
1807
1890
|
this.dispatchEvent(evt);
|
|
1808
|
-
} else if (type === "spatialmagnifystart" /* spatialmagnifystart */) {
|
|
1809
|
-
const evt = createSpatialEvent(
|
|
1810
|
-
"spatialmagnifystart" /* spatialmagnifystart */,
|
|
1811
|
-
data.detail
|
|
1812
|
-
);
|
|
1813
|
-
this.dispatchEvent(evt);
|
|
1814
1891
|
} else if (type === "spatialmagnify" /* spatialmagnify */) {
|
|
1815
1892
|
const evt = createSpatialEvent(
|
|
1816
1893
|
"spatialmagnify" /* spatialmagnify */,
|
|
@@ -2235,7 +2312,7 @@ var Spatial = class {
|
|
|
2235
2312
|
* @returns Client SDK version string in format "x.x.x"
|
|
2236
2313
|
*/
|
|
2237
2314
|
getClientVersion() {
|
|
2238
|
-
return "1.
|
|
2315
|
+
return "1.2.0";
|
|
2239
2316
|
}
|
|
2240
2317
|
};
|
|
2241
2318
|
|