@inweb/viewer-three 25.3.18 → 25.3.20
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/viewer-three.js +96 -80
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +2 -2
- package/dist/viewer-three.module.js +93 -81
- package/dist/viewer-three.module.js.map +1 -1
- package/lib/Viewer/Viewer.d.ts +2 -2
- package/lib/index.d.ts +1 -1
- package/package.json +4 -4
- package/src/Viewer/Viewer.ts +8 -7
- package/src/Viewer/components/BackgroundComponent.ts +1 -1
- package/src/Viewer/components/DefaultCameraPositionComponent.ts +1 -1
- package/src/Viewer/components/LightComponent.ts +1 -1
- package/src/Viewer/components/ObjectSelectionComponent.ts +1 -1
- package/src/Viewer/components/RenderLoopComponent.ts +2 -2
- package/src/Viewer/draggers/ClippingPlaneDragger.ts +4 -4
- package/src/Viewer/draggers/OrbitDragger.ts +1 -1
- package/src/Viewer/draggers/WalkDragger.ts +1 -1
- package/src/Viewer/loaders/GLTFLoadingManager.ts +1 -1
- package/src/index.ts +1 -1
package/dist/viewer-three.js
CHANGED
|
@@ -65,54 +65,62 @@
|
|
|
65
65
|
|
|
66
66
|
commands("ThreeJS").registerCommand("noop", (() => {}));
|
|
67
67
|
|
|
68
|
+
function defaultOptions() {
|
|
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
|
+
|
|
68
110
|
class Options {
|
|
69
111
|
constructor(emitter) {
|
|
70
112
|
this._emitter = emitter;
|
|
71
|
-
this._data =
|
|
113
|
+
this._data = defaultOptions();
|
|
72
114
|
this.loadFromStorage();
|
|
73
115
|
}
|
|
74
116
|
static defaults() {
|
|
75
|
-
return
|
|
76
|
-
showWCS: true,
|
|
77
|
-
cameraAnimation: true,
|
|
78
|
-
antialiasing: true,
|
|
79
|
-
groundShadow: false,
|
|
80
|
-
shadows: false,
|
|
81
|
-
cameraAxisXSpeed: 4,
|
|
82
|
-
cameraAxisYSpeed: 1,
|
|
83
|
-
ambientOcclusion: false,
|
|
84
|
-
enableStreamingMode: true,
|
|
85
|
-
enablePartialMode: false,
|
|
86
|
-
memoryLimit: 3294967296,
|
|
87
|
-
cuttingPlaneFillColor: {
|
|
88
|
-
red: 255,
|
|
89
|
-
green: 152,
|
|
90
|
-
blue: 0
|
|
91
|
-
},
|
|
92
|
-
edgesColor: {
|
|
93
|
-
r: 255,
|
|
94
|
-
g: 152,
|
|
95
|
-
b: 0
|
|
96
|
-
},
|
|
97
|
-
facesColor: {
|
|
98
|
-
r: 255,
|
|
99
|
-
g: 152,
|
|
100
|
-
b: 0
|
|
101
|
-
},
|
|
102
|
-
edgesVisibility: true,
|
|
103
|
-
edgesOverlap: true,
|
|
104
|
-
facesOverlap: false,
|
|
105
|
-
facesTransparancy: 200,
|
|
106
|
-
enableCustomHighlight: true,
|
|
107
|
-
sceneGraph: false,
|
|
108
|
-
edgeModel: true,
|
|
109
|
-
reverseZoomWheel: false,
|
|
110
|
-
enableZoomWheel: true,
|
|
111
|
-
enableGestures: true,
|
|
112
|
-
geometryType: "vsfx"
|
|
113
|
-
};
|
|
117
|
+
return defaultOptions();
|
|
114
118
|
}
|
|
115
119
|
notifierChangeEvent() {
|
|
120
|
+
console.warn("Options.notifierChangeEvent() has been deprecated since 25.3 and will be removed in a future release, use Options.change() instead.");
|
|
121
|
+
this.change();
|
|
122
|
+
}
|
|
123
|
+
change() {
|
|
116
124
|
if (this._emitter !== undefined) {
|
|
117
125
|
this.saveToStorage();
|
|
118
126
|
this._emitter.emit({
|
|
@@ -163,151 +171,154 @@
|
|
|
163
171
|
return this._data;
|
|
164
172
|
}
|
|
165
173
|
set data(value) {
|
|
166
|
-
const
|
|
174
|
+
const enablePartialMode = value.enableStreamingMode ? value.enablePartialMode : false;
|
|
175
|
+
const sceneGraph = enablePartialMode ? false : value.sceneGraph;
|
|
167
176
|
this._data = {
|
|
168
177
|
...Options.defaults(),
|
|
169
178
|
...this._data,
|
|
170
179
|
...value,
|
|
180
|
+
enablePartialMode: enablePartialMode,
|
|
171
181
|
sceneGraph: sceneGraph
|
|
172
182
|
};
|
|
173
|
-
this.
|
|
183
|
+
this.change();
|
|
174
184
|
}
|
|
175
185
|
get showWCS() {
|
|
176
186
|
return this._data.showWCS;
|
|
177
187
|
}
|
|
178
188
|
set showWCS(value) {
|
|
179
189
|
this._data.showWCS = value;
|
|
180
|
-
this.
|
|
190
|
+
this.change();
|
|
181
191
|
}
|
|
182
192
|
get cameraAnimation() {
|
|
183
193
|
return this._data.cameraAnimation;
|
|
184
194
|
}
|
|
185
195
|
set cameraAnimation(value) {
|
|
186
196
|
this._data.cameraAnimation = value;
|
|
187
|
-
this.
|
|
197
|
+
this.change();
|
|
188
198
|
}
|
|
189
199
|
get antialiasing() {
|
|
190
200
|
return this._data.antialiasing;
|
|
191
201
|
}
|
|
192
202
|
set antialiasing(value) {
|
|
193
203
|
this._data.antialiasing = value;
|
|
194
|
-
this.
|
|
204
|
+
this.change();
|
|
195
205
|
}
|
|
196
206
|
get groundShadow() {
|
|
197
207
|
return this._data.groundShadow;
|
|
198
208
|
}
|
|
199
209
|
set groundShadow(value) {
|
|
200
210
|
this._data.groundShadow = value;
|
|
201
|
-
this.
|
|
211
|
+
this.change();
|
|
202
212
|
}
|
|
203
213
|
get shadows() {
|
|
204
214
|
return this._data.shadows;
|
|
205
215
|
}
|
|
206
216
|
set shadows(value) {
|
|
207
217
|
this._data.shadows = value;
|
|
208
|
-
this.
|
|
218
|
+
this.change();
|
|
209
219
|
}
|
|
210
220
|
get cameraAxisXSpeed() {
|
|
211
221
|
return this._data.cameraAxisXSpeed;
|
|
212
222
|
}
|
|
213
223
|
set cameraAxisXSpeed(value) {
|
|
214
224
|
this._data.cameraAxisXSpeed = value;
|
|
215
|
-
this.
|
|
225
|
+
this.change();
|
|
216
226
|
}
|
|
217
227
|
get cameraAxisYSpeed() {
|
|
218
228
|
return this._data.cameraAxisYSpeed;
|
|
219
229
|
}
|
|
220
230
|
set cameraAxisYSpeed(value) {
|
|
221
231
|
this.cameraAxisYSpeed = value;
|
|
222
|
-
this.
|
|
232
|
+
this.change();
|
|
223
233
|
}
|
|
224
234
|
get ambientOcclusion() {
|
|
225
235
|
return this._data.ambientOcclusion;
|
|
226
236
|
}
|
|
227
237
|
set ambientOcclusion(value) {
|
|
228
238
|
this._data.ambientOcclusion = value;
|
|
229
|
-
this.
|
|
239
|
+
this.change();
|
|
230
240
|
}
|
|
231
241
|
get enableStreamingMode() {
|
|
232
242
|
return this._data.enableStreamingMode;
|
|
233
243
|
}
|
|
234
244
|
set enableStreamingMode(value) {
|
|
235
245
|
this._data.enableStreamingMode = value;
|
|
236
|
-
if (this._data.
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
this.notifierChangeEvent();
|
|
246
|
+
if (!value) this._data.enablePartialMode = false;
|
|
247
|
+
this.change();
|
|
240
248
|
}
|
|
241
249
|
get enablePartialMode() {
|
|
242
250
|
return this._data.enablePartialMode;
|
|
243
251
|
}
|
|
244
252
|
set enablePartialMode(value) {
|
|
245
253
|
this._data.enablePartialMode = value;
|
|
246
|
-
if (value)
|
|
247
|
-
|
|
254
|
+
if (value) {
|
|
255
|
+
this._data.enableStreamingMode = true;
|
|
256
|
+
this._data.sceneGraph = false;
|
|
257
|
+
}
|
|
258
|
+
this.change();
|
|
248
259
|
}
|
|
249
260
|
get memoryLimit() {
|
|
250
261
|
return this._data.memoryLimit;
|
|
251
262
|
}
|
|
252
263
|
set memoryLimit(value) {
|
|
253
264
|
this._data.memoryLimit = value;
|
|
254
|
-
this.
|
|
265
|
+
this.change();
|
|
255
266
|
}
|
|
256
267
|
get cuttingPlaneFillColor() {
|
|
257
268
|
return this._data.cuttingPlaneFillColor;
|
|
258
269
|
}
|
|
259
270
|
set cuttingPlaneFillColor(value) {
|
|
260
271
|
this._data.cuttingPlaneFillColor = value;
|
|
261
|
-
this.
|
|
272
|
+
this.change();
|
|
262
273
|
}
|
|
263
274
|
get edgesColor() {
|
|
264
275
|
return this._data.edgesColor;
|
|
265
276
|
}
|
|
266
277
|
set edgesColor(value) {
|
|
267
278
|
this._data.edgesColor = value;
|
|
268
|
-
this.
|
|
279
|
+
this.change();
|
|
269
280
|
}
|
|
270
281
|
get facesColor() {
|
|
271
282
|
return this._data.facesColor;
|
|
272
283
|
}
|
|
273
284
|
set facesColor(value) {
|
|
274
285
|
this._data.facesColor = value;
|
|
275
|
-
this.
|
|
286
|
+
this.change();
|
|
276
287
|
}
|
|
277
288
|
get edgesVisibility() {
|
|
278
289
|
return this._data.edgesVisibility;
|
|
279
290
|
}
|
|
280
291
|
set edgesVisibility(value) {
|
|
281
292
|
this._data.edgesVisibility = value;
|
|
282
|
-
this.
|
|
293
|
+
this.change();
|
|
283
294
|
}
|
|
284
295
|
get edgesOverlap() {
|
|
285
296
|
return this._data.edgesOverlap;
|
|
286
297
|
}
|
|
287
298
|
set edgesOverlap(value) {
|
|
288
299
|
this._data.edgesOverlap = value;
|
|
289
|
-
this.
|
|
300
|
+
this.change();
|
|
290
301
|
}
|
|
291
302
|
get facesOverlap() {
|
|
292
303
|
return this._data.facesOverlap;
|
|
293
304
|
}
|
|
294
305
|
set facesOverlap(value) {
|
|
295
306
|
this._data.facesOverlap = value;
|
|
296
|
-
this.
|
|
307
|
+
this.change();
|
|
297
308
|
}
|
|
298
309
|
get facesTransparancy() {
|
|
299
310
|
return this._data.facesTransparancy;
|
|
300
311
|
}
|
|
301
312
|
set facesTransparancy(value) {
|
|
302
313
|
this._data.facesTransparancy = value;
|
|
303
|
-
this.
|
|
314
|
+
this.change();
|
|
304
315
|
}
|
|
305
316
|
get enableCustomHighlight() {
|
|
306
317
|
return this._data.enableCustomHighlight;
|
|
307
318
|
}
|
|
308
319
|
set enableCustomHighlight(value) {
|
|
309
320
|
this._data.enableCustomHighlight = value;
|
|
310
|
-
this.
|
|
321
|
+
this.change();
|
|
311
322
|
}
|
|
312
323
|
get sceneGraph() {
|
|
313
324
|
return this._data.sceneGraph;
|
|
@@ -315,42 +326,42 @@
|
|
|
315
326
|
set sceneGraph(value) {
|
|
316
327
|
this._data.sceneGraph = value;
|
|
317
328
|
if (value) this._data.enablePartialMode = false;
|
|
318
|
-
this.
|
|
329
|
+
this.change();
|
|
319
330
|
}
|
|
320
331
|
get edgeModel() {
|
|
321
332
|
return Boolean(this._data.edgeModel);
|
|
322
333
|
}
|
|
323
334
|
set edgeModel(value) {
|
|
324
335
|
this._data.edgeModel = Boolean(value);
|
|
325
|
-
this.
|
|
336
|
+
this.change();
|
|
326
337
|
}
|
|
327
338
|
get reverseZoomWheel() {
|
|
328
339
|
return this._data.reverseZoomWheel;
|
|
329
340
|
}
|
|
330
341
|
set reverseZoomWheel(value) {
|
|
331
342
|
this._data.reverseZoomWheel = !!value;
|
|
332
|
-
this.
|
|
343
|
+
this.change();
|
|
333
344
|
}
|
|
334
345
|
get enableZoomWheel() {
|
|
335
346
|
return this._data.enableZoomWheel;
|
|
336
347
|
}
|
|
337
348
|
set enableZoomWheel(value) {
|
|
338
349
|
this._data.enableZoomWheel = !!value;
|
|
339
|
-
this.
|
|
350
|
+
this.change();
|
|
340
351
|
}
|
|
341
352
|
get enableGestures() {
|
|
342
353
|
return this._data.enableGestures;
|
|
343
354
|
}
|
|
344
355
|
set enableGestures(value) {
|
|
345
356
|
this._data.enableGestures = !!value;
|
|
346
|
-
this.
|
|
357
|
+
this.change();
|
|
347
358
|
}
|
|
348
359
|
get geometryType() {
|
|
349
360
|
return this._data.geometryType;
|
|
350
361
|
}
|
|
351
362
|
set geometryType(value) {
|
|
352
363
|
this._data.geometryType = value;
|
|
353
|
-
this.
|
|
364
|
+
this.change();
|
|
354
365
|
}
|
|
355
366
|
}
|
|
356
367
|
|
|
@@ -358,27 +369,24 @@
|
|
|
358
369
|
|
|
359
370
|
class EventEmitter2 {
|
|
360
371
|
constructor() {
|
|
361
|
-
this._listeners =
|
|
372
|
+
this._listeners = {};
|
|
362
373
|
}
|
|
363
374
|
addEventListener(type, listener) {
|
|
364
|
-
if (this._listeners === undefined) this._listeners = {};
|
|
365
375
|
if (this._listeners[type] === undefined) this._listeners[type] = [];
|
|
366
376
|
this._listeners[type].push(listener);
|
|
367
377
|
return this;
|
|
368
378
|
}
|
|
369
379
|
removeEventListener(type, listener) {
|
|
370
|
-
if (this._listeners === undefined) return this;
|
|
371
380
|
if (this._listeners[type] === undefined) return this;
|
|
372
381
|
const listeners = this._listeners[type].filter((x => x !== listener));
|
|
373
|
-
this._listeners[type] = listeners
|
|
382
|
+
if (listeners.length !== 0) this._listeners[type] = listeners; else delete this._listeners[type];
|
|
374
383
|
return this;
|
|
375
384
|
}
|
|
376
385
|
removeAllListeners(type) {
|
|
377
|
-
if (type) this._listeners[type]
|
|
386
|
+
if (type) delete this._listeners[type]; else this._listeners = {};
|
|
378
387
|
return this;
|
|
379
388
|
}
|
|
380
389
|
emitEvent(event) {
|
|
381
|
-
if (this._listeners === undefined) return false;
|
|
382
390
|
if (this._listeners[event.type] === undefined) return false;
|
|
383
391
|
const invoke = this._listeners[event.type].slice();
|
|
384
392
|
invoke.forEach((listener => listener.call(this, event)));
|
|
@@ -42593,6 +42601,7 @@
|
|
|
42593
42601
|
///////////////////////////////////////////////////////////////////////////////
|
|
42594
42602
|
class RenderLoopComponent {
|
|
42595
42603
|
constructor(viewer) {
|
|
42604
|
+
this.requestID = 0;
|
|
42596
42605
|
this.animate = (time = 0) => {
|
|
42597
42606
|
this.requestID = requestAnimationFrame(this.animate);
|
|
42598
42607
|
this.viewer.render(time);
|
|
@@ -42610,6 +42619,7 @@
|
|
|
42610
42619
|
class Viewer extends EventEmitter2 {
|
|
42611
42620
|
constructor(client) {
|
|
42612
42621
|
super();
|
|
42622
|
+
this.renderNeeded = false;
|
|
42613
42623
|
this._options = new Options(this);
|
|
42614
42624
|
this.client = client;
|
|
42615
42625
|
this.canvasEvents = CANVAS_EVENTS;
|
|
@@ -42655,7 +42665,7 @@
|
|
|
42655
42665
|
this.components.push(new ResizeCanvasComponent(this));
|
|
42656
42666
|
this.components.push(new RenderLoopComponent(this));
|
|
42657
42667
|
// this.components.push(new ObjectSelectionComponent(this as any));
|
|
42658
|
-
this.
|
|
42668
|
+
this.syncOptions();
|
|
42659
42669
|
this.renderTime = performance.now();
|
|
42660
42670
|
this.render(this.renderTime);
|
|
42661
42671
|
if (typeof onProgress === "function")
|
|
@@ -42688,6 +42698,10 @@
|
|
|
42688
42698
|
return;
|
|
42689
42699
|
if (!this.renderer)
|
|
42690
42700
|
return;
|
|
42701
|
+
if (!this.scene)
|
|
42702
|
+
return;
|
|
42703
|
+
if (!this.camera)
|
|
42704
|
+
return;
|
|
42691
42705
|
this.renderer.render(this.scene, this.camera);
|
|
42692
42706
|
this.renderNeeded = false;
|
|
42693
42707
|
const deltaTime = (time - this.renderTime) / 1000;
|
|
@@ -42700,7 +42714,7 @@
|
|
|
42700
42714
|
this.render(performance.now());
|
|
42701
42715
|
this.emitEvent({ type: "update", data: force });
|
|
42702
42716
|
}
|
|
42703
|
-
syncOptions(options = this.options
|
|
42717
|
+
syncOptions(options = this.options) {
|
|
42704
42718
|
// this.update();
|
|
42705
42719
|
}
|
|
42706
42720
|
loadReferences(model) {
|
|
@@ -42713,7 +42727,7 @@
|
|
|
42713
42727
|
this.cancel();
|
|
42714
42728
|
this.clear();
|
|
42715
42729
|
this.emitEvent({ type: "open", file, model: file });
|
|
42716
|
-
let model;
|
|
42730
|
+
let model = undefined;
|
|
42717
42731
|
if (file) {
|
|
42718
42732
|
const models = (await file.getModels()) || [];
|
|
42719
42733
|
model = models.find((model) => model.default) || models[0];
|
|
@@ -42832,9 +42846,11 @@
|
|
|
42832
42846
|
}
|
|
42833
42847
|
}
|
|
42834
42848
|
|
|
42849
|
+
exports.CANVAS_EVENTS = CANVAS_EVENTS;
|
|
42835
42850
|
exports.Options = Options;
|
|
42836
42851
|
exports.Viewer = Viewer;
|
|
42837
42852
|
exports.commands = commands;
|
|
42853
|
+
exports.defaultOptions = defaultOptions;
|
|
42838
42854
|
|
|
42839
42855
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
42840
42856
|
|