@xeokit/xeokit-sdk 2.6.40 → 2.6.41
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/web-ifc.wasm +0 -0
- package/dist/xeokit-sdk.cjs.js +147 -120
- package/dist/xeokit-sdk.es.js +143 -121
- package/dist/xeokit-sdk.es5.js +15 -9
- package/dist/xeokit-sdk.min.cjs.js +3 -3
- package/dist/xeokit-sdk.min.es.js +5 -5
- package/dist/xeokit-sdk.min.es5.js +4 -4
- package/package.json +1 -1
- package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +2 -0
- package/src/plugins/ZonesPlugin/ZonesPlugin.js +0 -116
- package/src/plugins/index.js +1 -0
- package/src/plugins/lib/ui/index.js +116 -0
- package/src/viewer/scene/model/SceneModel.js +15 -1
package/package.json
CHANGED
|
@@ -701,6 +701,8 @@ export class TreeViewPlugin extends Plugin {
|
|
|
701
701
|
return; // Node may not exist for the given object if (this._pruneEmptyNodes == true)
|
|
702
702
|
}
|
|
703
703
|
|
|
704
|
+
this.collapse();
|
|
705
|
+
|
|
704
706
|
const nodeId = node.nodeId;
|
|
705
707
|
|
|
706
708
|
const switchElement = this._renderService.getSwitchElement(nodeId);
|
|
@@ -408,122 +408,6 @@ const mousePointSelector = function(viewer, ray2WorldPos) {
|
|
|
408
408
|
};
|
|
409
409
|
};
|
|
410
410
|
|
|
411
|
-
const touchPointSelector = function(viewer, pointerCircle, ray2WorldPos) {
|
|
412
|
-
return function(onCancel, onChange, onCommit) {
|
|
413
|
-
const scene = viewer.scene;
|
|
414
|
-
const canvas = scene.canvas.canvas;
|
|
415
|
-
const longTouchTimeoutMs = 300;
|
|
416
|
-
const moveTolerance = 20;
|
|
417
|
-
|
|
418
|
-
const copyCanvasPos = (event, vec2) => {
|
|
419
|
-
vec2[0] = event.clientX;
|
|
420
|
-
vec2[1] = event.clientY;
|
|
421
|
-
transformToNode(canvas.ownerDocument.documentElement, canvas, vec2);
|
|
422
|
-
return vec2;
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
const pickWorldPos = canvasPos => {
|
|
426
|
-
const origin = math.vec3();
|
|
427
|
-
const direction = math.vec3();
|
|
428
|
-
math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, scene.camera.projection, canvasPos, origin, direction);
|
|
429
|
-
return ray2WorldPos(origin, direction);
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
let longTouchTimeout = null;
|
|
433
|
-
const nop = () => { };
|
|
434
|
-
let onSingleTouchMove = nop;
|
|
435
|
-
let startTouchIdentifier;
|
|
436
|
-
|
|
437
|
-
const resetAction = function() {
|
|
438
|
-
pointerCircle.stop();
|
|
439
|
-
clearTimeout(longTouchTimeout);
|
|
440
|
-
viewer.cameraControl.active = true;
|
|
441
|
-
onSingleTouchMove = nop;
|
|
442
|
-
startTouchIdentifier = null;
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
const cleanup = function() {
|
|
446
|
-
resetAction();
|
|
447
|
-
canvas.removeEventListener("touchstart", onCanvasTouchStart);
|
|
448
|
-
canvas.removeEventListener("touchmove", onCanvasTouchMove);
|
|
449
|
-
canvas.removeEventListener("touchend", onCanvasTouchEnd);
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
const onCanvasTouchStart = function(event) {
|
|
453
|
-
const touches = event.touches;
|
|
454
|
-
|
|
455
|
-
if (touches.length !== 1)
|
|
456
|
-
{
|
|
457
|
-
resetAction();
|
|
458
|
-
onCancel();
|
|
459
|
-
}
|
|
460
|
-
else
|
|
461
|
-
{
|
|
462
|
-
const startTouch = touches[0];
|
|
463
|
-
const startCanvasPos = copyCanvasPos(startTouch, math.vec2());
|
|
464
|
-
|
|
465
|
-
const startWorldPos = pickWorldPos(startCanvasPos);
|
|
466
|
-
if (startWorldPos)
|
|
467
|
-
{
|
|
468
|
-
startTouchIdentifier = startTouch.identifier;
|
|
469
|
-
|
|
470
|
-
onSingleTouchMove = canvasPos => {
|
|
471
|
-
if (math.distVec2(startCanvasPos, canvasPos) > moveTolerance)
|
|
472
|
-
{
|
|
473
|
-
resetAction();
|
|
474
|
-
}
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
longTouchTimeout = setTimeout(
|
|
478
|
-
function() {
|
|
479
|
-
pointerCircle.start(startCanvasPos);
|
|
480
|
-
|
|
481
|
-
longTouchTimeout = setTimeout(
|
|
482
|
-
function() {
|
|
483
|
-
pointerCircle.stop();
|
|
484
|
-
|
|
485
|
-
viewer.cameraControl.active = false;
|
|
486
|
-
|
|
487
|
-
onSingleTouchMove = canvasPos => {
|
|
488
|
-
onChange(canvasPos, pickWorldPos(canvasPos));
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
onSingleTouchMove(startCanvasPos);
|
|
492
|
-
},
|
|
493
|
-
longTouchTimeoutMs);
|
|
494
|
-
},
|
|
495
|
-
250);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
};
|
|
499
|
-
canvas.addEventListener("touchstart", onCanvasTouchStart, {passive: true});
|
|
500
|
-
|
|
501
|
-
// canvas.addEventListener("touchcancel", e => console.log("touchcancel", e), {passive: true});
|
|
502
|
-
|
|
503
|
-
const onCanvasTouchMove = function(event) {
|
|
504
|
-
const touch = [...event.changedTouches].find(e => e.identifier === startTouchIdentifier);
|
|
505
|
-
if (touch)
|
|
506
|
-
{
|
|
507
|
-
onSingleTouchMove(copyCanvasPos(touch, math.vec2()));
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
canvas.addEventListener("touchmove", onCanvasTouchMove, {passive: true});
|
|
511
|
-
|
|
512
|
-
const onCanvasTouchEnd = function(event) {
|
|
513
|
-
const touch = [...event.changedTouches].find(e => e.identifier === startTouchIdentifier);
|
|
514
|
-
if (touch)
|
|
515
|
-
{
|
|
516
|
-
cleanup();
|
|
517
|
-
const canvasPos = copyCanvasPos(touch, math.vec2());
|
|
518
|
-
onCommit(canvasPos, pickWorldPos(canvasPos));
|
|
519
|
-
}
|
|
520
|
-
};
|
|
521
|
-
canvas.addEventListener("touchend", onCanvasTouchEnd, {passive: true});
|
|
522
|
-
|
|
523
|
-
return cleanup;
|
|
524
|
-
};
|
|
525
|
-
};
|
|
526
|
-
|
|
527
411
|
const planeIntersect = function(p0, n, origin, direction) {
|
|
528
412
|
const t = - (math.dotVec3(origin, n) - p0) / math.dotVec3(direction, n);
|
|
529
413
|
if (false) // (t < 0)
|
package/src/plugins/index.js
CHANGED
|
@@ -284,3 +284,119 @@ export function activateDraggableDots(cfg) {
|
|
|
284
284
|
updatePointerLens(null);
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
|
+
|
|
288
|
+
export const touchPointSelector = function(viewer, pointerCircle, ray2WorldPos) {
|
|
289
|
+
return function(onCancel, onChange, onCommit) {
|
|
290
|
+
const scene = viewer.scene;
|
|
291
|
+
const canvas = scene.canvas.canvas;
|
|
292
|
+
const longTouchTimeoutMs = 300;
|
|
293
|
+
const moveTolerance = 20;
|
|
294
|
+
|
|
295
|
+
const copyCanvasPos = (event, vec2) => {
|
|
296
|
+
vec2[0] = event.clientX;
|
|
297
|
+
vec2[1] = event.clientY;
|
|
298
|
+
transformToNode(canvas.ownerDocument.documentElement, canvas, vec2);
|
|
299
|
+
return vec2;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
const pickWorldPos = canvasPos => {
|
|
303
|
+
const origin = math.vec3();
|
|
304
|
+
const direction = math.vec3();
|
|
305
|
+
math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, scene.camera.projection, canvasPos, origin, direction);
|
|
306
|
+
return ray2WorldPos(origin, direction);
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
let longTouchTimeout = null;
|
|
310
|
+
const nop = () => { };
|
|
311
|
+
let onSingleTouchMove = nop;
|
|
312
|
+
let startTouchIdentifier;
|
|
313
|
+
|
|
314
|
+
const resetAction = function() {
|
|
315
|
+
pointerCircle.stop();
|
|
316
|
+
clearTimeout(longTouchTimeout);
|
|
317
|
+
viewer.cameraControl.active = true;
|
|
318
|
+
onSingleTouchMove = nop;
|
|
319
|
+
startTouchIdentifier = null;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
const cleanup = function() {
|
|
323
|
+
resetAction();
|
|
324
|
+
canvas.removeEventListener("touchstart", onCanvasTouchStart);
|
|
325
|
+
canvas.removeEventListener("touchmove", onCanvasTouchMove);
|
|
326
|
+
canvas.removeEventListener("touchend", onCanvasTouchEnd);
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
const onCanvasTouchStart = function(event) {
|
|
330
|
+
const touches = event.touches;
|
|
331
|
+
|
|
332
|
+
if (touches.length !== 1)
|
|
333
|
+
{
|
|
334
|
+
resetAction();
|
|
335
|
+
onCancel();
|
|
336
|
+
}
|
|
337
|
+
else
|
|
338
|
+
{
|
|
339
|
+
const startTouch = touches[0];
|
|
340
|
+
const startCanvasPos = copyCanvasPos(startTouch, math.vec2());
|
|
341
|
+
|
|
342
|
+
const startWorldPos = pickWorldPos(startCanvasPos);
|
|
343
|
+
if (startWorldPos)
|
|
344
|
+
{
|
|
345
|
+
startTouchIdentifier = startTouch.identifier;
|
|
346
|
+
|
|
347
|
+
onSingleTouchMove = canvasPos => {
|
|
348
|
+
if (math.distVec2(startCanvasPos, canvasPos) > moveTolerance)
|
|
349
|
+
{
|
|
350
|
+
resetAction();
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
longTouchTimeout = setTimeout(
|
|
355
|
+
function() {
|
|
356
|
+
pointerCircle.start(startCanvasPos);
|
|
357
|
+
|
|
358
|
+
longTouchTimeout = setTimeout(
|
|
359
|
+
function() {
|
|
360
|
+
pointerCircle.stop();
|
|
361
|
+
|
|
362
|
+
viewer.cameraControl.active = false;
|
|
363
|
+
|
|
364
|
+
onSingleTouchMove = canvasPos => {
|
|
365
|
+
onChange(canvasPos, pickWorldPos(canvasPos));
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
onSingleTouchMove(startCanvasPos);
|
|
369
|
+
},
|
|
370
|
+
longTouchTimeoutMs);
|
|
371
|
+
},
|
|
372
|
+
250);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
canvas.addEventListener("touchstart", onCanvasTouchStart, {passive: true});
|
|
377
|
+
|
|
378
|
+
// canvas.addEventListener("touchcancel", e => console.log("touchcancel", e), {passive: true});
|
|
379
|
+
|
|
380
|
+
const onCanvasTouchMove = function(event) {
|
|
381
|
+
const touch = [...event.changedTouches].find(e => e.identifier === startTouchIdentifier);
|
|
382
|
+
if (touch)
|
|
383
|
+
{
|
|
384
|
+
onSingleTouchMove(copyCanvasPos(touch, math.vec2()));
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
canvas.addEventListener("touchmove", onCanvasTouchMove, {passive: true});
|
|
388
|
+
|
|
389
|
+
const onCanvasTouchEnd = function(event) {
|
|
390
|
+
const touch = [...event.changedTouches].find(e => e.identifier === startTouchIdentifier);
|
|
391
|
+
if (touch)
|
|
392
|
+
{
|
|
393
|
+
cleanup();
|
|
394
|
+
const canvasPos = copyCanvasPos(touch, math.vec2());
|
|
395
|
+
onCommit(canvasPos, pickWorldPos(canvasPos));
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
canvas.addEventListener("touchend", onCanvasTouchEnd, {passive: true});
|
|
399
|
+
|
|
400
|
+
return cleanup;
|
|
401
|
+
};
|
|
402
|
+
};
|
|
@@ -2505,7 +2505,21 @@ export class SceneModel extends Component {
|
|
|
2505
2505
|
if (cfg.image) { // Ignore transcoder for Images
|
|
2506
2506
|
const image = cfg.image;
|
|
2507
2507
|
image.crossOrigin = "Anonymous";
|
|
2508
|
-
|
|
2508
|
+
if (image.compressed) {
|
|
2509
|
+
// see `parsedImage` in @loaders.gl/gltf/src/lib/parsers/parse-gltf.ts
|
|
2510
|
+
// NOTE: @loaders.gl in its current version discards potential mipmaps, leaving only a single one
|
|
2511
|
+
const data = image.data;
|
|
2512
|
+
texture.setCompressedData({
|
|
2513
|
+
mipmaps: data,
|
|
2514
|
+
props: {
|
|
2515
|
+
format: data[0].format,
|
|
2516
|
+
minFilter: minFilter,
|
|
2517
|
+
magFilter: magFilter
|
|
2518
|
+
}
|
|
2519
|
+
});
|
|
2520
|
+
} else {
|
|
2521
|
+
texture.setImage(image, {minFilter, magFilter, wrapS, wrapT, wrapR, flipY: cfg.flipY, encoding});
|
|
2522
|
+
}
|
|
2509
2523
|
} else if (cfg.src) {
|
|
2510
2524
|
const ext = cfg.src.split('.').pop();
|
|
2511
2525
|
switch (ext) { // Don't transcode recognized image file types
|