@shapediver/viewer.shared.services 2.12.7 → 3.0.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/dist/converter/Converter.d.ts +5 -2
- package/dist/converter/Converter.d.ts.map +1 -1
- package/dist/converter/Converter.js +11 -10
- package/dist/converter/Converter.js.map +1 -1
- package/dist/dom-event-engine/DomEventEngine.d.ts +21 -31
- package/dist/dom-event-engine/DomEventEngine.d.ts.map +1 -1
- package/dist/dom-event-engine/DomEventEngine.js +101 -180
- package/dist/dom-event-engine/DomEventEngine.js.map +1 -1
- package/dist/dom-event-engine/IDomEventListener.d.ts +6 -10
- package/dist/dom-event-engine/IDomEventListener.d.ts.map +1 -1
- package/dist/event-engine/EventTypes.d.ts +199 -2
- package/dist/event-engine/EventTypes.d.ts.map +1 -1
- package/dist/event-engine/EventTypes.js +201 -10
- package/dist/event-engine/EventTypes.js.map +1 -1
- package/dist/http-client/HttpClient.d.ts +1 -1
- package/dist/http-client/HttpClient.d.ts.map +1 -1
- package/dist/http-client/HttpClient.js +7 -4
- package/dist/http-client/HttpClient.js.map +1 -1
- package/dist/index.d.ts +25 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -46
- package/dist/index.js.map +1 -1
- package/dist/logger/ErrorTypeGuards.d.ts +3 -1
- package/dist/logger/ErrorTypeGuards.d.ts.map +1 -1
- package/dist/logger/ErrorTypeGuards.js +8 -1
- package/dist/logger/ErrorTypeGuards.js.map +1 -1
- package/dist/logger/ShapeDiverError.d.ts +1 -0
- package/dist/logger/ShapeDiverError.d.ts.map +1 -1
- package/dist/logger/ShapeDiverError.js +1 -0
- package/dist/logger/ShapeDiverError.js.map +1 -1
- package/dist/logger/ShapeDiverViewerErrors.d.ts +4 -0
- package/dist/logger/ShapeDiverViewerErrors.d.ts.map +1 -1
- package/dist/logger/ShapeDiverViewerErrors.js +8 -1
- package/dist/logger/ShapeDiverViewerErrors.js.map +1 -1
- package/dist/settings-engine/SettingsEngine.d.ts +36 -16
- package/dist/settings-engine/SettingsEngine.d.ts.map +1 -1
- package/dist/settings-engine/SettingsEngine.js +45 -38
- package/dist/settings-engine/SettingsEngine.js.map +1 -1
- package/dist/state-engine/ISessionGlobalAccessObjectDefinition.d.ts +20 -0
- package/dist/state-engine/ISessionGlobalAccessObjectDefinition.d.ts.map +1 -0
- package/dist/state-engine/ISessionGlobalAccessObjectDefinition.js +3 -0
- package/dist/state-engine/ISessionGlobalAccessObjectDefinition.js.map +1 -0
- package/dist/state-engine/IViewportGlobalAccessObjectDefinition.d.ts +32 -0
- package/dist/state-engine/IViewportGlobalAccessObjectDefinition.d.ts.map +1 -0
- package/dist/state-engine/IViewportGlobalAccessObjectDefinition.js +3 -0
- package/dist/state-engine/IViewportGlobalAccessObjectDefinition.js.map +1 -0
- package/dist/state-engine/StateEngine.d.ts +7 -18
- package/dist/state-engine/StateEngine.d.ts.map +1 -1
- package/dist/state-engine/StateEngine.js +9 -9
- package/dist/state-engine/StateEngine.js.map +1 -1
- package/dist/system-info/SystemInfo.js +1 -1
- package/dist/system-info/SystemInfo.js.map +1 -1
- package/dist/utilities/base64.d.ts +3 -0
- package/dist/utilities/base64.d.ts.map +1 -0
- package/dist/utilities/base64.js +22 -0
- package/dist/utilities/base64.js.map +1 -0
- package/package.json +4 -4
- package/src/converter/Converter.ts +18 -17
- package/src/dom-event-engine/DomEventEngine.ts +118 -198
- package/src/dom-event-engine/IDomEventListener.ts +10 -10
- package/src/event-engine/EventTypes.ts +231 -41
- package/src/http-client/HttpClient.ts +7 -4
- package/src/index.ts +99 -43
- package/src/logger/ErrorTypeGuards.ts +8 -1
- package/src/logger/ShapeDiverError.ts +1 -0
- package/src/logger/ShapeDiverViewerErrors.ts +8 -0
- package/src/settings-engine/SettingsEngine.ts +101 -80
- package/src/state-engine/ISessionGlobalAccessObjectDefinition.ts +25 -0
- package/src/state-engine/IViewportGlobalAccessObjectDefinition.ts +29 -0
- package/src/state-engine/StateEngine.ts +16 -48
- package/src/system-info/SystemInfo.ts +1 -1
- package/src/utilities/base64.ts +15 -0
|
@@ -1,29 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
convert,
|
|
3
|
+
Defaults,
|
|
4
|
+
ISettings,
|
|
5
|
+
latestVersion,
|
|
6
|
+
previousVersion,
|
|
7
|
+
validate
|
|
8
|
+
} from '@shapediver/viewer.settings';
|
|
5
9
|
import { ShapeDiverViewerSettingsError } from '../logger/ShapeDiverViewerErrors';
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type
|
|
10
|
-
type
|
|
11
|
-
type
|
|
12
|
-
type
|
|
13
|
-
type
|
|
14
|
-
type
|
|
11
|
+
// #region Type aliases (8)
|
|
12
|
+
|
|
13
|
+
type IARSettings = ISettings['ar'];
|
|
14
|
+
type ICameraSettings = ISettings['camera'];
|
|
15
|
+
type IEnvironmentGeometrySettings = ISettings['environmentGeometry'];
|
|
16
|
+
type IEnvironmentSettings = ISettings['environment'];
|
|
17
|
+
type IGeneralSettings = ISettings['general'];
|
|
18
|
+
type ILightSettings = ISettings['light'];
|
|
19
|
+
type IRenderingSettings = ISettings['rendering'];
|
|
20
|
+
type ISessionSettings = ISettings['session'];
|
|
21
|
+
|
|
22
|
+
// #endregion Type aliases (8)
|
|
23
|
+
|
|
24
|
+
// #region Classes (1)
|
|
15
25
|
|
|
16
26
|
export class SettingsEngine {
|
|
17
|
-
// #region Properties (
|
|
27
|
+
// #region Properties (4)
|
|
18
28
|
|
|
19
|
-
private
|
|
20
|
-
private
|
|
21
|
-
private readonly _settings: ISettings = Defaults();
|
|
22
|
-
private _settingsJson: any;
|
|
29
|
+
private _settings: ISettings = Defaults();
|
|
30
|
+
private _settingsJson: unknown;
|
|
23
31
|
|
|
24
|
-
// #endregion Properties (
|
|
32
|
+
// #endregion Properties (4)
|
|
25
33
|
|
|
26
|
-
// #region Public
|
|
34
|
+
// #region Public Getters And Setters (11)
|
|
27
35
|
|
|
28
36
|
public get ar(): IARSettings {
|
|
29
37
|
return this._settings.ar;
|
|
@@ -64,98 +72,111 @@ export class SettingsEngine {
|
|
|
64
72
|
public get settings(): ISettings {
|
|
65
73
|
return this._settings;
|
|
66
74
|
}
|
|
67
|
-
|
|
68
|
-
public get settingsJson():
|
|
75
|
+
|
|
76
|
+
public get settingsJson(): unknown {
|
|
69
77
|
return this._settingsJson;
|
|
70
78
|
}
|
|
71
79
|
|
|
72
|
-
// #endregion Public
|
|
73
|
-
|
|
74
|
-
// #region Public Methods (
|
|
75
|
-
|
|
76
|
-
public flatten() {
|
|
77
|
-
const flattenObject = (ob: any) => {
|
|
78
|
-
const toReturn: { [key: string]: any } = {};
|
|
79
|
-
for (let i in ob) {
|
|
80
|
-
if (!ob.hasOwnProperty(i)) continue;
|
|
81
|
-
if ((typeof ob[i]) == 'object') {
|
|
82
|
-
const flatObject = flattenObject(ob[i]);
|
|
83
|
-
for (var x in flatObject) {
|
|
84
|
-
if (!flatObject.hasOwnProperty(x)) continue;
|
|
85
|
-
toReturn[i + '.' + x] = flatObject[x];
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
toReturn[i] = ob[i];
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return toReturn;
|
|
92
|
-
};
|
|
93
|
-
return flattenObject(this.settings);
|
|
94
|
-
}
|
|
80
|
+
// #endregion Public Getters And Setters (11)
|
|
81
|
+
|
|
82
|
+
// #region Public Methods (2)
|
|
95
83
|
|
|
96
|
-
public loadSettings(json:
|
|
84
|
+
public loadSettings(json: unknown) {
|
|
97
85
|
this._settingsJson = json;
|
|
98
86
|
if (JSON.stringify(json) !== JSON.stringify({})) {
|
|
87
|
+
for (let i = 0; i < previousVersion.length; i++) {
|
|
88
|
+
const v = previousVersion[i];
|
|
99
89
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
try {
|
|
105
|
-
validate(json, v as versions);
|
|
106
|
-
(<any>this._settings) = convert(json, latestVersion);
|
|
90
|
+
try {
|
|
91
|
+
validate(json, v);
|
|
92
|
+
this._settings = convert(json, latestVersion) as ISettings;
|
|
107
93
|
this.cleanSettings(this._settings);
|
|
108
94
|
return;
|
|
109
|
-
} catch (e) {
|
|
95
|
+
} catch (e) {
|
|
96
|
+
// it's ok, we just try the next version
|
|
97
|
+
// only the latest version is expected to be valid
|
|
98
|
+
}
|
|
110
99
|
}
|
|
111
100
|
|
|
112
|
-
try {
|
|
113
|
-
validate(json, latestVersion);
|
|
114
|
-
|
|
101
|
+
try {
|
|
102
|
+
validate(json, latestVersion);
|
|
103
|
+
this._settings = convert(json, latestVersion) as ISettings;
|
|
115
104
|
this.cleanSettings(this._settings);
|
|
116
105
|
return;
|
|
117
106
|
} catch (e) {
|
|
118
107
|
throw new ShapeDiverViewerSettingsError('SettingsEngine.loadSettings: Settings could not be validated. ' + (<Error>e).message, <Error>e);
|
|
119
108
|
}
|
|
120
109
|
} else {
|
|
121
|
-
|
|
110
|
+
this._settings = Defaults();
|
|
122
111
|
return;
|
|
123
112
|
}
|
|
124
113
|
}
|
|
125
114
|
|
|
126
115
|
public reset() {
|
|
127
|
-
|
|
116
|
+
this._settings = Defaults();
|
|
128
117
|
}
|
|
129
118
|
|
|
130
|
-
// #endregion Public Methods (
|
|
119
|
+
// #endregion Public Methods (2)
|
|
131
120
|
|
|
132
121
|
// #region Private Methods (1)
|
|
133
122
|
|
|
134
123
|
private cleanSettings(json: ISettings) {
|
|
135
|
-
for(
|
|
124
|
+
for (const c in json.camera.cameras) {
|
|
136
125
|
const camera = json.camera.cameras[c];
|
|
137
|
-
if(camera.type === 'perspective') {
|
|
138
|
-
const restrictions =
|
|
139
|
-
if(restrictions.position.cube.min.x === null) restrictions.position.cube.min.x = -Infinity;
|
|
140
|
-
if(restrictions.position.cube.min.y === null) restrictions.position.cube.min.y = -Infinity;
|
|
141
|
-
if(restrictions.position.cube.min.z === null) restrictions.position.cube.min.z = -Infinity;
|
|
142
|
-
if(restrictions.position.cube.max.x === null) restrictions.position.cube.max.x = Infinity;
|
|
143
|
-
if(restrictions.position.cube.max.y === null) restrictions.position.cube.max.y = Infinity;
|
|
144
|
-
if(restrictions.position.cube.max.z === null) restrictions.position.cube.max.z = Infinity;
|
|
145
|
-
if(restrictions.position.sphere.radius === null) restrictions.position.sphere.radius = Infinity;
|
|
146
|
-
if(restrictions.target.cube.min.x === null) restrictions.target.cube.min.x = -Infinity;
|
|
147
|
-
if(restrictions.target.cube.min.y === null) restrictions.target.cube.min.y = -Infinity;
|
|
148
|
-
if(restrictions.target.cube.min.z === null) restrictions.target.cube.min.z = -Infinity;
|
|
149
|
-
if(restrictions.target.cube.max.x === null) restrictions.target.cube.max.x = Infinity;
|
|
150
|
-
if(restrictions.target.cube.max.y === null) restrictions.target.cube.max.y = Infinity;
|
|
151
|
-
if(restrictions.target.cube.max.z === null) restrictions.target.cube.max.z = Infinity;
|
|
152
|
-
if(restrictions.target.sphere.radius === null) restrictions.target.sphere.radius = Infinity;
|
|
153
|
-
if(restrictions.rotation.minAzimuthAngle === null) restrictions.rotation.minAzimuthAngle = -Infinity;
|
|
154
|
-
if(restrictions.rotation.maxAzimuthAngle === null) restrictions.rotation.maxAzimuthAngle = Infinity;
|
|
155
|
-
if(restrictions.zoom.maxDistance === null) restrictions.zoom.maxDistance = Infinity;
|
|
126
|
+
if (camera.type === 'perspective') {
|
|
127
|
+
const restrictions = camera.controls.restrictions;
|
|
128
|
+
if (restrictions.position.cube.min.x === null) restrictions.position.cube.min.x = -Infinity;
|
|
129
|
+
if (restrictions.position.cube.min.y === null) restrictions.position.cube.min.y = -Infinity;
|
|
130
|
+
if (restrictions.position.cube.min.z === null) restrictions.position.cube.min.z = -Infinity;
|
|
131
|
+
if (restrictions.position.cube.max.x === null) restrictions.position.cube.max.x = Infinity;
|
|
132
|
+
if (restrictions.position.cube.max.y === null) restrictions.position.cube.max.y = Infinity;
|
|
133
|
+
if (restrictions.position.cube.max.z === null) restrictions.position.cube.max.z = Infinity;
|
|
134
|
+
if (restrictions.position.sphere.radius === null) restrictions.position.sphere.radius = Infinity;
|
|
135
|
+
if (restrictions.target.cube.min.x === null) restrictions.target.cube.min.x = -Infinity;
|
|
136
|
+
if (restrictions.target.cube.min.y === null) restrictions.target.cube.min.y = -Infinity;
|
|
137
|
+
if (restrictions.target.cube.min.z === null) restrictions.target.cube.min.z = -Infinity;
|
|
138
|
+
if (restrictions.target.cube.max.x === null) restrictions.target.cube.max.x = Infinity;
|
|
139
|
+
if (restrictions.target.cube.max.y === null) restrictions.target.cube.max.y = Infinity;
|
|
140
|
+
if (restrictions.target.cube.max.z === null) restrictions.target.cube.max.z = Infinity;
|
|
141
|
+
if (restrictions.target.sphere.radius === null) restrictions.target.sphere.radius = Infinity;
|
|
142
|
+
if (restrictions.rotation.minAzimuthAngle === null) restrictions.rotation.minAzimuthAngle = -Infinity;
|
|
143
|
+
if (restrictions.rotation.maxAzimuthAngle === null) restrictions.rotation.maxAzimuthAngle = Infinity;
|
|
144
|
+
if (restrictions.zoom.maxDistance === null) restrictions.zoom.maxDistance = Infinity;
|
|
156
145
|
}
|
|
157
146
|
}
|
|
158
147
|
}
|
|
159
148
|
|
|
160
149
|
// #endregion Private Methods (1)
|
|
161
|
-
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// #endregion Classes (1)
|
|
153
|
+
|
|
154
|
+
// #region Enums (1)
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Session settings to be used by a viewport.
|
|
158
|
+
*
|
|
159
|
+
* The {@link https://help.shapediver.com/doc/Geometry-Backend.1863942173.html|ShapeDiver Geometry Backend}
|
|
160
|
+
* allows to persist settings of the viewer, individually for each model that it hosts. Persisting the settings
|
|
161
|
+
* of the viewer requires permissions which are typically only granted to the owner of the model. Editing
|
|
162
|
+
* of the settings typically happens on the model edit page of the ShapeDiver Platform.
|
|
163
|
+
*
|
|
164
|
+
* Whenever an instance of the viewer creates a session with a model, the settings are made available to the viewer.
|
|
165
|
+
* It is possible to use multiple sessions with different models from a single instance of the viewer.
|
|
166
|
+
* Therefore the viewer offers a choice on which settings to use.
|
|
167
|
+
*/
|
|
168
|
+
export enum SESSION_SETTINGS_MODE {
|
|
169
|
+
/** No settings of a session will be used for the viewport. */
|
|
170
|
+
NONE = 'none',
|
|
171
|
+
/**
|
|
172
|
+
* The settings of the very first session created will be used for the viewport.
|
|
173
|
+
*/
|
|
174
|
+
FIRST = 'first',
|
|
175
|
+
/**
|
|
176
|
+
* Use this mode in case you want to assign a specific session identifier
|
|
177
|
+
* to the viewport, whose settings will be used.
|
|
178
|
+
*/
|
|
179
|
+
MANUAL = 'manual',
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// #endregion Enums (1)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SettingsEngine } from '../settings-engine/SettingsEngine';
|
|
2
|
+
import { ShapeDiverRequestGltfUploadQueryConversion, ShapeDiverResponseDto } from '@shapediver/sdk.geometry-api-sdk-v2';
|
|
3
|
+
import { StatePromise } from './StatePromise';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Interface for the global access definition of a session.
|
|
7
|
+
* This interface is used to define the properties and methods that are available via the state engine for a session.
|
|
8
|
+
* This means that they can be called without having a direct reference to the session engine.
|
|
9
|
+
*/
|
|
10
|
+
export interface ISessionGlobalAccessObjectDefinition {
|
|
11
|
+
// #region Properties (9)
|
|
12
|
+
|
|
13
|
+
readonly canUploadGLTF: boolean,
|
|
14
|
+
readonly id: string,
|
|
15
|
+
readonly initialOutputsLoaded: StatePromise<boolean>,
|
|
16
|
+
readonly initialized: StatePromise<boolean>,
|
|
17
|
+
readonly modelViewUrl: string,
|
|
18
|
+
readonly settingsEngine: SettingsEngine,
|
|
19
|
+
readonly settingsRegistered: StatePromise<boolean>,
|
|
20
|
+
|
|
21
|
+
isFirstSession: boolean,
|
|
22
|
+
uploadGLTF: (gltf: Blob, name: ShapeDiverRequestGltfUploadQueryConversion | undefined) => Promise<ShapeDiverResponseDto>,
|
|
23
|
+
|
|
24
|
+
// #endregion Properties (9)
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SESSION_SETTINGS_MODE, SettingsEngine } from '../settings-engine/SettingsEngine';
|
|
2
|
+
import { StatePromise } from './StatePromise';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interface for the global access definition of a viewport.
|
|
6
|
+
* This interface is used to define the properties and methods that are available via the state engine for a viewport.
|
|
7
|
+
* This means that they can be called without having a direct reference to the viewport engine.
|
|
8
|
+
*/
|
|
9
|
+
export interface IViewportGlobalAccessObjectDefinition {
|
|
10
|
+
// #region Properties (14)
|
|
11
|
+
|
|
12
|
+
readonly boundingBoxCreated: StatePromise<boolean>,
|
|
13
|
+
readonly busy: string[],
|
|
14
|
+
readonly id: string,
|
|
15
|
+
readonly initialized: StatePromise<boolean>,
|
|
16
|
+
readonly sessionSettingsId?: string,
|
|
17
|
+
readonly sessionSettingsMode: SESSION_SETTINGS_MODE,
|
|
18
|
+
readonly settingsAssigned: StatePromise<boolean>,
|
|
19
|
+
|
|
20
|
+
applySettings: (sections?: { ar?: boolean, scene?: boolean, camera?: boolean, light?: boolean, environment?: boolean, general?: boolean, postprocessing?: boolean }, settingsEngine?: SettingsEngine, updateViewport?: boolean) => Promise<void>,
|
|
21
|
+
assignSettingsEngine: (settingsEngine: SettingsEngine) => void,
|
|
22
|
+
displayErrorMessage: (message: string) => void,
|
|
23
|
+
environmentMapLoaded: StatePromise<boolean>,
|
|
24
|
+
reset: () => void,
|
|
25
|
+
saveSettings: (settingsEngine?: SettingsEngine) => void,
|
|
26
|
+
update: (id: string) => void,
|
|
27
|
+
|
|
28
|
+
// #endregion Properties (14)
|
|
29
|
+
}
|
|
@@ -1,32 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ISessionGlobalAccessObjectDefinition } from './ISessionGlobalAccessObjectDefinition';
|
|
2
|
+
import { IViewportGlobalAccessObjectDefinition } from './IViewportGlobalAccessObjectDefinition';
|
|
3
|
+
import { StatePromise } from './StatePromise';
|
|
2
4
|
|
|
3
5
|
export class StateEngine {
|
|
4
|
-
// #region Properties (
|
|
6
|
+
// #region Properties (4)
|
|
5
7
|
|
|
6
8
|
private readonly _fontLoaded: StatePromise<boolean> = new StatePromise();
|
|
7
|
-
private readonly
|
|
8
|
-
|
|
9
|
-
id: string,
|
|
10
|
-
initialized: StatePromise<boolean>,
|
|
11
|
-
settingsAssigned: StatePromise<boolean>,
|
|
12
|
-
environmentMapLoaded: StatePromise<boolean>,
|
|
13
|
-
boundingBoxCreated: StatePromise<boolean>,
|
|
14
|
-
busy: string[],
|
|
15
|
-
update: (id: string) => void
|
|
16
|
-
}
|
|
17
|
-
} = {};
|
|
18
|
-
private readonly _sessionEngines: {
|
|
19
|
-
[key: string]: {
|
|
20
|
-
id: string,
|
|
21
|
-
initialized: StatePromise<boolean>,
|
|
22
|
-
initialOutputsLoaded: StatePromise<boolean>,
|
|
23
|
-
settingsRegistered: StatePromise<boolean>,
|
|
24
|
-
}
|
|
25
|
-
} = {};
|
|
9
|
+
private readonly _sessionEngines: { [key: string]: ISessionGlobalAccessObjectDefinition } = {};
|
|
10
|
+
private readonly _viewportEngines: { [key: string]: IViewportGlobalAccessObjectDefinition } = {};
|
|
26
11
|
|
|
27
12
|
private static _instance: StateEngine;
|
|
28
13
|
|
|
29
|
-
// #endregion Properties (
|
|
14
|
+
// #endregion Properties (4)
|
|
30
15
|
|
|
31
16
|
// #region Constructors (1)
|
|
32
17
|
|
|
@@ -36,44 +21,27 @@ export class StateEngine {
|
|
|
36
21
|
|
|
37
22
|
// #endregion Constructors (1)
|
|
38
23
|
|
|
39
|
-
// #region Public Static
|
|
24
|
+
// #region Public Static Getters And Setters (1)
|
|
40
25
|
|
|
41
26
|
public static get instance() {
|
|
42
27
|
return this._instance || (this._instance = new this());
|
|
43
28
|
}
|
|
44
29
|
|
|
45
|
-
// #endregion Public Static
|
|
30
|
+
// #endregion Public Static Getters And Setters (1)
|
|
46
31
|
|
|
47
|
-
// #region Public
|
|
32
|
+
// #region Public Getters And Setters (3)
|
|
48
33
|
|
|
49
34
|
public get fontLoaded(): StatePromise<boolean> {
|
|
50
35
|
return this._fontLoaded;
|
|
51
36
|
}
|
|
52
37
|
|
|
53
|
-
public get
|
|
54
|
-
|
|
55
|
-
id: string,
|
|
56
|
-
initialized: StatePromise<boolean>,
|
|
57
|
-
settingsAssigned: StatePromise<boolean>,
|
|
58
|
-
environmentMapLoaded: StatePromise<boolean>,
|
|
59
|
-
boundingBoxCreated: StatePromise<boolean>,
|
|
60
|
-
busy: string[],
|
|
61
|
-
update: (id: string) => void
|
|
62
|
-
}
|
|
63
|
-
} {
|
|
64
|
-
return this._renderingEngines;
|
|
38
|
+
public get sessionEngines(): { [key: string]: ISessionGlobalAccessObjectDefinition } {
|
|
39
|
+
return this._sessionEngines;
|
|
65
40
|
}
|
|
66
41
|
|
|
67
|
-
public get
|
|
68
|
-
|
|
69
|
-
id: string,
|
|
70
|
-
initialized: StatePromise<boolean>,
|
|
71
|
-
initialOutputsLoaded: StatePromise<boolean>,
|
|
72
|
-
settingsRegistered: StatePromise<boolean>,
|
|
73
|
-
}
|
|
74
|
-
} {
|
|
75
|
-
return this._sessionEngines;
|
|
42
|
+
public get viewportEngines(): { [key: string]: IViewportGlobalAccessObjectDefinition } {
|
|
43
|
+
return this._viewportEngines;
|
|
76
44
|
}
|
|
77
45
|
|
|
78
|
-
// #endregion Public
|
|
79
|
-
}
|
|
46
|
+
// #endregion Public Getters And Setters (3)
|
|
47
|
+
}
|
|
@@ -91,7 +91,7 @@ export class SystemInfo {
|
|
|
91
91
|
public get isIOS(): boolean {
|
|
92
92
|
const osName = this._parser.getOS().name;
|
|
93
93
|
return osName === 'iOS' ||
|
|
94
|
-
(window.navigator && window.navigator.maxTouchPoints === 5 && window.navigator.platform === 'MacIntel');
|
|
94
|
+
(typeof window !== undefined && window.navigator && window.navigator.maxTouchPoints === 5 && window.navigator.platform === 'MacIntel');
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/**
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const atobCustom = (str: string): string => {
|
|
2
|
+
if(typeof window !== 'undefined' && window.atob) {
|
|
3
|
+
return window.atob(str);
|
|
4
|
+
} else {
|
|
5
|
+
return Buffer.from(str, 'base64').toString();
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const btoaCustom = (str: string): string => {
|
|
10
|
+
if(typeof window !== 'undefined' && window.btoa) {
|
|
11
|
+
return window.btoa(str);
|
|
12
|
+
} else {
|
|
13
|
+
return Buffer.from(str).toString('base64');
|
|
14
|
+
}
|
|
15
|
+
};
|