@xeokit/xeokit-sdk 2.4.0-alpha-30 → 2.4.0-alpha-32
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/xeokit-sdk.cjs.js
CHANGED
|
@@ -113409,6 +113409,9 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113409
113409
|
const camera = this._viewer.camera;
|
|
113410
113410
|
const scene = this._viewer.scene;
|
|
113411
113411
|
|
|
113412
|
+
let deltaUpdate = 0;
|
|
113413
|
+
let waitForTick = false;
|
|
113414
|
+
|
|
113412
113415
|
{ // Keep gizmo screen size constant
|
|
113413
113416
|
|
|
113414
113417
|
const tempVec3a = math.vec3([0, 0, 0]);
|
|
@@ -113422,6 +113425,7 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113422
113425
|
|
|
113423
113426
|
this._onSceneTick = scene.on("tick", () => {
|
|
113424
113427
|
|
|
113428
|
+
waitForTick = false;
|
|
113425
113429
|
const dist = Math.abs(math.lenVec3(math.subVec3(scene.camera.eye, this._pos, tempVec3a)));
|
|
113426
113430
|
|
|
113427
113431
|
if (dist !== lastDist) {
|
|
@@ -113439,6 +113443,11 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113439
113443
|
rootNode.scale = [size, size, size];
|
|
113440
113444
|
lastDist = dist;
|
|
113441
113445
|
}
|
|
113446
|
+
|
|
113447
|
+
if (deltaUpdate !== 0) {
|
|
113448
|
+
drag(deltaUpdate);
|
|
113449
|
+
deltaUpdate = 0;
|
|
113450
|
+
}
|
|
113442
113451
|
});
|
|
113443
113452
|
}
|
|
113444
113453
|
|
|
@@ -113466,17 +113475,17 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113466
113475
|
};
|
|
113467
113476
|
})();
|
|
113468
113477
|
|
|
113469
|
-
{
|
|
113470
|
-
|
|
113478
|
+
const moveSectionPlane = (delta) => {
|
|
113479
|
+
const pos = this._sectionPlane.pos;
|
|
113480
|
+
const dir = this._sectionPlane.dir;
|
|
113481
|
+
math.addVec3(pos, math.mulVec3Scalar(dir, 0.1 * delta * this._plugin.getDragSensitivity(), math.vec3()));
|
|
113482
|
+
this._sectionPlane.pos = pos;
|
|
113483
|
+
};
|
|
113471
113484
|
|
|
113472
|
-
|
|
113473
|
-
|
|
113474
|
-
const dir = this._sectionPlane.dir;
|
|
113475
|
-
math.addVec3(pos, math.mulVec3Scalar(dir, 0.1 * delta * this._plugin.getDragSensitivity(), math.vec3()));
|
|
113476
|
-
this._sectionPlane.pos = pos;
|
|
113477
|
-
};
|
|
113485
|
+
{
|
|
113486
|
+
let down = false;
|
|
113478
113487
|
|
|
113479
|
-
this._plugin.
|
|
113488
|
+
this._plugin._controlElement.addEventListener("mousedown", this._canvasMouseDownListener = (e) => {
|
|
113480
113489
|
e.preventDefault();
|
|
113481
113490
|
if (!this._visible) {
|
|
113482
113491
|
return;
|
|
@@ -113492,22 +113501,25 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113492
113501
|
}
|
|
113493
113502
|
});
|
|
113494
113503
|
|
|
113495
|
-
this._plugin.
|
|
113504
|
+
this._plugin._controlElement.addEventListener("mousemove", this._canvasMouseMoveListener = (e) => {
|
|
113496
113505
|
if (!this._visible) {
|
|
113497
113506
|
return;
|
|
113498
113507
|
}
|
|
113499
113508
|
if (!down) {
|
|
113500
113509
|
return;
|
|
113501
113510
|
}
|
|
113511
|
+
if (waitForTick) { // Limit changes detection to one per frame
|
|
113512
|
+
return;
|
|
113513
|
+
}
|
|
113502
113514
|
var canvasPos = getClickCoordsWithinElement(e);
|
|
113503
113515
|
const x = canvasPos[0];
|
|
113504
113516
|
const y = canvasPos[1];
|
|
113505
|
-
|
|
113517
|
+
moveSectionPlane(y - lastCanvasPos[1]);
|
|
113506
113518
|
lastCanvasPos[0] = x;
|
|
113507
113519
|
lastCanvasPos[1] = y;
|
|
113508
113520
|
});
|
|
113509
113521
|
|
|
113510
|
-
this._plugin.
|
|
113522
|
+
this._plugin._controlElement.addEventListener("mouseup", this._canvasMouseUpListener = (e) => {
|
|
113511
113523
|
if (!this._visible) {
|
|
113512
113524
|
return;
|
|
113513
113525
|
}
|
|
@@ -113520,15 +113532,55 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113520
113532
|
down = false;
|
|
113521
113533
|
});
|
|
113522
113534
|
|
|
113523
|
-
this._plugin.
|
|
113535
|
+
this._plugin._controlElement.addEventListener("wheel", this._canvasWheelListener = (e) => {
|
|
113524
113536
|
if (!this._visible) {
|
|
113525
113537
|
return;
|
|
113526
113538
|
}
|
|
113527
|
-
|
|
113528
|
-
|
|
113539
|
+
deltaUpdate += Math.max(-1, Math.min(1, -e.deltaY * 40));
|
|
113540
|
+
});
|
|
113541
|
+
}
|
|
113542
|
+
|
|
113543
|
+
{
|
|
113544
|
+
let touchStartY, touchEndY;
|
|
113545
|
+
let lastTouchY = null;
|
|
113546
|
+
|
|
113547
|
+
this._plugin._controlElement.addEventListener("touchstart", this._handleTouchStart = (e) => {
|
|
113548
|
+
e.stopPropagation();
|
|
113549
|
+
e.preventDefault();
|
|
113550
|
+
if (!this._visible) {
|
|
113551
|
+
return;
|
|
113552
|
+
}
|
|
113553
|
+
touchStartY = e.touches[0].clientY;
|
|
113554
|
+
lastTouchY = touchStartY;
|
|
113555
|
+
deltaUpdate = 0;
|
|
113556
|
+
});
|
|
113557
|
+
|
|
113558
|
+
this._plugin._controlElement.addEventListener("touchmove", this._handleTouchMove = (e) => {
|
|
113559
|
+
e.stopPropagation();
|
|
113560
|
+
e.preventDefault();
|
|
113561
|
+
if (!this._visible) {
|
|
113562
|
+
return;
|
|
113563
|
+
}
|
|
113564
|
+
if (waitForTick) { // Limit changes detection to one per frame
|
|
113529
113565
|
return;
|
|
113530
113566
|
}
|
|
113531
|
-
|
|
113567
|
+
waitForTick = true;
|
|
113568
|
+
touchEndY = e.touches[0].clientY;
|
|
113569
|
+
if (lastTouchY !== null) {
|
|
113570
|
+
deltaUpdate += touchEndY - lastTouchY;
|
|
113571
|
+
}
|
|
113572
|
+
lastTouchY = touchEndY;
|
|
113573
|
+
});
|
|
113574
|
+
|
|
113575
|
+
this._plugin._controlElement.addEventListener("touchend", this._handleTouchEnd = (e) => {
|
|
113576
|
+
e.stopPropagation();
|
|
113577
|
+
e.preventDefault();
|
|
113578
|
+
if (!this._visible) {
|
|
113579
|
+
return;
|
|
113580
|
+
}
|
|
113581
|
+
touchStartY = null;
|
|
113582
|
+
touchEndY = null;
|
|
113583
|
+
deltaUpdate = 0;
|
|
113532
113584
|
});
|
|
113533
113585
|
}
|
|
113534
113586
|
}
|
|
@@ -113544,6 +113596,7 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113544
113596
|
const scene = viewer.scene;
|
|
113545
113597
|
const canvas = scene.canvas.canvas;
|
|
113546
113598
|
const camera = viewer.camera;
|
|
113599
|
+
const controlElement = this._plugin._controlElement;
|
|
113547
113600
|
|
|
113548
113601
|
scene.off(this._onSceneTick);
|
|
113549
113602
|
|
|
@@ -113552,6 +113605,10 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113552
113605
|
canvas.removeEventListener("mouseup", this._canvasMouseUpListener);
|
|
113553
113606
|
canvas.removeEventListener("wheel", this._canvasWheelListener);
|
|
113554
113607
|
|
|
113608
|
+
controlElement.removeEventListener("touchstart", this._handleTouchStart);
|
|
113609
|
+
controlElement.removeEventListener("touchmove", this._handleTouchMove);
|
|
113610
|
+
controlElement.removeEventListener("touchend", this._handleTouchEnd);
|
|
113611
|
+
|
|
113555
113612
|
camera.off(this._onCameraViewMatrix);
|
|
113556
113613
|
camera.off(this._onCameraProjMatrix);
|
|
113557
113614
|
}
|
|
@@ -114131,8 +114188,8 @@ class FaceAlignedSectionPlanesPlugin extends Plugin {
|
|
|
114131
114188
|
if (cfg.controlElementId === null || cfg.controlElementId === undefined) {
|
|
114132
114189
|
this.error("Parameter expected: controlElementId");
|
|
114133
114190
|
} else {
|
|
114134
|
-
this.
|
|
114135
|
-
if (!this.
|
|
114191
|
+
this._controlElement = document.getElementById(cfg.controlElementId);
|
|
114192
|
+
if (!this._controlElement) {
|
|
114136
114193
|
this.warn("Can't find control element: '" + cfg.controlElementId + "' - will create plugin without control element");
|
|
114137
114194
|
|
|
114138
114195
|
}
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -113405,6 +113405,9 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113405
113405
|
const camera = this._viewer.camera;
|
|
113406
113406
|
const scene = this._viewer.scene;
|
|
113407
113407
|
|
|
113408
|
+
let deltaUpdate = 0;
|
|
113409
|
+
let waitForTick = false;
|
|
113410
|
+
|
|
113408
113411
|
{ // Keep gizmo screen size constant
|
|
113409
113412
|
|
|
113410
113413
|
const tempVec3a = math.vec3([0, 0, 0]);
|
|
@@ -113418,6 +113421,7 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113418
113421
|
|
|
113419
113422
|
this._onSceneTick = scene.on("tick", () => {
|
|
113420
113423
|
|
|
113424
|
+
waitForTick = false;
|
|
113421
113425
|
const dist = Math.abs(math.lenVec3(math.subVec3(scene.camera.eye, this._pos, tempVec3a)));
|
|
113422
113426
|
|
|
113423
113427
|
if (dist !== lastDist) {
|
|
@@ -113435,6 +113439,11 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113435
113439
|
rootNode.scale = [size, size, size];
|
|
113436
113440
|
lastDist = dist;
|
|
113437
113441
|
}
|
|
113442
|
+
|
|
113443
|
+
if (deltaUpdate !== 0) {
|
|
113444
|
+
drag(deltaUpdate);
|
|
113445
|
+
deltaUpdate = 0;
|
|
113446
|
+
}
|
|
113438
113447
|
});
|
|
113439
113448
|
}
|
|
113440
113449
|
|
|
@@ -113462,17 +113471,17 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113462
113471
|
};
|
|
113463
113472
|
})();
|
|
113464
113473
|
|
|
113465
|
-
{
|
|
113466
|
-
|
|
113474
|
+
const moveSectionPlane = (delta) => {
|
|
113475
|
+
const pos = this._sectionPlane.pos;
|
|
113476
|
+
const dir = this._sectionPlane.dir;
|
|
113477
|
+
math.addVec3(pos, math.mulVec3Scalar(dir, 0.1 * delta * this._plugin.getDragSensitivity(), math.vec3()));
|
|
113478
|
+
this._sectionPlane.pos = pos;
|
|
113479
|
+
};
|
|
113467
113480
|
|
|
113468
|
-
|
|
113469
|
-
|
|
113470
|
-
const dir = this._sectionPlane.dir;
|
|
113471
|
-
math.addVec3(pos, math.mulVec3Scalar(dir, 0.1 * delta * this._plugin.getDragSensitivity(), math.vec3()));
|
|
113472
|
-
this._sectionPlane.pos = pos;
|
|
113473
|
-
};
|
|
113481
|
+
{
|
|
113482
|
+
let down = false;
|
|
113474
113483
|
|
|
113475
|
-
this._plugin.
|
|
113484
|
+
this._plugin._controlElement.addEventListener("mousedown", this._canvasMouseDownListener = (e) => {
|
|
113476
113485
|
e.preventDefault();
|
|
113477
113486
|
if (!this._visible) {
|
|
113478
113487
|
return;
|
|
@@ -113488,22 +113497,25 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113488
113497
|
}
|
|
113489
113498
|
});
|
|
113490
113499
|
|
|
113491
|
-
this._plugin.
|
|
113500
|
+
this._plugin._controlElement.addEventListener("mousemove", this._canvasMouseMoveListener = (e) => {
|
|
113492
113501
|
if (!this._visible) {
|
|
113493
113502
|
return;
|
|
113494
113503
|
}
|
|
113495
113504
|
if (!down) {
|
|
113496
113505
|
return;
|
|
113497
113506
|
}
|
|
113507
|
+
if (waitForTick) { // Limit changes detection to one per frame
|
|
113508
|
+
return;
|
|
113509
|
+
}
|
|
113498
113510
|
var canvasPos = getClickCoordsWithinElement(e);
|
|
113499
113511
|
const x = canvasPos[0];
|
|
113500
113512
|
const y = canvasPos[1];
|
|
113501
|
-
|
|
113513
|
+
moveSectionPlane(y - lastCanvasPos[1]);
|
|
113502
113514
|
lastCanvasPos[0] = x;
|
|
113503
113515
|
lastCanvasPos[1] = y;
|
|
113504
113516
|
});
|
|
113505
113517
|
|
|
113506
|
-
this._plugin.
|
|
113518
|
+
this._plugin._controlElement.addEventListener("mouseup", this._canvasMouseUpListener = (e) => {
|
|
113507
113519
|
if (!this._visible) {
|
|
113508
113520
|
return;
|
|
113509
113521
|
}
|
|
@@ -113516,15 +113528,55 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113516
113528
|
down = false;
|
|
113517
113529
|
});
|
|
113518
113530
|
|
|
113519
|
-
this._plugin.
|
|
113531
|
+
this._plugin._controlElement.addEventListener("wheel", this._canvasWheelListener = (e) => {
|
|
113520
113532
|
if (!this._visible) {
|
|
113521
113533
|
return;
|
|
113522
113534
|
}
|
|
113523
|
-
|
|
113524
|
-
|
|
113535
|
+
deltaUpdate += Math.max(-1, Math.min(1, -e.deltaY * 40));
|
|
113536
|
+
});
|
|
113537
|
+
}
|
|
113538
|
+
|
|
113539
|
+
{
|
|
113540
|
+
let touchStartY, touchEndY;
|
|
113541
|
+
let lastTouchY = null;
|
|
113542
|
+
|
|
113543
|
+
this._plugin._controlElement.addEventListener("touchstart", this._handleTouchStart = (e) => {
|
|
113544
|
+
e.stopPropagation();
|
|
113545
|
+
e.preventDefault();
|
|
113546
|
+
if (!this._visible) {
|
|
113547
|
+
return;
|
|
113548
|
+
}
|
|
113549
|
+
touchStartY = e.touches[0].clientY;
|
|
113550
|
+
lastTouchY = touchStartY;
|
|
113551
|
+
deltaUpdate = 0;
|
|
113552
|
+
});
|
|
113553
|
+
|
|
113554
|
+
this._plugin._controlElement.addEventListener("touchmove", this._handleTouchMove = (e) => {
|
|
113555
|
+
e.stopPropagation();
|
|
113556
|
+
e.preventDefault();
|
|
113557
|
+
if (!this._visible) {
|
|
113558
|
+
return;
|
|
113559
|
+
}
|
|
113560
|
+
if (waitForTick) { // Limit changes detection to one per frame
|
|
113525
113561
|
return;
|
|
113526
113562
|
}
|
|
113527
|
-
|
|
113563
|
+
waitForTick = true;
|
|
113564
|
+
touchEndY = e.touches[0].clientY;
|
|
113565
|
+
if (lastTouchY !== null) {
|
|
113566
|
+
deltaUpdate += touchEndY - lastTouchY;
|
|
113567
|
+
}
|
|
113568
|
+
lastTouchY = touchEndY;
|
|
113569
|
+
});
|
|
113570
|
+
|
|
113571
|
+
this._plugin._controlElement.addEventListener("touchend", this._handleTouchEnd = (e) => {
|
|
113572
|
+
e.stopPropagation();
|
|
113573
|
+
e.preventDefault();
|
|
113574
|
+
if (!this._visible) {
|
|
113575
|
+
return;
|
|
113576
|
+
}
|
|
113577
|
+
touchStartY = null;
|
|
113578
|
+
touchEndY = null;
|
|
113579
|
+
deltaUpdate = 0;
|
|
113528
113580
|
});
|
|
113529
113581
|
}
|
|
113530
113582
|
}
|
|
@@ -113540,6 +113592,7 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113540
113592
|
const scene = viewer.scene;
|
|
113541
113593
|
const canvas = scene.canvas.canvas;
|
|
113542
113594
|
const camera = viewer.camera;
|
|
113595
|
+
const controlElement = this._plugin._controlElement;
|
|
113543
113596
|
|
|
113544
113597
|
scene.off(this._onSceneTick);
|
|
113545
113598
|
|
|
@@ -113548,6 +113601,10 @@ class FaceAlignedSectionPlanesControl {
|
|
|
113548
113601
|
canvas.removeEventListener("mouseup", this._canvasMouseUpListener);
|
|
113549
113602
|
canvas.removeEventListener("wheel", this._canvasWheelListener);
|
|
113550
113603
|
|
|
113604
|
+
controlElement.removeEventListener("touchstart", this._handleTouchStart);
|
|
113605
|
+
controlElement.removeEventListener("touchmove", this._handleTouchMove);
|
|
113606
|
+
controlElement.removeEventListener("touchend", this._handleTouchEnd);
|
|
113607
|
+
|
|
113551
113608
|
camera.off(this._onCameraViewMatrix);
|
|
113552
113609
|
camera.off(this._onCameraProjMatrix);
|
|
113553
113610
|
}
|
|
@@ -114127,8 +114184,8 @@ class FaceAlignedSectionPlanesPlugin extends Plugin {
|
|
|
114127
114184
|
if (cfg.controlElementId === null || cfg.controlElementId === undefined) {
|
|
114128
114185
|
this.error("Parameter expected: controlElementId");
|
|
114129
114186
|
} else {
|
|
114130
|
-
this.
|
|
114131
|
-
if (!this.
|
|
114187
|
+
this._controlElement = document.getElementById(cfg.controlElementId);
|
|
114188
|
+
if (!this._controlElement) {
|
|
114132
114189
|
this.warn("Can't find control element: '" + cfg.controlElementId + "' - will create plugin without control element");
|
|
114133
114190
|
|
|
114134
114191
|
}
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -24456,9 +24456,11 @@ edges:false,fill:true,fillColor:[1,0,0],fillAlpha:0.6})};this._displayMeshes={pl
|
|
|
24456
24456
|
0.5,0.5,-0.0,0.5,-0.5,-0.0,// 2
|
|
24457
24457
|
-0.5,-0.5,-0.0,-0.5,0.5,-0.0// 3
|
|
24458
24458
|
],indices:[0,1,2,2,3,0]}),material:new PhongMaterial(rootNode,{emissive:[0,0.0,0],diffuse:[0,0,0],backfaces:true}),opacity:0.6,ghosted:true,pickable:false,collidable:true,clippable:false,visible:false,scale:[2.4,2.4,1]}),NO_STATE_INHERIT),planeFrame:rootNode.addChild(new Mesh(rootNode,{// Visible frame
|
|
24459
|
-
geometry:new ReadableGeometry(rootNode,buildTorusGeometry({center:[0,0,0],radius:1.7,tube:tubeRadius*2,radialSegments:4,tubeSegments:4,arc:Math.PI*2.0})),material:new PhongMaterial(rootNode,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),pickable:false,collidable:false,clippable:false,visible:false,scale:[1,1,.1],rotation:[0,0,45]}),NO_STATE_INHERIT),center:rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildSphereGeometry({radius:0.05})),material:materials.center,pickable:false,collidable:true,clippable:false,visible:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false}),NO_STATE_INHERIT),zShaft:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axis,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius/2,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),clippable:false,pickable:false,collidable:true,visible:false}),NO_STATE_INHERIT)};this._affordanceMeshes={planeFrame:rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildTorusGeometry({center:[0,0,0],radius:2,tube:tubeRadius,radialSegments:4,tubeSegments:4,arc:Math.PI*2.0})),material:new PhongMaterial(rootNode,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:true,highlightMaterial:new EmphasisMaterial(rootNode,{edges:false,filled:true,fillColor:[1,1,0],fillAlpha:1.0}),pickable:false,collidable:false,clippable:false,visible:false,scale:[1,1,1],rotation:[0,0,45]}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false}),NO_STATE_INHERIT)};}},{key:"_bindEvents",value:function _bindEvents(){var _this103=this;var rootNode=this._rootNode;var lastCanvasPos=math.vec2();var camera=this._viewer.camera;var scene=this._viewer.scene;{// Keep gizmo screen size constant
|
|
24460
|
-
var _tempVec3a=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this103._pos,_tempVec3a)));if(dist!==lastDist){if(camera.projection==="perspective"){var worldSize=Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;var size=0.07*worldSize;rootNode.scale=[size,size,size];lastDist=dist;}}if(camera.projection==="ortho"){var _worldSize=camera.ortho.scale/10;var _size=_worldSize;rootNode.scale=[_size,_size,_size];lastDist=dist;}});}var getClickCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();
|
|
24461
|
-
down=true;var canvasPos=getClickCoordsWithinElement(e);lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];break;}});this._plugin.
|
|
24459
|
+
geometry:new ReadableGeometry(rootNode,buildTorusGeometry({center:[0,0,0],radius:1.7,tube:tubeRadius*2,radialSegments:4,tubeSegments:4,arc:Math.PI*2.0})),material:new PhongMaterial(rootNode,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),pickable:false,collidable:false,clippable:false,visible:false,scale:[1,1,.1],rotation:[0,0,45]}),NO_STATE_INHERIT),center:rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildSphereGeometry({radius:0.05})),material:materials.center,pickable:false,collidable:true,clippable:false,visible:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false}),NO_STATE_INHERIT),zShaft:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axis,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius/2,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),clippable:false,pickable:false,collidable:true,visible:false}),NO_STATE_INHERIT)};this._affordanceMeshes={planeFrame:rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildTorusGeometry({center:[0,0,0],radius:2,tube:tubeRadius,radialSegments:4,tubeSegments:4,arc:Math.PI*2.0})),material:new PhongMaterial(rootNode,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:true,highlightMaterial:new EmphasisMaterial(rootNode,{edges:false,filled:true,fillColor:[1,1,0],fillAlpha:1.0}),pickable:false,collidable:false,clippable:false,visible:false,scale:[1,1,1],rotation:[0,0,45]}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false}),NO_STATE_INHERIT)};}},{key:"_bindEvents",value:function _bindEvents(){var _this103=this;var rootNode=this._rootNode;var lastCanvasPos=math.vec2();var camera=this._viewer.camera;var scene=this._viewer.scene;var deltaUpdate=0;var waitForTick=false;{// Keep gizmo screen size constant
|
|
24460
|
+
var _tempVec3a=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){waitForTick=false;var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this103._pos,_tempVec3a)));if(dist!==lastDist){if(camera.projection==="perspective"){var worldSize=Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;var size=0.07*worldSize;rootNode.scale=[size,size,size];lastDist=dist;}}if(camera.projection==="ortho"){var _worldSize=camera.ortho.scale/10;var _size=_worldSize;rootNode.scale=[_size,_size,_size];lastDist=dist;}if(deltaUpdate!==0){drag(deltaUpdate);deltaUpdate=0;}});}var getClickCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var moveSectionPlane=function moveSectionPlane(delta){var pos=_this103._sectionPlane.pos;var dir=_this103._sectionPlane.dir;math.addVec3(pos,math.mulVec3Scalar(dir,0.1*delta*_this103._plugin.getDragSensitivity(),math.vec3()));_this103._sectionPlane.pos=pos;};{var down=false;this._plugin._controlElement.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this103._visible){return;}_this103._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
|
|
24461
|
+
down=true;var canvasPos=getClickCoordsWithinElement(e);lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];break;}});this._plugin._controlElement.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this103._visible){return;}if(!down){return;}if(waitForTick){// Limit changes detection to one per frame
|
|
24462
|
+
return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];moveSectionPlane(y-lastCanvasPos[1]);lastCanvasPos[0]=x;lastCanvasPos[1]=y;});this._plugin._controlElement.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this103._visible){return;}_this103._viewer.cameraControl.pointerEnabled=true;if(!down){return;}switch(e.which){}down=false;});this._plugin._controlElement.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this103._visible){return;}deltaUpdate+=Math.max(-1,Math.min(1,-e.deltaY*40));});}{var touchStartY,touchEndY;var lastTouchY=null;this._plugin._controlElement.addEventListener("touchstart",this._handleTouchStart=function(e){e.stopPropagation();e.preventDefault();if(!_this103._visible){return;}touchStartY=e.touches[0].clientY;lastTouchY=touchStartY;deltaUpdate=0;});this._plugin._controlElement.addEventListener("touchmove",this._handleTouchMove=function(e){e.stopPropagation();e.preventDefault();if(!_this103._visible){return;}if(waitForTick){// Limit changes detection to one per frame
|
|
24463
|
+
return;}waitForTick=true;touchEndY=e.touches[0].clientY;if(lastTouchY!==null){deltaUpdate+=touchEndY-lastTouchY;}lastTouchY=touchEndY;});this._plugin._controlElement.addEventListener("touchend",this._handleTouchEnd=function(e){e.stopPropagation();e.preventDefault();if(!_this103._visible){return;}touchStartY=null;touchEndY=null;deltaUpdate=0;});}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var controlElement=this._plugin._controlElement;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);controlElement.removeEventListener("touchstart",this._handleTouchStart);controlElement.removeEventListener("touchmove",this._handleTouchMove);controlElement.removeEventListener("touchend",this._handleTouchEnd);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);return FaceAlignedSectionPlanesControl;}();/**
|
|
24462
24464
|
* Renders a 3D plane within an {@link Overview} to indicate its {@link SectionPlane}'s current position and orientation.
|
|
24463
24465
|
*
|
|
24464
24466
|
* @private
|
|
@@ -24634,7 +24636,7 @@ this.setVisible(cfg.overviewVisible);}/** Called by SectionPlanesPlugin#createSe
|
|
|
24634
24636
|
* @param {String} [cfg.overviewVisible=true] Initial visibility of the overview canvas.
|
|
24635
24637
|
* @param {String} cfg.controlElementId ID of an HTML element that catches drag events to move the active SectionPlane.
|
|
24636
24638
|
* @param {Number} [cfg.dragSensitivity=1] Sensitivity factor that governs the rate at which dragging on the control element moves SectionPlane.
|
|
24637
|
-
*/function FaceAlignedSectionPlanesPlugin(viewer){var _this106;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,FaceAlignedSectionPlanesPlugin);_this106=_super67.call(this,"FaceAlignedSectionPlanesPlugin",viewer);_this106._freeControls=[];_this106._sectionPlanes=viewer.scene.sectionPlanes;_this106._controls={};_this106._shownControlId=null;_this106._dragSensitivity=cfg.dragSensitivity||1;if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this106.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this106._overview=new Overview$1(_assertThisInitialized(_this106),{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this106._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this106._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this106.getShownControl()===id){_this106.hideControl();return;}_this106.showControl(id);var sectionPlane=_this106.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB$1.set(_this106.viewer.scene.aabb);math.getAABB3Center(tempAABB$1,tempVec3$1);tempAABB$1[0]+=sectionPlanePos[0]-tempVec3$1[0];tempAABB$1[1]+=sectionPlanePos[1]-tempVec3$1[1];tempAABB$1[2]+=sectionPlanePos[2]-tempVec3$1[2];tempAABB$1[3]+=sectionPlanePos[0]-tempVec3$1[0];tempAABB$1[4]+=sectionPlanePos[1]-tempVec3$1[1];tempAABB$1[5]+=sectionPlanePos[2]-tempVec3$1[2];_this106.viewer.cameraFlight.flyTo({aabb:tempAABB$1,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this106.hideControl();}});}}if(cfg.controlElementId===null||cfg.controlElementId===undefined){_this106.error("Parameter expected: controlElementId");}else{_this106.
|
|
24639
|
+
*/function FaceAlignedSectionPlanesPlugin(viewer){var _this106;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,FaceAlignedSectionPlanesPlugin);_this106=_super67.call(this,"FaceAlignedSectionPlanesPlugin",viewer);_this106._freeControls=[];_this106._sectionPlanes=viewer.scene.sectionPlanes;_this106._controls={};_this106._shownControlId=null;_this106._dragSensitivity=cfg.dragSensitivity||1;if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this106.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this106._overview=new Overview$1(_assertThisInitialized(_this106),{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this106._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this106._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this106.getShownControl()===id){_this106.hideControl();return;}_this106.showControl(id);var sectionPlane=_this106.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB$1.set(_this106.viewer.scene.aabb);math.getAABB3Center(tempAABB$1,tempVec3$1);tempAABB$1[0]+=sectionPlanePos[0]-tempVec3$1[0];tempAABB$1[1]+=sectionPlanePos[1]-tempVec3$1[1];tempAABB$1[2]+=sectionPlanePos[2]-tempVec3$1[2];tempAABB$1[3]+=sectionPlanePos[0]-tempVec3$1[0];tempAABB$1[4]+=sectionPlanePos[1]-tempVec3$1[1];tempAABB$1[5]+=sectionPlanePos[2]-tempVec3$1[2];_this106.viewer.cameraFlight.flyTo({aabb:tempAABB$1,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this106.hideControl();}});}}if(cfg.controlElementId===null||cfg.controlElementId===undefined){_this106.error("Parameter expected: controlElementId");}else{_this106._controlElement=document.getElementById(cfg.controlElementId);if(!_this106._controlElement){_this106.warn("Can't find control element: '"+cfg.controlElementId+"' - will create plugin without control element");}}_this106._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via FaceAlignedSectionPlanesPlugin#createSectionPlane(), or by directly
|
|
24638
24640
|
// instantiating a SectionPlane independently of FaceAlignedSectionPlanesPlugin, which can be done
|
|
24639
24641
|
// by BCFViewpointsPlugin#loadViewpoint().
|
|
24640
24642
|
_this106._sectionPlaneCreated(sectionPlane);});return _this106;}/**
|