@inweb/viewer-core 25.3.13
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/LICENSE +20 -0
- package/README.md +7 -0
- package/dist/viewer-core.js +420 -0
- package/dist/viewer-core.js.map +1 -0
- package/dist/viewer-core.module.js +354 -0
- package/dist/viewer-core.module.js.map +1 -0
- package/lib/commands/Commands.d.ts +3 -0
- package/lib/commands/ICommands.d.ts +24 -0
- package/lib/index.d.ts +8 -0
- package/lib/options/Options.d.ts +238 -0
- package/lib/options/OptionsEvents.d.ts +25 -0
- package/lib/viewer/CanvasEvents.d.ts +1 -0
- package/lib/viewer/IViewer.d.ts +26 -0
- package/lib/viewer/IViewpoint.d.ts +128 -0
- package/lib/viewer/ViewerEvents.d.ts +599 -0
- package/package.json +34 -0
- package/src/commands/Commands.ts +84 -0
- package/src/commands/ICommands.ts +53 -0
- package/src/index.ts +31 -0
- package/src/options/Options.ts +527 -0
- package/src/options/OptionsEvents.ts +28 -0
- package/src/viewer/CanvasEvents.ts +41 -0
- package/src/viewer/IViewer.ts +56 -0
- package/src/viewer/IViewpoint.ts +146 -0
- package/src/viewer/ViewerEvents.ts +703 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
class Commands {
|
|
2
|
+
constructor() {
|
|
3
|
+
this._commands = new Map;
|
|
4
|
+
}
|
|
5
|
+
registerCommand(id, handler, description, thisArg) {
|
|
6
|
+
this._commands.set(id, {
|
|
7
|
+
id: id,
|
|
8
|
+
handler: handler,
|
|
9
|
+
thisArg: thisArg,
|
|
10
|
+
description: description
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
registerCommandAlias(id, alias) {
|
|
14
|
+
this.registerCommand(alias, ((viewer, ...args) => this.executeCommand(id, viewer, ...args)));
|
|
15
|
+
}
|
|
16
|
+
getCommand(id) {
|
|
17
|
+
return this._commands.get(id);
|
|
18
|
+
}
|
|
19
|
+
getCommands() {
|
|
20
|
+
const map = new Map;
|
|
21
|
+
this._commands.forEach(((value, key) => map.set(key, value)));
|
|
22
|
+
return map;
|
|
23
|
+
}
|
|
24
|
+
executeCommand(id, viewer, ...args) {
|
|
25
|
+
const command = this._commands.get(id);
|
|
26
|
+
if (!command) {
|
|
27
|
+
if (viewer) {
|
|
28
|
+
const isDraggerCommand = viewer.draggers.includes(id);
|
|
29
|
+
if (isDraggerCommand) return viewer.setActiveDragger(id);
|
|
30
|
+
}
|
|
31
|
+
console.warn(`Command '${id}' not found`);
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
const {handler: handler, thisArg: thisArg} = command;
|
|
35
|
+
const result = handler.apply(thisArg, [ viewer, ...args ]);
|
|
36
|
+
viewer === null || viewer === void 0 ? void 0 : viewer.emit({
|
|
37
|
+
type: "command",
|
|
38
|
+
data: id,
|
|
39
|
+
args: args
|
|
40
|
+
});
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const _commands = new Map;
|
|
46
|
+
|
|
47
|
+
function commands(viewerType = "") {
|
|
48
|
+
let result = _commands.get(viewerType);
|
|
49
|
+
if (!result) {
|
|
50
|
+
result = new Commands;
|
|
51
|
+
_commands.set(viewerType, result);
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
commands("").registerCommand("noop", (() => {}));
|
|
57
|
+
|
|
58
|
+
commands("VisualizeJS").registerCommand("noop", (() => {}));
|
|
59
|
+
|
|
60
|
+
commands("ThreeJS").registerCommand("noop", (() => {}));
|
|
61
|
+
|
|
62
|
+
class Options {
|
|
63
|
+
constructor(emitter) {
|
|
64
|
+
this._emitter = emitter;
|
|
65
|
+
this._data = Options.defaults();
|
|
66
|
+
this.loadFromStorage();
|
|
67
|
+
}
|
|
68
|
+
static defaults() {
|
|
69
|
+
return {
|
|
70
|
+
showWCS: true,
|
|
71
|
+
cameraAnimation: true,
|
|
72
|
+
antialiasing: true,
|
|
73
|
+
groundShadow: false,
|
|
74
|
+
shadows: false,
|
|
75
|
+
cameraAxisXSpeed: 4,
|
|
76
|
+
cameraAxisYSpeed: 1,
|
|
77
|
+
ambientOcclusion: false,
|
|
78
|
+
enableStreamingMode: true,
|
|
79
|
+
enablePartialMode: false,
|
|
80
|
+
memoryLimit: 3294967296,
|
|
81
|
+
cuttingPlaneFillColor: {
|
|
82
|
+
red: 255,
|
|
83
|
+
green: 152,
|
|
84
|
+
blue: 0
|
|
85
|
+
},
|
|
86
|
+
edgesColor: {
|
|
87
|
+
r: 255,
|
|
88
|
+
g: 152,
|
|
89
|
+
b: 0
|
|
90
|
+
},
|
|
91
|
+
facesColor: {
|
|
92
|
+
r: 255,
|
|
93
|
+
g: 152,
|
|
94
|
+
b: 0
|
|
95
|
+
},
|
|
96
|
+
edgesVisibility: true,
|
|
97
|
+
edgesOverlap: true,
|
|
98
|
+
facesOverlap: false,
|
|
99
|
+
facesTransparancy: 200,
|
|
100
|
+
enableCustomHighlight: true,
|
|
101
|
+
sceneGraph: false,
|
|
102
|
+
edgeModel: true,
|
|
103
|
+
reverseZoomWheel: false,
|
|
104
|
+
enableZoomWheel: true,
|
|
105
|
+
enableGestures: true,
|
|
106
|
+
geometryType: "vsfx"
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
notifierChangeEvent() {
|
|
110
|
+
if (this._emitter !== undefined) {
|
|
111
|
+
this.saveToStorage();
|
|
112
|
+
this._emitter.emit({
|
|
113
|
+
type: "optionschange",
|
|
114
|
+
data: this
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
saveToStorage() {
|
|
119
|
+
if (typeof window !== "undefined") try {
|
|
120
|
+
localStorage.setItem("od-client-settings", JSON.stringify(this.data));
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error("Cannot save client settings.", error);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
loadFromStorage() {
|
|
126
|
+
if (typeof window !== "undefined") try {
|
|
127
|
+
const item = localStorage.getItem("od-client-settings");
|
|
128
|
+
if (item) {
|
|
129
|
+
const data = JSON.parse(item);
|
|
130
|
+
this.data = {
|
|
131
|
+
...data
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
} catch (error) {
|
|
135
|
+
console.error("Cannot load client settings.", error);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
resetToDefaults(fields) {
|
|
139
|
+
if (fields !== undefined) {
|
|
140
|
+
const defaults = Options.defaults();
|
|
141
|
+
const resetData = fields.reduce(((acc, field) => {
|
|
142
|
+
acc[field] = defaults[field];
|
|
143
|
+
return acc;
|
|
144
|
+
}), {});
|
|
145
|
+
this.data = {
|
|
146
|
+
...this.data,
|
|
147
|
+
...resetData
|
|
148
|
+
};
|
|
149
|
+
} else {
|
|
150
|
+
this.data = {
|
|
151
|
+
...this.data,
|
|
152
|
+
...Options.defaults()
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
get data() {
|
|
157
|
+
return this._data;
|
|
158
|
+
}
|
|
159
|
+
set data(value) {
|
|
160
|
+
const sceneGraph = value.enablePartialMode ? false : value.sceneGraph;
|
|
161
|
+
this._data = {
|
|
162
|
+
...Options.defaults(),
|
|
163
|
+
...this._data,
|
|
164
|
+
...value,
|
|
165
|
+
sceneGraph: sceneGraph
|
|
166
|
+
};
|
|
167
|
+
this.notifierChangeEvent();
|
|
168
|
+
}
|
|
169
|
+
get showWCS() {
|
|
170
|
+
return this._data.showWCS;
|
|
171
|
+
}
|
|
172
|
+
set showWCS(value) {
|
|
173
|
+
this._data.showWCS = value;
|
|
174
|
+
this.notifierChangeEvent();
|
|
175
|
+
}
|
|
176
|
+
get cameraAnimation() {
|
|
177
|
+
return this._data.cameraAnimation;
|
|
178
|
+
}
|
|
179
|
+
set cameraAnimation(value) {
|
|
180
|
+
this._data.cameraAnimation = value;
|
|
181
|
+
this.notifierChangeEvent();
|
|
182
|
+
}
|
|
183
|
+
get antialiasing() {
|
|
184
|
+
return this._data.antialiasing;
|
|
185
|
+
}
|
|
186
|
+
set antialiasing(value) {
|
|
187
|
+
this._data.antialiasing = value;
|
|
188
|
+
this.notifierChangeEvent();
|
|
189
|
+
}
|
|
190
|
+
get groundShadow() {
|
|
191
|
+
return this._data.groundShadow;
|
|
192
|
+
}
|
|
193
|
+
set groundShadow(value) {
|
|
194
|
+
this._data.groundShadow = value;
|
|
195
|
+
this.notifierChangeEvent();
|
|
196
|
+
}
|
|
197
|
+
get shadows() {
|
|
198
|
+
return this._data.shadows;
|
|
199
|
+
}
|
|
200
|
+
set shadows(value) {
|
|
201
|
+
this._data.shadows = value;
|
|
202
|
+
this.notifierChangeEvent();
|
|
203
|
+
}
|
|
204
|
+
get cameraAxisXSpeed() {
|
|
205
|
+
return this._data.cameraAxisXSpeed;
|
|
206
|
+
}
|
|
207
|
+
set cameraAxisXSpeed(value) {
|
|
208
|
+
this._data.cameraAxisXSpeed = value;
|
|
209
|
+
this.notifierChangeEvent();
|
|
210
|
+
}
|
|
211
|
+
get cameraAxisYSpeed() {
|
|
212
|
+
return this._data.cameraAxisYSpeed;
|
|
213
|
+
}
|
|
214
|
+
set cameraAxisYSpeed(value) {
|
|
215
|
+
this.cameraAxisYSpeed = value;
|
|
216
|
+
this.notifierChangeEvent();
|
|
217
|
+
}
|
|
218
|
+
get ambientOcclusion() {
|
|
219
|
+
return this._data.ambientOcclusion;
|
|
220
|
+
}
|
|
221
|
+
set ambientOcclusion(value) {
|
|
222
|
+
this._data.ambientOcclusion = value;
|
|
223
|
+
this.notifierChangeEvent();
|
|
224
|
+
}
|
|
225
|
+
get enableStreamingMode() {
|
|
226
|
+
return this._data.enableStreamingMode;
|
|
227
|
+
}
|
|
228
|
+
set enableStreamingMode(value) {
|
|
229
|
+
this._data.enableStreamingMode = value;
|
|
230
|
+
if (this._data.enableStreamingMode) {
|
|
231
|
+
this._data.enablePartialMode = false;
|
|
232
|
+
}
|
|
233
|
+
this.notifierChangeEvent();
|
|
234
|
+
}
|
|
235
|
+
get enablePartialMode() {
|
|
236
|
+
return this._data.enablePartialMode;
|
|
237
|
+
}
|
|
238
|
+
set enablePartialMode(value) {
|
|
239
|
+
this._data.enablePartialMode = value;
|
|
240
|
+
if (value) this._data.sceneGraph = false;
|
|
241
|
+
this.notifierChangeEvent();
|
|
242
|
+
}
|
|
243
|
+
get memoryLimit() {
|
|
244
|
+
return this._data.memoryLimit;
|
|
245
|
+
}
|
|
246
|
+
set memoryLimit(value) {
|
|
247
|
+
this._data.memoryLimit = value;
|
|
248
|
+
this.notifierChangeEvent();
|
|
249
|
+
}
|
|
250
|
+
get cuttingPlaneFillColor() {
|
|
251
|
+
return this._data.cuttingPlaneFillColor;
|
|
252
|
+
}
|
|
253
|
+
set cuttingPlaneFillColor(value) {
|
|
254
|
+
this._data.cuttingPlaneFillColor = value;
|
|
255
|
+
this.notifierChangeEvent();
|
|
256
|
+
}
|
|
257
|
+
get edgesColor() {
|
|
258
|
+
return this._data.edgesColor;
|
|
259
|
+
}
|
|
260
|
+
set edgesColor(value) {
|
|
261
|
+
this._data.edgesColor = value;
|
|
262
|
+
this.notifierChangeEvent();
|
|
263
|
+
}
|
|
264
|
+
get facesColor() {
|
|
265
|
+
return this._data.facesColor;
|
|
266
|
+
}
|
|
267
|
+
set facesColor(value) {
|
|
268
|
+
this._data.facesColor = value;
|
|
269
|
+
this.notifierChangeEvent();
|
|
270
|
+
}
|
|
271
|
+
get edgesVisibility() {
|
|
272
|
+
return this._data.edgesVisibility;
|
|
273
|
+
}
|
|
274
|
+
set edgesVisibility(value) {
|
|
275
|
+
this._data.edgesVisibility = value;
|
|
276
|
+
this.notifierChangeEvent();
|
|
277
|
+
}
|
|
278
|
+
get edgesOverlap() {
|
|
279
|
+
return this._data.edgesOverlap;
|
|
280
|
+
}
|
|
281
|
+
set edgesOverlap(value) {
|
|
282
|
+
this._data.edgesOverlap = value;
|
|
283
|
+
this.notifierChangeEvent();
|
|
284
|
+
}
|
|
285
|
+
get facesOverlap() {
|
|
286
|
+
return this._data.facesOverlap;
|
|
287
|
+
}
|
|
288
|
+
set facesOverlap(value) {
|
|
289
|
+
this._data.facesOverlap = value;
|
|
290
|
+
this.notifierChangeEvent();
|
|
291
|
+
}
|
|
292
|
+
get facesTransparancy() {
|
|
293
|
+
return this._data.facesTransparancy;
|
|
294
|
+
}
|
|
295
|
+
set facesTransparancy(value) {
|
|
296
|
+
this._data.facesTransparancy = value;
|
|
297
|
+
this.notifierChangeEvent();
|
|
298
|
+
}
|
|
299
|
+
get enableCustomHighlight() {
|
|
300
|
+
return this._data.enableCustomHighlight;
|
|
301
|
+
}
|
|
302
|
+
set enableCustomHighlight(value) {
|
|
303
|
+
this._data.enableCustomHighlight = value;
|
|
304
|
+
this.notifierChangeEvent();
|
|
305
|
+
}
|
|
306
|
+
get sceneGraph() {
|
|
307
|
+
return this._data.sceneGraph;
|
|
308
|
+
}
|
|
309
|
+
set sceneGraph(value) {
|
|
310
|
+
this._data.sceneGraph = value;
|
|
311
|
+
if (value) this._data.enablePartialMode = false;
|
|
312
|
+
this.notifierChangeEvent();
|
|
313
|
+
}
|
|
314
|
+
get edgeModel() {
|
|
315
|
+
return Boolean(this._data.edgeModel);
|
|
316
|
+
}
|
|
317
|
+
set edgeModel(value) {
|
|
318
|
+
this._data.edgeModel = Boolean(value);
|
|
319
|
+
this.notifierChangeEvent();
|
|
320
|
+
}
|
|
321
|
+
get reverseZoomWheel() {
|
|
322
|
+
return this._data.reverseZoomWheel;
|
|
323
|
+
}
|
|
324
|
+
set reverseZoomWheel(value) {
|
|
325
|
+
this._data.reverseZoomWheel = !!value;
|
|
326
|
+
this.notifierChangeEvent();
|
|
327
|
+
}
|
|
328
|
+
get enableZoomWheel() {
|
|
329
|
+
return this._data.enableZoomWheel;
|
|
330
|
+
}
|
|
331
|
+
set enableZoomWheel(value) {
|
|
332
|
+
this._data.enableZoomWheel = !!value;
|
|
333
|
+
this.notifierChangeEvent();
|
|
334
|
+
}
|
|
335
|
+
get enableGestures() {
|
|
336
|
+
return this._data.enableGestures;
|
|
337
|
+
}
|
|
338
|
+
set enableGestures(value) {
|
|
339
|
+
this._data.enableGestures = !!value;
|
|
340
|
+
this.notifierChangeEvent();
|
|
341
|
+
}
|
|
342
|
+
get geometryType() {
|
|
343
|
+
return this._data.geometryType;
|
|
344
|
+
}
|
|
345
|
+
set geometryType(value) {
|
|
346
|
+
this._data.geometryType = value;
|
|
347
|
+
this.notifierChangeEvent();
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
const CANVAS_EVENTS = [ "click", "dblclick", "mousedown", "mousemove", "mouseup", "mouseleave", "pointerdown", "pointermove", "pointerup", "pointerleave", "pointercancel", "wheel", "touchstart", "touchmove", "touchend", "touchcancel" ];
|
|
352
|
+
|
|
353
|
+
export { CANVAS_EVENTS, Options, commands };
|
|
354
|
+
//# sourceMappingURL=viewer-core.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewer-core.module.js","sources":["../src/commands/Commands.ts","../src/options/Options.ts","../src/viewer/CanvasEvents.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2023, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IViewer } from \"../viewer/IViewer\";\nimport { ICommand, ICommandHandler, ICommandDescription, ICommandsMap, ICommands } from \"./ICommands\";\n\nclass Commands implements ICommands {\n private readonly _commands = new Map<string, ICommand>();\n\n registerCommand(id: string, handler: ICommandHandler, description?: ICommandDescription, thisArg?: any): void {\n this._commands.set(id, { id, handler, thisArg, description });\n }\n\n registerCommandAlias(id: string, alias: string): void {\n this.registerCommand(alias, (viewer: IViewer, ...args) => this.executeCommand(id, viewer, ...args));\n }\n\n getCommand(id: string): ICommand | undefined {\n return this._commands.get(id);\n }\n\n getCommands(): ICommandsMap {\n const map = new Map<string, ICommand>();\n this._commands.forEach((value, key) => map.set(key, value));\n return map;\n }\n\n executeCommand(id: string, viewer: IViewer, ...args: any[]): any {\n const command = this._commands.get(id);\n if (!command) {\n if (viewer) {\n const isDraggerCommand = viewer.draggers.includes(id);\n if (isDraggerCommand) return viewer.setActiveDragger(id);\n }\n\n console.warn(`Command '${id}' not found`);\n return undefined;\n }\n\n const { handler, thisArg } = command;\n const result = handler.apply(thisArg, [viewer, ...args]);\n\n viewer?.emit({ type: \"command\", data: id, args });\n\n return result;\n }\n}\n\nconst _commands = new Map<string, Commands>();\n\nfunction commands(viewerType = \"\"): ICommands {\n let result = _commands.get(viewerType);\n if (!result) {\n result = new Commands();\n _commands.set(viewerType, result);\n }\n return result;\n}\n\ncommands(\"\").registerCommand(\"noop\", () => {});\ncommands(\"VisualizeJS\").registerCommand(\"noop\", () => {});\ncommands(\"ThreeJS\").registerCommand(\"noop\", () => {});\n\nexport { commands };\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2021, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { EventEmitter2 } from \"@inweb/eventemitter2\";\n\nexport interface RGB {\n red: number;\n green: number;\n blue: number;\n}\n\n/**\n * `VisualizeJS` parameters.\n */\nexport interface OptionsData {\n /**\n * Show WCS\n *\n * @defaultValue true\n */\n showWCS?: boolean;\n\n /**\n * Enable camera animation\n *\n * @defaultValue true\n */\n cameraAnimation?: boolean;\n\n /**\n * Enable antialiasing use FXAA\n *\n * @defaultValue true\n */\n antialiasing?: boolean;\n\n /**\n * Enable ground shadows\n *\n * @defaultValue false\n */\n groundShadow?: boolean;\n\n /**\n * Enable shadows\n *\n * @defaultValue false\n */\n shadows?: boolean;\n\n /**\n * Camera speed on X axis\n *\n * @defaultValue 4\n */\n cameraAxisXSpeed?: number;\n\n /**\n * Camera speed on Y axis\n *\n * @defaultValue 1\n */\n cameraAxisYSpeed?: number;\n\n /**\n * Ambient occlusion\n *\n * @defaultValue false\n */\n ambientOcclusion?: boolean;\n\n /**\n * Enable streaming mode\n *\n * If enableStreamingMode is true then enablePartialMode will be used, otherwise -\n * enablePartialMode will be ignored and file / assembly will be loaded in one go\n *\n * @defaultValue true\n */\n enableStreamingMode?: boolean;\n\n /**\n * Enable partial load mode to be able open large drawing If enablePartialMode enabled, then\n * sceneGraph will be switched off\n *\n * @defaultValue false\n */\n enablePartialMode?: boolean;\n\n /**\n * The size of the memory buffer that the Viewer can use for graphics data\n *\n * @defaultValue 3294967296\n */\n memoryLimit?: number;\n\n /**\n * Cutting plane fill color\n *\n * @defaultValue { red: 0xff, green: 0x98, blue: 0x00 }\n */\n cuttingPlaneFillColor?: RGB;\n\n /**\n * Outline edges color in RGB format.\n */\n edgesColor?: { r: number; g: number; b: number };\n\n /**\n * Faces color in the RGB format.\n */\n facesColor?: { r: number; g: number; b: number };\n\n /**\n * Show or hide edges.\n */\n edgesVisibility?: boolean;\n\n /**\n * Show edges over drawing.\n */\n edgesOverlap?: boolean;\n\n /**\n * Show faces over drawing.\n */\n facesOverlap?: boolean;\n\n /**\n * Faces transparency value from 0 to 255.\n */\n facesTransparancy?: number;\n\n /**\n * Enable custom highlight settings.\n */\n enableCustomHighlight?: boolean;\n\n /**\n * Enable or disable scene graph, it increases perfomance improvement, but consumes memory\n * Large drawings can take up a lot of memory. If sceneGraph enabled, then enablePartialMode\n * will be switched off\n */\n sceneGraph: boolean;\n\n /**\n * Edge display models. No edges is usefull for less memory consumption: `false` - no edges\n * are displayed, `true` - display isolines.\n */\n edgeModel: boolean;\n\n /**\n * Reverse the mouse wheel direction for zooming: false - moving the wheel up zooms in,\n * moving down zooms out, `true` - moving the wheel up zooms out, moving down zooms in.\n */\n reverseZoomWheel: boolean;\n\n /**\n * Enable mouse wheel zooming.\n */\n enableZoomWheel: boolean;\n\n /**\n * Enable touch gestures. This option will be ignored when enableZoomWheel is disabled, since\n * gestures contains touch zoom.\n */\n enableGestures: boolean;\n\n /**\n * Default file geometry data type. Can be one of:\n *\n * - `vsfx` - `VSFX` (default), for opening a file in `VisualizeJS` viewer.\n * - `gltf` - `glTF`, for opening a file in `Three.js` viewer.\n */\n geometryType?: string;\n}\n\nexport class Options {\n protected _emitter?: EventEmitter2;\n protected _data: OptionsData;\n\n constructor(emitter?: EventEmitter2) {\n this._emitter = emitter;\n this._data = Options.defaults();\n this.loadFromStorage();\n }\n\n static defaults(): OptionsData {\n return {\n showWCS: true,\n cameraAnimation: true,\n antialiasing: true,\n groundShadow: false,\n shadows: false,\n cameraAxisXSpeed: 4,\n cameraAxisYSpeed: 1,\n ambientOcclusion: false,\n enableStreamingMode: true,\n enablePartialMode: false,\n memoryLimit: 3294967296,\n cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },\n edgesColor: { r: 0xff, g: 0x98, b: 0x00 },\n facesColor: { r: 0xff, g: 0x98, b: 0x00 },\n edgesVisibility: true,\n edgesOverlap: true,\n facesOverlap: false,\n facesTransparancy: 200,\n enableCustomHighlight: true,\n sceneGraph: false,\n edgeModel: true,\n reverseZoomWheel: false,\n enableZoomWheel: true,\n enableGestures: true,\n geometryType: \"vsfx\",\n };\n }\n\n notifierChangeEvent(): void {\n if (this._emitter !== undefined) {\n this.saveToStorage();\n this._emitter.emit({ type: \"optionschange\", data: this });\n }\n }\n\n saveToStorage(): void {\n if (typeof window !== \"undefined\")\n try {\n localStorage.setItem(\"od-client-settings\", JSON.stringify(this.data));\n } catch (error) {\n console.error(\"Cannot save client settings.\", error);\n }\n }\n\n loadFromStorage(): void {\n if (typeof window !== \"undefined\")\n try {\n const item = localStorage.getItem(\"od-client-settings\");\n if (item) {\n const data = JSON.parse(item);\n this.data = { ...data };\n }\n } catch (error) {\n console.error(\"Cannot load client settings.\", error);\n }\n }\n\n /**\n * Reset options to default\n *\n * @param fields - Name of fields to be reset\n */\n resetToDefaults(fields?: string[]): void {\n if (fields !== undefined) {\n const defaults = Options.defaults();\n const resetData = fields.reduce((acc, field) => {\n acc[field] = defaults[field];\n return acc;\n }, {});\n\n this.data = { ...this.data, ...resetData };\n } else {\n this.data = { ...this.data, ...Options.defaults() };\n }\n }\n\n get data(): OptionsData {\n return this._data;\n }\n\n set data(value: OptionsData) {\n const sceneGraph = value.enablePartialMode ? false : value.sceneGraph;\n this._data = { ...Options.defaults(), ...this._data, ...value, sceneGraph };\n this.notifierChangeEvent();\n }\n\n get showWCS(): boolean {\n return this._data.showWCS;\n }\n\n set showWCS(value: boolean) {\n this._data.showWCS = value;\n this.notifierChangeEvent();\n }\n\n get cameraAnimation(): boolean {\n return this._data.cameraAnimation;\n }\n\n set cameraAnimation(value: boolean) {\n this._data.cameraAnimation = value;\n this.notifierChangeEvent();\n }\n\n get antialiasing(): boolean {\n return this._data.antialiasing;\n }\n\n set antialiasing(value: boolean) {\n this._data.antialiasing = value;\n this.notifierChangeEvent();\n }\n\n get groundShadow(): boolean {\n return this._data.groundShadow;\n }\n\n set groundShadow(value: boolean) {\n this._data.groundShadow = value;\n this.notifierChangeEvent();\n }\n\n get shadows(): boolean {\n return this._data.shadows;\n }\n\n set shadows(value: boolean) {\n this._data.shadows = value;\n this.notifierChangeEvent();\n }\n\n get cameraAxisXSpeed(): number {\n return this._data.cameraAxisXSpeed;\n }\n\n set cameraAxisXSpeed(value: number) {\n this._data.cameraAxisXSpeed = value;\n this.notifierChangeEvent();\n }\n\n get cameraAxisYSpeed(): number {\n return this._data.cameraAxisYSpeed;\n }\n\n set cameraAxisYSpeed(value: number) {\n this.cameraAxisYSpeed = value;\n this.notifierChangeEvent();\n }\n\n get ambientOcclusion(): boolean {\n return this._data.ambientOcclusion;\n }\n\n set ambientOcclusion(value: boolean) {\n this._data.ambientOcclusion = value;\n this.notifierChangeEvent();\n }\n\n get enableStreamingMode(): boolean {\n return this._data.enableStreamingMode;\n }\n\n set enableStreamingMode(value: boolean) {\n this._data.enableStreamingMode = value;\n\n if (this._data.enableStreamingMode) {\n this._data.enablePartialMode = false;\n }\n\n this.notifierChangeEvent();\n }\n\n get enablePartialMode(): boolean {\n return this._data.enablePartialMode;\n }\n\n set enablePartialMode(value: boolean) {\n this._data.enablePartialMode = value;\n if (value) this._data.sceneGraph = false;\n this.notifierChangeEvent();\n }\n\n get memoryLimit(): number {\n return this._data.memoryLimit;\n }\n\n set memoryLimit(value: number) {\n this._data.memoryLimit = value;\n this.notifierChangeEvent();\n }\n\n get cuttingPlaneFillColor(): RGB {\n return this._data.cuttingPlaneFillColor;\n }\n\n set cuttingPlaneFillColor(value: RGB) {\n this._data.cuttingPlaneFillColor = value;\n this.notifierChangeEvent();\n }\n\n get edgesColor() {\n return this._data.edgesColor;\n }\n\n set edgesColor(value) {\n this._data.edgesColor = value;\n this.notifierChangeEvent();\n }\n\n get facesColor() {\n return this._data.facesColor;\n }\n\n set facesColor(value) {\n this._data.facesColor = value;\n this.notifierChangeEvent();\n }\n\n get edgesVisibility() {\n return this._data.edgesVisibility;\n }\n\n set edgesVisibility(value) {\n this._data.edgesVisibility = value;\n this.notifierChangeEvent();\n }\n\n get edgesOverlap() {\n return this._data.edgesOverlap;\n }\n\n set edgesOverlap(value) {\n this._data.edgesOverlap = value;\n this.notifierChangeEvent();\n }\n\n get facesOverlap() {\n return this._data.facesOverlap;\n }\n\n set facesOverlap(value) {\n this._data.facesOverlap = value;\n this.notifierChangeEvent();\n }\n\n get facesTransparancy() {\n return this._data.facesTransparancy;\n }\n\n set facesTransparancy(value) {\n this._data.facesTransparancy = value;\n this.notifierChangeEvent();\n }\n\n get enableCustomHighlight() {\n return this._data.enableCustomHighlight;\n }\n\n set enableCustomHighlight(value) {\n this._data.enableCustomHighlight = value;\n this.notifierChangeEvent();\n }\n\n get sceneGraph() {\n return this._data.sceneGraph;\n }\n\n set sceneGraph(value) {\n this._data.sceneGraph = value;\n if (value) this._data.enablePartialMode = false;\n this.notifierChangeEvent();\n }\n\n get edgeModel() {\n return Boolean(this._data.edgeModel);\n }\n\n set edgeModel(value) {\n this._data.edgeModel = Boolean(value);\n this.notifierChangeEvent();\n }\n\n get reverseZoomWheel() {\n return this._data.reverseZoomWheel;\n }\n\n set reverseZoomWheel(value: boolean) {\n this._data.reverseZoomWheel = !!value;\n this.notifierChangeEvent();\n }\n\n get enableZoomWheel() {\n return this._data.enableZoomWheel;\n }\n\n set enableZoomWheel(value: boolean) {\n this._data.enableZoomWheel = !!value;\n this.notifierChangeEvent();\n }\n\n get enableGestures() {\n return this._data.enableGestures;\n }\n\n set enableGestures(value: boolean) {\n this._data.enableGestures = !!value;\n this.notifierChangeEvent();\n }\n\n get geometryType() {\n return this._data.geometryType;\n }\n\n set geometryType(value: string) {\n this._data.geometryType = value;\n this.notifierChangeEvent();\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2021, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nexport const CANVAS_EVENTS = [\n \"click\",\n \"dblclick\",\n \"mousedown\",\n \"mousemove\",\n \"mouseup\",\n \"mouseleave\",\n \"pointerdown\",\n \"pointermove\",\n \"pointerup\",\n \"pointerleave\",\n \"pointercancel\",\n \"wheel\",\n \"touchstart\",\n \"touchmove\",\n \"touchend\",\n \"touchcancel\",\n];\n"],"names":["Commands","constructor","this","_commands","Map","registerCommand","id","handler","description","thisArg","set","registerCommandAlias","alias","viewer","args","executeCommand","getCommand","get","getCommands","map","forEach","value","key","command","isDraggerCommand","draggers","includes","setActiveDragger","console","warn","undefined","result","apply","emit","type","data","commands","viewerType","Options","emitter","_emitter","_data","defaults","loadFromStorage","showWCS","cameraAnimation","antialiasing","groundShadow","shadows","cameraAxisXSpeed","cameraAxisYSpeed","ambientOcclusion","enableStreamingMode","enablePartialMode","memoryLimit","cuttingPlaneFillColor","red","green","blue","edgesColor","r","g","b","facesColor","edgesVisibility","edgesOverlap","facesOverlap","facesTransparancy","enableCustomHighlight","sceneGraph","edgeModel","reverseZoomWheel","enableZoomWheel","enableGestures","geometryType","notifierChangeEvent","saveToStorage","window","localStorage","setItem","JSON","stringify","error","item","getItem","parse","resetToDefaults","fields","resetData","reduce","acc","field","Boolean","CANVAS_EVENTS"],"mappings":"AA0BA,MAAMA;IAAN,WAAAC;QACmBC,KAAAC,YAAY,IAAIC;AAuClC;IArCC,e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AAIA,CAAarD;QACfnB,KAAKuC,MAAMiC,eAAerD;QAC1BnB,KAAKyE;AACN;;;ACtfU,MAAAkB,gBAAgB,EAC3B,SACA,YACA,aACA,aACA,WACA,cACA,eACA,eACA,aACA,gBACA,iBACA,SACA,cACA,aACA,YACA;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IViewer } from "../viewer/IViewer";
|
|
2
|
+
export interface ICommandService {
|
|
3
|
+
executeCommand(id: string, ...args: any[]): any;
|
|
4
|
+
}
|
|
5
|
+
export type ICommandsMap = Map<string, ICommand>;
|
|
6
|
+
export interface ICommandHandler {
|
|
7
|
+
(viewer: any, ...args: any[]): any;
|
|
8
|
+
}
|
|
9
|
+
export interface ICommand {
|
|
10
|
+
id: string;
|
|
11
|
+
handler: ICommandHandler;
|
|
12
|
+
thisArg?: any;
|
|
13
|
+
description?: ICommandDescription;
|
|
14
|
+
}
|
|
15
|
+
export interface ICommandDescription {
|
|
16
|
+
readonly description: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ICommands {
|
|
19
|
+
registerCommand(id: string, handler: ICommandHandler, description?: ICommandDescription, thisArg?: any): void;
|
|
20
|
+
registerCommandAlias(id: string, alias: string): void;
|
|
21
|
+
getCommands(): ICommandsMap;
|
|
22
|
+
getCommand(id: string): ICommand | undefined;
|
|
23
|
+
executeCommand(id: string, viewer: IViewer, ...args: any[]): any;
|
|
24
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./commands/Commands";
|
|
2
|
+
export * from "./commands/ICommands";
|
|
3
|
+
export * from "./options/Options";
|
|
4
|
+
export * from "./options/OptionsEvents";
|
|
5
|
+
export * from "./viewer/CanvasEvents";
|
|
6
|
+
export * from "./viewer/IViewer";
|
|
7
|
+
export * from "./viewer/IViewpoint";
|
|
8
|
+
export * from "./viewer/ViewerEvents";
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { EventEmitter2 } from "@inweb/eventemitter2";
|
|
2
|
+
export interface RGB {
|
|
3
|
+
red: number;
|
|
4
|
+
green: number;
|
|
5
|
+
blue: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* `VisualizeJS` parameters.
|
|
9
|
+
*/
|
|
10
|
+
export interface OptionsData {
|
|
11
|
+
/**
|
|
12
|
+
* Show WCS
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue true
|
|
15
|
+
*/
|
|
16
|
+
showWCS?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Enable camera animation
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue true
|
|
21
|
+
*/
|
|
22
|
+
cameraAnimation?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Enable antialiasing use FXAA
|
|
25
|
+
*
|
|
26
|
+
* @defaultValue true
|
|
27
|
+
*/
|
|
28
|
+
antialiasing?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Enable ground shadows
|
|
31
|
+
*
|
|
32
|
+
* @defaultValue false
|
|
33
|
+
*/
|
|
34
|
+
groundShadow?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Enable shadows
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue false
|
|
39
|
+
*/
|
|
40
|
+
shadows?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Camera speed on X axis
|
|
43
|
+
*
|
|
44
|
+
* @defaultValue 4
|
|
45
|
+
*/
|
|
46
|
+
cameraAxisXSpeed?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Camera speed on Y axis
|
|
49
|
+
*
|
|
50
|
+
* @defaultValue 1
|
|
51
|
+
*/
|
|
52
|
+
cameraAxisYSpeed?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Ambient occlusion
|
|
55
|
+
*
|
|
56
|
+
* @defaultValue false
|
|
57
|
+
*/
|
|
58
|
+
ambientOcclusion?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Enable streaming mode
|
|
61
|
+
*
|
|
62
|
+
* If enableStreamingMode is true then enablePartialMode will be used, otherwise -
|
|
63
|
+
* enablePartialMode will be ignored and file / assembly will be loaded in one go
|
|
64
|
+
*
|
|
65
|
+
* @defaultValue true
|
|
66
|
+
*/
|
|
67
|
+
enableStreamingMode?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Enable partial load mode to be able open large drawing If enablePartialMode enabled, then
|
|
70
|
+
* sceneGraph will be switched off
|
|
71
|
+
*
|
|
72
|
+
* @defaultValue false
|
|
73
|
+
*/
|
|
74
|
+
enablePartialMode?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* The size of the memory buffer that the Viewer can use for graphics data
|
|
77
|
+
*
|
|
78
|
+
* @defaultValue 3294967296
|
|
79
|
+
*/
|
|
80
|
+
memoryLimit?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Cutting plane fill color
|
|
83
|
+
*
|
|
84
|
+
* @defaultValue { red: 0xff, green: 0x98, blue: 0x00 }
|
|
85
|
+
*/
|
|
86
|
+
cuttingPlaneFillColor?: RGB;
|
|
87
|
+
/**
|
|
88
|
+
* Outline edges color in RGB format.
|
|
89
|
+
*/
|
|
90
|
+
edgesColor?: {
|
|
91
|
+
r: number;
|
|
92
|
+
g: number;
|
|
93
|
+
b: number;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Faces color in the RGB format.
|
|
97
|
+
*/
|
|
98
|
+
facesColor?: {
|
|
99
|
+
r: number;
|
|
100
|
+
g: number;
|
|
101
|
+
b: number;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Show or hide edges.
|
|
105
|
+
*/
|
|
106
|
+
edgesVisibility?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Show edges over drawing.
|
|
109
|
+
*/
|
|
110
|
+
edgesOverlap?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Show faces over drawing.
|
|
113
|
+
*/
|
|
114
|
+
facesOverlap?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Faces transparency value from 0 to 255.
|
|
117
|
+
*/
|
|
118
|
+
facesTransparancy?: number;
|
|
119
|
+
/**
|
|
120
|
+
* Enable custom highlight settings.
|
|
121
|
+
*/
|
|
122
|
+
enableCustomHighlight?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Enable or disable scene graph, it increases perfomance improvement, but consumes memory
|
|
125
|
+
* Large drawings can take up a lot of memory. If sceneGraph enabled, then enablePartialMode
|
|
126
|
+
* will be switched off
|
|
127
|
+
*/
|
|
128
|
+
sceneGraph: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Edge display models. No edges is usefull for less memory consumption: `false` - no edges
|
|
131
|
+
* are displayed, `true` - display isolines.
|
|
132
|
+
*/
|
|
133
|
+
edgeModel: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Reverse the mouse wheel direction for zooming: false - moving the wheel up zooms in,
|
|
136
|
+
* moving down zooms out, `true` - moving the wheel up zooms out, moving down zooms in.
|
|
137
|
+
*/
|
|
138
|
+
reverseZoomWheel: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Enable mouse wheel zooming.
|
|
141
|
+
*/
|
|
142
|
+
enableZoomWheel: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Enable touch gestures. This option will be ignored when enableZoomWheel is disabled, since
|
|
145
|
+
* gestures contains touch zoom.
|
|
146
|
+
*/
|
|
147
|
+
enableGestures: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Default file geometry data type. Can be one of:
|
|
150
|
+
*
|
|
151
|
+
* - `vsfx` - `VSFX` (default), for opening a file in `VisualizeJS` viewer.
|
|
152
|
+
* - `gltf` - `glTF`, for opening a file in `Three.js` viewer.
|
|
153
|
+
*/
|
|
154
|
+
geometryType?: string;
|
|
155
|
+
}
|
|
156
|
+
export declare class Options {
|
|
157
|
+
protected _emitter?: EventEmitter2;
|
|
158
|
+
protected _data: OptionsData;
|
|
159
|
+
constructor(emitter?: EventEmitter2);
|
|
160
|
+
static defaults(): OptionsData;
|
|
161
|
+
notifierChangeEvent(): void;
|
|
162
|
+
saveToStorage(): void;
|
|
163
|
+
loadFromStorage(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Reset options to default
|
|
166
|
+
*
|
|
167
|
+
* @param fields - Name of fields to be reset
|
|
168
|
+
*/
|
|
169
|
+
resetToDefaults(fields?: string[]): void;
|
|
170
|
+
get data(): OptionsData;
|
|
171
|
+
set data(value: OptionsData);
|
|
172
|
+
get showWCS(): boolean;
|
|
173
|
+
set showWCS(value: boolean);
|
|
174
|
+
get cameraAnimation(): boolean;
|
|
175
|
+
set cameraAnimation(value: boolean);
|
|
176
|
+
get antialiasing(): boolean;
|
|
177
|
+
set antialiasing(value: boolean);
|
|
178
|
+
get groundShadow(): boolean;
|
|
179
|
+
set groundShadow(value: boolean);
|
|
180
|
+
get shadows(): boolean;
|
|
181
|
+
set shadows(value: boolean);
|
|
182
|
+
get cameraAxisXSpeed(): number;
|
|
183
|
+
set cameraAxisXSpeed(value: number);
|
|
184
|
+
get cameraAxisYSpeed(): number;
|
|
185
|
+
set cameraAxisYSpeed(value: number);
|
|
186
|
+
get ambientOcclusion(): boolean;
|
|
187
|
+
set ambientOcclusion(value: boolean);
|
|
188
|
+
get enableStreamingMode(): boolean;
|
|
189
|
+
set enableStreamingMode(value: boolean);
|
|
190
|
+
get enablePartialMode(): boolean;
|
|
191
|
+
set enablePartialMode(value: boolean);
|
|
192
|
+
get memoryLimit(): number;
|
|
193
|
+
set memoryLimit(value: number);
|
|
194
|
+
get cuttingPlaneFillColor(): RGB;
|
|
195
|
+
set cuttingPlaneFillColor(value: RGB);
|
|
196
|
+
get edgesColor(): {
|
|
197
|
+
r: number;
|
|
198
|
+
g: number;
|
|
199
|
+
b: number;
|
|
200
|
+
};
|
|
201
|
+
set edgesColor(value: {
|
|
202
|
+
r: number;
|
|
203
|
+
g: number;
|
|
204
|
+
b: number;
|
|
205
|
+
});
|
|
206
|
+
get facesColor(): {
|
|
207
|
+
r: number;
|
|
208
|
+
g: number;
|
|
209
|
+
b: number;
|
|
210
|
+
};
|
|
211
|
+
set facesColor(value: {
|
|
212
|
+
r: number;
|
|
213
|
+
g: number;
|
|
214
|
+
b: number;
|
|
215
|
+
});
|
|
216
|
+
get edgesVisibility(): boolean;
|
|
217
|
+
set edgesVisibility(value: boolean);
|
|
218
|
+
get edgesOverlap(): boolean;
|
|
219
|
+
set edgesOverlap(value: boolean);
|
|
220
|
+
get facesOverlap(): boolean;
|
|
221
|
+
set facesOverlap(value: boolean);
|
|
222
|
+
get facesTransparancy(): number;
|
|
223
|
+
set facesTransparancy(value: number);
|
|
224
|
+
get enableCustomHighlight(): boolean;
|
|
225
|
+
set enableCustomHighlight(value: boolean);
|
|
226
|
+
get sceneGraph(): boolean;
|
|
227
|
+
set sceneGraph(value: boolean);
|
|
228
|
+
get edgeModel(): boolean;
|
|
229
|
+
set edgeModel(value: boolean);
|
|
230
|
+
get reverseZoomWheel(): boolean;
|
|
231
|
+
set reverseZoomWheel(value: boolean);
|
|
232
|
+
get enableZoomWheel(): boolean;
|
|
233
|
+
set enableZoomWheel(value: boolean);
|
|
234
|
+
get enableGestures(): boolean;
|
|
235
|
+
set enableGestures(value: boolean);
|
|
236
|
+
get geometryType(): string;
|
|
237
|
+
set geometryType(value: string);
|
|
238
|
+
}
|