@shopware-ag/dive 1.6.5 → 1.7.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/README.md +6 -8
- package/build/dive.cjs +102 -0
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +30 -0
- package/build/dive.d.ts +30 -0
- package/build/dive.js +102 -0
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/__test__/DIVE.test.ts +5 -0
- package/src/dive.ts +5 -0
- package/src/info/Info.ts +114 -0
- package/src/info/__test__/Info.test.ts +267 -0
package/README.md
CHANGED
|
@@ -5,16 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
<p align="center">
|
|
7
7
|
<a href="#badge">
|
|
8
|
-
<img alt="dive:
|
|
8
|
+
<img alt="dive: npm" src="https://img.shields.io/npm/v/%40shopware-ag%2Fdive">
|
|
9
9
|
</a>
|
|
10
10
|
<a href="#badge">
|
|
11
|
-
<img alt="dive:
|
|
11
|
+
<img alt="dive: licenst" src="https://img.shields.io/npm/l/%40shopware-ag%2Fdive">
|
|
12
12
|
</a>
|
|
13
13
|
<a href="#badge">
|
|
14
|
-
<img alt="dive:
|
|
15
|
-
</a>
|
|
16
|
-
<a href="#badge">
|
|
17
|
-
<img alt="dive: downloads" src="https://img.shields.io/npm/types/%40shopware-ag%2Fdive">
|
|
14
|
+
<img alt="dive: types" src="https://img.shields.io/npm/types/%40shopware-ag%2Fdive">
|
|
18
15
|
</a>
|
|
19
16
|
</p>
|
|
20
17
|
|
|
@@ -169,14 +166,14 @@ com.PerformAction('SET_CAMERA_TRANSFORM', {
|
|
|
169
166
|
unsubscribe(); // <-- execute unsubscribe callback when done
|
|
170
167
|
```
|
|
171
168
|
|
|
172
|
-
|
|
169
|
+
# Actions (List)
|
|
170
|
+
In the following you find a list of all available actions to perform on DIVECommunication class via [`com.PerformAction()`](https://github.com/shopware/dive/blob/2e193c58843939ce07a1d35bfbd5b3c9d26eeeca/src/com/Communication.ts#L85).
|
|
173
171
|
|
|
174
172
|
| Action | Description
|
|
175
173
|
|:--------------------------------------------------------------------------------------| :---
|
|
176
174
|
| [GET_ALL_SCENE_DATA](./src/com/actions/scene/getallscenedata.ts) | Return all scene data that is currently set
|
|
177
175
|
| [GET_ALL_OBJECTS](./src/com/actions/object/getallobjects.ts) | Return a map of all objects
|
|
178
176
|
| [GET_OBJECTS](./src/com/actions/object/getobjects.ts) | Return an array of all objects with given ids
|
|
179
|
-
| [PLACE_ON_FLOOR](./src/com/actions/object/model/placeonfloor.ts) | Set a model onto to the floor
|
|
180
177
|
| [ADD_OBJECT](./src/com/actions/object/addobject.ts) | Add an object to the scene
|
|
181
178
|
| [UPDATE_OBJECT](./src/com/actions/object/updateobject.ts) | Update an existing object
|
|
182
179
|
| [DELETE_OBJECT](./src/com/actions/object/deleteobject.ts) | Delete an existing object
|
|
@@ -194,6 +191,7 @@ In the following you find a list of all available actions to perform on DIVEComm
|
|
|
194
191
|
| [ZOOM_CAMERA](./src/com/actions/camera/zoomcamera.ts) | Zoom in or out
|
|
195
192
|
| [SET_GIZMO_MODE](./src/com/actions/toolbox/select/setgizmomode.ts) | Set gizmo mode
|
|
196
193
|
| [SET_GIZMO_VISIBILITY](./src/com/actions/toolbox/select/setgizmovisibility.ts) | Set gizmo visibility
|
|
194
|
+
| [USE_TOOL](./src/com/actions/toolbox/usetool.ts) | Use a specific tool
|
|
197
195
|
| [MODEL_LOADED](./src/com/actions/object/model/modelloaded.ts) | Is performed when a model file is completely loaded
|
|
198
196
|
| [UPDATE_SCENE](./src/com/actions/scene/updatescene.ts) | Update scene data
|
|
199
197
|
| [GENERATE_MEDIA](./src/com/actions/media/generatemedia.ts) | Generate a screenshot with the specified parameters
|
package/build/dive.cjs
CHANGED
|
@@ -1961,6 +1961,105 @@ var DIVEMath = {
|
|
|
1961
1961
|
|
|
1962
1962
|
// src/dive.ts
|
|
1963
1963
|
var import_MathUtils2 = require("three/src/math/MathUtils");
|
|
1964
|
+
|
|
1965
|
+
// src/info/Info.ts
|
|
1966
|
+
var DIVEInfo = class {
|
|
1967
|
+
/**
|
|
1968
|
+
*
|
|
1969
|
+
* @returns The system the user is using. Possible values are "Android", "iOS", "Windows", "MacOS", "Linux" or "Unknown".
|
|
1970
|
+
*/
|
|
1971
|
+
static GetSystem() {
|
|
1972
|
+
const platform = navigator.platform;
|
|
1973
|
+
if (/Android/.test(navigator.userAgent)) {
|
|
1974
|
+
return "Android";
|
|
1975
|
+
} else if (/iPhone|iPad|iPod/.test(navigator.userAgent)) {
|
|
1976
|
+
return "iOS";
|
|
1977
|
+
} else if (platform.startsWith("Win")) {
|
|
1978
|
+
return "Windows";
|
|
1979
|
+
} else if (platform.startsWith("Mac")) {
|
|
1980
|
+
return "MacOS";
|
|
1981
|
+
} else if (platform.startsWith("Linux")) {
|
|
1982
|
+
return "Linux";
|
|
1983
|
+
} else {
|
|
1984
|
+
return "Unknown";
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
/**
|
|
1988
|
+
* @returns A promise that resolves to a boolean indicating whether the user's device supports WebXR.
|
|
1989
|
+
*/
|
|
1990
|
+
static GetSupportsWebXR() {
|
|
1991
|
+
return __async(this, null, function* () {
|
|
1992
|
+
if (this._supportsWebXR !== null) {
|
|
1993
|
+
return this._supportsWebXR;
|
|
1994
|
+
}
|
|
1995
|
+
if (!navigator.xr) {
|
|
1996
|
+
this._supportsWebXR = false;
|
|
1997
|
+
return this._supportsWebXR;
|
|
1998
|
+
}
|
|
1999
|
+
try {
|
|
2000
|
+
const supported = yield navigator.xr.isSessionSupported("immersive-ar");
|
|
2001
|
+
this._supportsWebXR = supported;
|
|
2002
|
+
} catch (error) {
|
|
2003
|
+
this._supportsWebXR = false;
|
|
2004
|
+
}
|
|
2005
|
+
return this._supportsWebXR;
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
/**
|
|
2009
|
+
* @returns A boolean indicating whether the user's device supports AR Quick Look.
|
|
2010
|
+
*/
|
|
2011
|
+
static GetSupportsARQuickLook() {
|
|
2012
|
+
const a = document.createElement("a");
|
|
2013
|
+
if (a.relList.supports("ar")) {
|
|
2014
|
+
return true;
|
|
2015
|
+
}
|
|
2016
|
+
const userAgent = navigator.userAgent;
|
|
2017
|
+
const isIOS = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream;
|
|
2018
|
+
if (!isIOS) {
|
|
2019
|
+
return false;
|
|
2020
|
+
}
|
|
2021
|
+
const match = userAgent.match(/OS (\d+)_/);
|
|
2022
|
+
if (!match || match.length < 2) {
|
|
2023
|
+
return false;
|
|
2024
|
+
}
|
|
2025
|
+
const iOSVersion = parseInt(match[1], 10);
|
|
2026
|
+
const minQuickLookVersion = 12;
|
|
2027
|
+
if (iOSVersion < minQuickLookVersion) {
|
|
2028
|
+
return false;
|
|
2029
|
+
}
|
|
2030
|
+
const isSupportedBrowser = /^((?!chrome|android).)*safari|CriOS|FxiOS/i.test(userAgent);
|
|
2031
|
+
if (isSupportedBrowser) {
|
|
2032
|
+
return true;
|
|
2033
|
+
}
|
|
2034
|
+
return false;
|
|
2035
|
+
}
|
|
2036
|
+
/**
|
|
2037
|
+
* @returns A boolean indicating whether the user's device is a mobile device.
|
|
2038
|
+
*/
|
|
2039
|
+
static get isMobile() {
|
|
2040
|
+
return this.GetSystem() === "Android" || this.GetSystem() === "iOS";
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* @returns A boolean indicating whether the user's device is a desktop device.
|
|
2044
|
+
*/
|
|
2045
|
+
static get isDesktop() {
|
|
2046
|
+
return !this.isMobile;
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* @returns A promise that resolves to a boolean indicating whether the user's device is capable of AR.
|
|
2050
|
+
*/
|
|
2051
|
+
static GetIsARCapable() {
|
|
2052
|
+
return __async(this, null, function* () {
|
|
2053
|
+
if (this.GetSupportsARQuickLook()) {
|
|
2054
|
+
return true;
|
|
2055
|
+
}
|
|
2056
|
+
return yield this.GetSupportsWebXR();
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
2059
|
+
};
|
|
2060
|
+
DIVEInfo._supportsWebXR = null;
|
|
2061
|
+
|
|
2062
|
+
// src/dive.ts
|
|
1964
2063
|
var DIVEDefaultSettings = {
|
|
1965
2064
|
autoResize: true,
|
|
1966
2065
|
displayAxes: false,
|
|
@@ -2024,6 +2123,9 @@ var DIVE = class _DIVE {
|
|
|
2024
2123
|
get Canvas() {
|
|
2025
2124
|
return this.renderer.domElement;
|
|
2026
2125
|
}
|
|
2126
|
+
get Info() {
|
|
2127
|
+
return DIVEInfo;
|
|
2128
|
+
}
|
|
2027
2129
|
// setters
|
|
2028
2130
|
set Settings(settings) {
|
|
2029
2131
|
var _a;
|