@shapediver/viewer.api.general 3.3.4 → 3.3.7
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/package.json +8 -9
- package/src/index.ts +0 -205
- package/tsconfig.json +0 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapediver/viewer.api.general",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Michael Oppitz <michael@shapediver.com>",
|
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
"test": "__tests__"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
|
-
"dist",
|
|
14
|
-
"src",
|
|
15
13
|
"package.json",
|
|
14
|
+
"dist/",
|
|
16
15
|
"README.md",
|
|
17
|
-
"
|
|
16
|
+
"LICENSE"
|
|
18
17
|
],
|
|
19
18
|
"publishConfig": {
|
|
20
19
|
"access": "public"
|
|
@@ -39,11 +38,11 @@
|
|
|
39
38
|
"testEnvironment": "node"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
|
-
"@shapediver/viewer.data-engine.geometry-engine": "3.3.
|
|
43
|
-
"@shapediver/viewer.shared.build-data": "3.3.
|
|
44
|
-
"@shapediver/viewer.shared.node-tree": "3.3.
|
|
45
|
-
"@shapediver/viewer.shared.services": "3.3.
|
|
41
|
+
"@shapediver/viewer.data-engine.geometry-engine": "3.3.7",
|
|
42
|
+
"@shapediver/viewer.shared.build-data": "3.3.7",
|
|
43
|
+
"@shapediver/viewer.shared.node-tree": "3.3.7",
|
|
44
|
+
"@shapediver/viewer.shared.services": "3.3.7",
|
|
46
45
|
"gl-matrix": "3.3.0"
|
|
47
46
|
},
|
|
48
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "112787d5c5226cca5e89d08102d0b1a3dd4a1d71"
|
|
49
48
|
}
|
package/src/index.ts
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { build_data } from '@shapediver/viewer.shared.build-data';
|
|
2
|
-
import {
|
|
3
|
-
EventEngine,
|
|
4
|
-
HttpClient,
|
|
5
|
-
IEvent,
|
|
6
|
-
InputValidator,
|
|
7
|
-
Logger,
|
|
8
|
-
LOGGING_LEVEL,
|
|
9
|
-
MainEventTypes
|
|
10
|
-
} from '@shapediver/viewer.shared.services';
|
|
11
|
-
import { GeometryEngine } from '@shapediver/viewer.data-engine.geometry-engine';
|
|
12
|
-
import { ITree, Tree } from '@shapediver/viewer.shared.node-tree';
|
|
13
|
-
|
|
14
|
-
// #region Interfaces (1)
|
|
15
|
-
|
|
16
|
-
export interface IGeneralOptions {
|
|
17
|
-
// #region Properties (5)
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Caching options.
|
|
21
|
-
*/
|
|
22
|
-
caching: {
|
|
23
|
-
/**
|
|
24
|
-
* Option to enable/disable the caching. (default: true)
|
|
25
|
-
*/
|
|
26
|
-
enable: boolean;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Query parameters that are excluded when creating the key that is used for the comparison of data entries in the cache. (default: ['Expires', 'Signature', 'Key-Pair-Id'])
|
|
30
|
-
* Example: by the addition of 'Expires' the URLs https://link.example?Expires=0 and https://link.example?Expires=1 are both reduced to https://link.example for caching.
|
|
31
|
-
*/
|
|
32
|
-
excludedQueryParameters: string[];
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The maximum size of the cache in bytes. (default: 1024^3)
|
|
36
|
-
*/
|
|
37
|
-
maxCacheSize: number;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* When set to false, the branding in the viewer console will be limited to a single line.
|
|
42
|
-
* This will only include the viewer version. (default: true)
|
|
43
|
-
*/
|
|
44
|
-
consoleBranding: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* The logging level that is used.
|
|
47
|
-
*/
|
|
48
|
-
loggingLevel: LOGGING_LEVEL;
|
|
49
|
-
/**
|
|
50
|
-
* The number of glTFs that are downloaded and processed at the same time.
|
|
51
|
-
* Restricting this number might help if too much data is downloaded at the same time.
|
|
52
|
-
* (default: Infinity)
|
|
53
|
-
*/
|
|
54
|
-
parallelGlTFProcessing: number;
|
|
55
|
-
/**
|
|
56
|
-
* Option to show/hide messages in the browser console.
|
|
57
|
-
*/
|
|
58
|
-
showMessages: boolean;
|
|
59
|
-
|
|
60
|
-
// #endregion Properties (5)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// #endregion Interfaces (1)
|
|
64
|
-
|
|
65
|
-
// #region Classes (1)
|
|
66
|
-
|
|
67
|
-
class GeneralOptions {
|
|
68
|
-
// #region Public Getters And Setters (10)
|
|
69
|
-
|
|
70
|
-
public get caching(): { enable: boolean, excludedQueryParameters: string[], maxCacheSize: number } {
|
|
71
|
-
return {
|
|
72
|
-
enable: httpClient.enableCaching,
|
|
73
|
-
excludedQueryParameters: httpClient.excludedQueryParameters,
|
|
74
|
-
maxCacheSize: httpClient.maxCacheSize
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public set caching(value: { enable: boolean, excludedQueryParameters: string[], maxCacheSize: number }) {
|
|
79
|
-
inputValidator.validateAndError('caching', value, 'object', true);
|
|
80
|
-
inputValidator.validateAndError('caching', value.enable, 'boolean');
|
|
81
|
-
inputValidator.validateAndError('caching', value.excludedQueryParameters, 'stringArray');
|
|
82
|
-
inputValidator.validateAndError('caching', value.maxCacheSize, 'number');
|
|
83
|
-
if (value.enable !== undefined) httpClient.enableCaching = value.enable;
|
|
84
|
-
if (value.excludedQueryParameters !== undefined) httpClient.excludedQueryParameters = value.excludedQueryParameters;
|
|
85
|
-
if (value.maxCacheSize !== undefined) httpClient.maxCacheSize = value.maxCacheSize;
|
|
86
|
-
logger.debug(`caching: CoggingLevel was set to: ${value}`);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public get consoleBranding(): boolean {
|
|
90
|
-
return consoleBranding;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
public set consoleBranding(value: boolean) {
|
|
94
|
-
inputValidator.validateAndError('consoleBranding', value, 'boolean');
|
|
95
|
-
consoleBranding = value;
|
|
96
|
-
logger.debug(`consoleBranding: ConsoleBranding was set to: ${value}`);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public get loggingLevel(): LOGGING_LEVEL {
|
|
100
|
-
return logger.loggingLevel;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
public set loggingLevel(value: LOGGING_LEVEL) {
|
|
104
|
-
inputValidator.validateAndError('loggingLevel', value, 'enum', true, Object.values(LOGGING_LEVEL));
|
|
105
|
-
logger.loggingLevel = value;
|
|
106
|
-
logger.debug(`loggingLevel: LoggingLevel was set to: ${value}`);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
public get parallelGlTFProcessing(): number {
|
|
110
|
-
return geometryEngine.parallelGlTFProcessing;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
public set parallelGlTFProcessing(value: number) {
|
|
114
|
-
inputValidator.validateAndError('parallelGlTFProcessing', value, 'number');
|
|
115
|
-
geometryEngine.parallelGlTFProcessing = value;
|
|
116
|
-
logger.debug(`parallelGlTFProcessing: ParallelGlTFProcessing was set to: ${value}`);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
public get showMessages(): boolean {
|
|
120
|
-
return logger.showMessages;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
public set showMessages(value: boolean) {
|
|
124
|
-
inputValidator.validateAndError('showMessages', value, 'boolean');
|
|
125
|
-
logger.showMessages = value;
|
|
126
|
-
logger.debug(`showMessages: ShowMessages was set to: ${value}`);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// #endregion Public Getters And Setters (10)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// #endregion Classes (1)
|
|
133
|
-
|
|
134
|
-
// #region Variables (12)
|
|
135
|
-
|
|
136
|
-
const httpClient: HttpClient = HttpClient.instance;
|
|
137
|
-
const inputValidator: InputValidator = InputValidator.instance;
|
|
138
|
-
const logger: Logger = Logger.instance;
|
|
139
|
-
const eventEngine: EventEngine = EventEngine.instance;
|
|
140
|
-
const geometryEngine: GeometryEngine = GeometryEngine.instance;
|
|
141
|
-
let createdConsoleMessage = false, consoleBranding = true;
|
|
142
|
-
/**
|
|
143
|
-
* Adds an event listener.
|
|
144
|
-
*
|
|
145
|
-
* @param type The type of event.
|
|
146
|
-
* @param cb The callback.
|
|
147
|
-
* @returns
|
|
148
|
-
*/
|
|
149
|
-
export const addListener = (type: string | MainEventTypes, cb: (event: IEvent) => void): string => {
|
|
150
|
-
inputValidator.validateAndError('addListener', type, 'string');
|
|
151
|
-
inputValidator.validateAndError('addListener', cb, 'function');
|
|
152
|
-
logger.debug(`addListener: Event Listener was registered for ${type}.`);
|
|
153
|
-
return eventEngine.addListener(type, cb);
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* Removes an event listener.
|
|
157
|
-
*
|
|
158
|
-
* @param id The id of the listener.
|
|
159
|
-
* @returns
|
|
160
|
-
*/
|
|
161
|
-
export const removeListener = (id: string): boolean => {
|
|
162
|
-
inputValidator.validateAndError('removeListener', id, 'string');
|
|
163
|
-
logger.debug(`removeListener: Removing event listener with id ${id}.`);
|
|
164
|
-
return eventEngine.removeListener(id);
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* The scene tree that is used to store the scene.
|
|
168
|
-
* The scene tree contains a unique node and child nodes for each session,
|
|
169
|
-
* and can also be used to add your own nodes.
|
|
170
|
-
*/
|
|
171
|
-
export const sceneTree: ITree = Tree.instance;
|
|
172
|
-
/**
|
|
173
|
-
* The version of the viewer.
|
|
174
|
-
*/
|
|
175
|
-
export const version: string = build_data.build_version.replace('3.', '');
|
|
176
|
-
export const showConsoleMessage = () => {
|
|
177
|
-
if (createdConsoleMessage === true) return;
|
|
178
|
-
createdConsoleMessage = true;
|
|
179
|
-
|
|
180
|
-
if (consoleBranding === true) {
|
|
181
|
-
console.log(`Powered by:
|
|
182
|
-
_____ __ ____ _
|
|
183
|
-
/ ___/ / /_ ____ _ ____ ___ / __ \\ (_)_ __ ___ _____
|
|
184
|
-
\\__ \\ / __ \\ / __ '// __ \\ / _ \\ / / / // /| | / // _ \\ / ___/
|
|
185
|
-
___/ // / / // /_/ // /_/ // __// /_/ // / | |/ // __// /
|
|
186
|
-
/____//_/ /_/ \\__,_// .___/ \\___//_____//_/ |___/ \\___//_/
|
|
187
|
-
/_/
|
|
188
|
-
ShapeDiver Viewer 3, Version ${build_data.build_version.replace('3.', '')}
|
|
189
|
-
Visit us at https://shapediver.com/ and find out more!
|
|
190
|
-
`);
|
|
191
|
-
} else {
|
|
192
|
-
console.log(`ShapeDiver Viewer 3, Version ${build_data.build_version.replace('3.', '')}`);
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
/**
|
|
196
|
-
* General Viewer options that are used everywhere.
|
|
197
|
-
* - loggingLevel: The logging level that is used.
|
|
198
|
-
* - showMessages: Option to show/hide messages in the browser console.
|
|
199
|
-
* - parallelGlTFProcessing: The number of glTFs that are downloaded and processed at the same time.
|
|
200
|
-
* - consoleBranding: When set to false, the branding in the viewer console will be limited to a single line.
|
|
201
|
-
* - caching: Caching Options.
|
|
202
|
-
*/
|
|
203
|
-
export const generalOptions: IGeneralOptions = new GeneralOptions();
|
|
204
|
-
|
|
205
|
-
// #endregion Variables (12)
|
package/tsconfig.json
DELETED