@xtctwins/tctwins-core 1.0.25 → 1.0.26
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/tctwins-core.es.js +683 -577
- package/dist/tctwins-core.min.es.js +3 -3
- package/package.json +1 -1
package/dist/tctwins-core.es.js
CHANGED
|
@@ -12460,9 +12460,6 @@ s * @param {function} [cfg.canvasToPagePos] Optional function to map canvas-spa
|
|
|
12460
12460
|
if (this.pointerLens) {
|
|
12461
12461
|
this.pointerLens.visible = false;
|
|
12462
12462
|
}
|
|
12463
|
-
if (this.markerDiv) {
|
|
12464
|
-
this._destroyMarkerDiv();
|
|
12465
|
-
}
|
|
12466
12463
|
this.reset();
|
|
12467
12464
|
const canvas = this.scene.canvas.canvas;
|
|
12468
12465
|
canvas.removeEventListener("mousedown", this._onMouseDown);
|
|
@@ -12505,7 +12502,6 @@ s * @param {function} [cfg.canvasToPagePos] Optional function to map canvas-spa
|
|
|
12505
12502
|
destroy() {
|
|
12506
12503
|
this.deactivate();
|
|
12507
12504
|
this._destroyMarkerDiv();
|
|
12508
|
-
|
|
12509
12505
|
if (this.pointerLens) {
|
|
12510
12506
|
this.pointerLens.destroy();
|
|
12511
12507
|
}
|
|
@@ -13321,6 +13317,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13321
13317
|
canvas.addEventListener(
|
|
13322
13318
|
"touchstart",
|
|
13323
13319
|
(this._onCanvasTouchStart = (event) => {
|
|
13320
|
+
if (!event.isTrusted) return;
|
|
13324
13321
|
const currentNumTouches = event.touches.length;
|
|
13325
13322
|
|
|
13326
13323
|
//多指触碰
|
|
@@ -13847,6 +13844,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13847
13844
|
touchEndCanvasPos.set([touchX, touchY]);
|
|
13848
13845
|
|
|
13849
13846
|
switch (this._touchState) {
|
|
13847
|
+
//起点短按
|
|
13850
13848
|
case WAITING_FOR_ORIGIN_QUICK_TOUCH_END$1:
|
|
13851
13849
|
{
|
|
13852
13850
|
if (
|
|
@@ -13876,7 +13874,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13876
13874
|
worldPos: pickResult.worldPos
|
|
13877
13875
|
}
|
|
13878
13876
|
});
|
|
13879
|
-
this._currentAngleMeasurement.clickable = false;
|
|
13877
|
+
// this._currentAngleMeasurement.clickable = false;
|
|
13880
13878
|
this._currentAngleMeasurement.originVisible = true;
|
|
13881
13879
|
this._currentAngleMeasurement.originWireVisible = false;
|
|
13882
13880
|
this._currentAngleMeasurement.cornerVisible = false;
|
|
@@ -13898,6 +13896,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13898
13896
|
enableCameraNavigation();
|
|
13899
13897
|
break;
|
|
13900
13898
|
|
|
13899
|
+
//起点长按
|
|
13901
13900
|
case WAITING_FOR_ORIGIN_LONG_TOUCH_END$1:
|
|
13902
13901
|
if (this.pointerLens) {
|
|
13903
13902
|
this.pointerLens.visible = false;
|
|
@@ -13916,6 +13915,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13916
13915
|
enableCameraNavigation();
|
|
13917
13916
|
break;
|
|
13918
13917
|
|
|
13918
|
+
//拐角短按
|
|
13919
13919
|
case WAITING_FOR_CORNER_QUICK_TOUCH_END:
|
|
13920
13920
|
{
|
|
13921
13921
|
if (
|
|
@@ -13955,6 +13955,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13955
13955
|
enableCameraNavigation();
|
|
13956
13956
|
break;
|
|
13957
13957
|
|
|
13958
|
+
//拐角长按
|
|
13958
13959
|
case WAITING_FOR_CORNER_LONG_TOUCH_END:
|
|
13959
13960
|
if (this.pointerLens) {
|
|
13960
13961
|
this.pointerLens.visible = false;
|
|
@@ -13964,6 +13965,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13964
13965
|
enableCameraNavigation();
|
|
13965
13966
|
break;
|
|
13966
13967
|
|
|
13968
|
+
//终点短按
|
|
13967
13969
|
case WAITING_FOR_TARGET_QUICK_TOUCH_END$1:
|
|
13968
13970
|
{
|
|
13969
13971
|
if (
|
|
@@ -14004,6 +14006,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
14004
14006
|
enableCameraNavigation();
|
|
14005
14007
|
break;
|
|
14006
14008
|
|
|
14009
|
+
//终点长按
|
|
14007
14010
|
case WAITING_FOR_TARGET_LONG_TOUCH_END$1:
|
|
14008
14011
|
if (this.pointerLens) {
|
|
14009
14012
|
this.pointerLens.visible = false;
|
|
@@ -14029,6 +14032,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
14029
14032
|
{ passive: true }
|
|
14030
14033
|
);
|
|
14031
14034
|
|
|
14035
|
+
canvas.addEventListener("touchcancel", this._onCanvasTouchEnd);
|
|
14036
|
+
|
|
14032
14037
|
this._active = true;
|
|
14033
14038
|
}
|
|
14034
14039
|
|
|
@@ -14048,6 +14053,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
14048
14053
|
const canvas = this.plugin.viewer.scene.canvas.canvas;
|
|
14049
14054
|
canvas.removeEventListener("touchstart", this._onCanvasTouchStart);
|
|
14050
14055
|
canvas.removeEventListener("touchend", this._onCanvasTouchEnd);
|
|
14056
|
+
canvas.removeEventListener("touchcancel", this._onCanvasTouchEnd);
|
|
14051
14057
|
if (this._currentAngleMeasurement) {
|
|
14052
14058
|
this.angleMeasurementsPlugin.fire("measurementCancel", this._currentAngleMeasurement);
|
|
14053
14059
|
this._currentAngleMeasurement.destroy();
|
|
@@ -21697,6 +21703,7 @@ class Input extends Component {
|
|
|
21697
21703
|
if (!this.enabled) {
|
|
21698
21704
|
return;
|
|
21699
21705
|
}
|
|
21706
|
+
if (!e.isTrusted) return;
|
|
21700
21707
|
if (e.touches.length == 1) {
|
|
21701
21708
|
this.touchDown = true;
|
|
21702
21709
|
}
|
|
@@ -21720,6 +21727,8 @@ class Input extends Component {
|
|
|
21720
21727
|
}),
|
|
21721
21728
|
true
|
|
21722
21729
|
);
|
|
21730
|
+
//touchcancel
|
|
21731
|
+
this.element.addEventListener("touchcancel", this._touchUpListener, true);
|
|
21723
21732
|
//touchmove
|
|
21724
21733
|
this.element.addEventListener(
|
|
21725
21734
|
"touchmove",
|
|
@@ -21789,6 +21798,7 @@ class Input extends Component {
|
|
|
21789
21798
|
|
|
21790
21799
|
this.element.removeEventListener("touchstart", this._touchDownListener);
|
|
21791
21800
|
document.removeEventListener("touchend", this._touchUpListener);
|
|
21801
|
+
document.removeEventListener("touchcancel", this._touchUpListener);
|
|
21792
21802
|
this.element.removeEventListener("touchmove", this._touchMoveListener);
|
|
21793
21803
|
|
|
21794
21804
|
if (window.OrientationChangeEvent) {
|
|
@@ -87380,13 +87390,10 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87380
87390
|
if (this.pointerLens) {
|
|
87381
87391
|
this.pointerLens.visible = false;
|
|
87382
87392
|
}
|
|
87383
|
-
if (this._markerDiv) {
|
|
87384
|
-
this._destroyMarkerDiv();
|
|
87385
|
-
}
|
|
87386
87393
|
this.reset();
|
|
87387
87394
|
const canvas = this.scene.canvas.canvas;
|
|
87388
|
-
canvas.removeEventListener("mousedown"
|
|
87389
|
-
canvas.removeEventListener("mouseup"
|
|
87395
|
+
canvas.removeEventListener("mousedown", this._onMouseDown);
|
|
87396
|
+
canvas.removeEventListener("mouseup", this._onMouseUp);
|
|
87390
87397
|
const cameraControl = this.distanceMeasurementsPlugin.viewer.cameraControl;
|
|
87391
87398
|
cameraControl.off(this._onCameraControlHoverSnapOrSurface);
|
|
87392
87399
|
cameraControl.off(this._onCameraControlHoverSnapOrSurfaceOff);
|
|
@@ -88217,6 +88224,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88217
88224
|
canvas.addEventListener(
|
|
88218
88225
|
"touchstart",
|
|
88219
88226
|
(this._onCanvasTouchStart = (event) => {
|
|
88227
|
+
if (!event.isTrusted) return;
|
|
88220
88228
|
const currentNumTouches = event.touches.length;
|
|
88221
88229
|
|
|
88222
88230
|
if (currentNumTouches !== 1) {
|
|
@@ -88626,6 +88634,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88626
88634
|
touchEndCanvasPos.set([touchX, touchY]);
|
|
88627
88635
|
|
|
88628
88636
|
switch (this._touchState) {
|
|
88637
|
+
//等待起点短按
|
|
88629
88638
|
case WAITING_FOR_ORIGIN_QUICK_TOUCH_END:
|
|
88630
88639
|
{
|
|
88631
88640
|
if (
|
|
@@ -88661,7 +88670,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88661
88670
|
this._currentDistanceMeasurement.wireVisible = false;
|
|
88662
88671
|
this._currentDistanceMeasurement.originVisible = true;
|
|
88663
88672
|
this._currentDistanceMeasurement.targetVisible = false;
|
|
88664
|
-
this._currentDistanceMeasurement.clickable = false;
|
|
88673
|
+
// this._currentDistanceMeasurement.clickable = false;
|
|
88665
88674
|
this._touchState = WAITING_FOR_TARGET_TOUCH_START;
|
|
88666
88675
|
this.distanceMeasurementsPlugin.fire("measurementStart", this._currentDistanceMeasurement);
|
|
88667
88676
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
@@ -88759,6 +88768,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88759
88768
|
{ passive: true }
|
|
88760
88769
|
);
|
|
88761
88770
|
|
|
88771
|
+
canvas.addEventListener("touchcancel", this._onCanvasTouchEnd);
|
|
88772
|
+
|
|
88762
88773
|
this._active = true;
|
|
88763
88774
|
}
|
|
88764
88775
|
|
|
@@ -88778,6 +88789,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88778
88789
|
const canvas = this.plugin.viewer.scene.canvas.canvas;
|
|
88779
88790
|
canvas.removeEventListener("touchstart", this._onCanvasTouchStart);
|
|
88780
88791
|
canvas.removeEventListener("touchend", this._onCanvasTouchEnd);
|
|
88792
|
+
canvas.removeEventListener("touchcancel", this._onCanvasTouchEnd);
|
|
88781
88793
|
if (this._currentDistanceMeasurement) {
|
|
88782
88794
|
this.distanceMeasurementsPlugin.fire("measurementCancel", this._currentDistanceMeasurement);
|
|
88783
88795
|
this._currentDistanceMeasurement.destroy();
|
|
@@ -95469,16 +95481,17 @@ class MousePanRotateDollyHandler {
|
|
|
95469
95481
|
|
|
95470
95482
|
destroy() {
|
|
95471
95483
|
const canvas = this._scene.canvas.canvas;
|
|
95472
|
-
|
|
95473
|
-
|
|
95474
|
-
|
|
95475
|
-
|
|
95476
|
-
|
|
95477
|
-
|
|
95478
|
-
|
|
95479
|
-
|
|
95480
|
-
|
|
95481
|
-
|
|
95484
|
+
if (canvas) {
|
|
95485
|
+
document.removeEventListener("keydown", this._documentKeyDownHandler);
|
|
95486
|
+
document.removeEventListener("keyup", this._documentKeyUpHandler);
|
|
95487
|
+
canvas.removeEventListener("mousedown", this._mouseDownHandler);
|
|
95488
|
+
document.removeEventListener("mousemove", this._documentMouseMoveHandler);
|
|
95489
|
+
canvas.removeEventListener("mousemove", this._canvasMouseMoveHandler);
|
|
95490
|
+
document.removeEventListener("mouseup", this._documentMouseUpHandler);
|
|
95491
|
+
canvas.removeEventListener("mouseup", this._mouseUpHandler);
|
|
95492
|
+
canvas.removeEventListener("mouseenter", this._mouseEnterHandler);
|
|
95493
|
+
canvas.removeEventListener("wheel", this._mouseWheelHandler);
|
|
95494
|
+
}
|
|
95482
95495
|
}
|
|
95483
95496
|
}
|
|
95484
95497
|
|
|
@@ -95772,6 +95785,7 @@ class MousePickHandler {
|
|
|
95772
95785
|
const pickResult = pickController.pickResult;
|
|
95773
95786
|
|
|
95774
95787
|
if (pickResult && pickResult.worldPos) {
|
|
95788
|
+
pivotController.setCanvasPivotPos(states.pointerCanvasPos);
|
|
95775
95789
|
cameraControl.fire("mouseDownEntity", pickController.pickResult, true);
|
|
95776
95790
|
} else {
|
|
95777
95791
|
if (configs.smartPivot) {
|
|
@@ -96274,7 +96288,7 @@ class CameraUpdater {
|
|
|
96274
96288
|
|
|
96275
96289
|
if ((!configs.firstPerson) && configs.followPointer && pivotController.getPivoting()) {
|
|
96276
96290
|
pivotController.continuePivot(updates.rotateDeltaY, updates.rotateDeltaX);
|
|
96277
|
-
pivotController.showPivot();
|
|
96291
|
+
// pivotController.showPivot();
|
|
96278
96292
|
|
|
96279
96293
|
} else {
|
|
96280
96294
|
|
|
@@ -96600,6 +96614,7 @@ class TouchPanRotateAndDollyHandler {
|
|
|
96600
96614
|
if (!(configs.active && configs.pointerEnabled)) {
|
|
96601
96615
|
return;
|
|
96602
96616
|
}
|
|
96617
|
+
if (!event.isTrusted) return;
|
|
96603
96618
|
|
|
96604
96619
|
event.preventDefault();
|
|
96605
96620
|
|
|
@@ -96617,31 +96632,33 @@ class TouchPanRotateAndDollyHandler {
|
|
|
96617
96632
|
pickController.pickCursorPos = tapStartCanvasPos;
|
|
96618
96633
|
pickController.schedulePickSurface = true;
|
|
96619
96634
|
pickController.update();
|
|
96620
|
-
|
|
96621
|
-
|
|
96622
|
-
|
|
96623
|
-
|
|
96624
|
-
|
|
96625
|
-
|
|
96626
|
-
|
|
96627
|
-
|
|
96628
|
-
|
|
96629
|
-
|
|
96630
|
-
|
|
96631
|
-
|
|
96632
|
-
|
|
96633
|
-
|
|
96634
|
-
|
|
96635
|
-
|
|
96636
|
-
|
|
96637
|
-
|
|
96638
|
-
|
|
96639
|
-
|
|
96640
|
-
|
|
96641
|
-
|
|
96642
|
-
|
|
96643
|
-
|
|
96644
|
-
}
|
|
96635
|
+
pivotController.setPivotPos(scene.camera.look);
|
|
96636
|
+
|
|
96637
|
+
// if (!configs.planView) {
|
|
96638
|
+
// if (
|
|
96639
|
+
// pickController.picked &&
|
|
96640
|
+
// pickController.pickedSurface &&
|
|
96641
|
+
// pickController.pickResult &&
|
|
96642
|
+
// pickController.pickResult.worldPos
|
|
96643
|
+
// ) {
|
|
96644
|
+
// // pivotController.setPivotPos(pickController.pickResult.worldPos);
|
|
96645
|
+
// pivotController.setPivotPos(scene.camera.look);
|
|
96646
|
+
// if (!configs.firstPerson && pivotController.startPivot()) {
|
|
96647
|
+
// // pivotController.showPivot();
|
|
96648
|
+
// }
|
|
96649
|
+
// } else {
|
|
96650
|
+
// if (configs.smartPivot) {
|
|
96651
|
+
// pivotController.setPivotPos(scene.camera.look);
|
|
96652
|
+
// // pivotController.setCanvasPivotPos(states.pointerCanvasPos);
|
|
96653
|
+
// } else {
|
|
96654
|
+
// pivotController.setPivotPos(scene.camera.look);
|
|
96655
|
+
// }
|
|
96656
|
+
|
|
96657
|
+
// if (!configs.firstPerson && pivotController.startPivot()) {
|
|
96658
|
+
// // pivotController.showPivot();
|
|
96659
|
+
// }
|
|
96660
|
+
// }
|
|
96661
|
+
// }
|
|
96645
96662
|
}
|
|
96646
96663
|
}
|
|
96647
96664
|
|
|
@@ -96666,6 +96683,7 @@ class TouchPanRotateAndDollyHandler {
|
|
|
96666
96683
|
}
|
|
96667
96684
|
})
|
|
96668
96685
|
);
|
|
96686
|
+
canvas.addEventListener("touchcancel", this._canvasTouchEndHandler);
|
|
96669
96687
|
|
|
96670
96688
|
canvas.addEventListener(
|
|
96671
96689
|
"touchmove",
|
|
@@ -96816,6 +96834,7 @@ class TouchPanRotateAndDollyHandler {
|
|
|
96816
96834
|
const canvas = this._scene.canvas.canvas;
|
|
96817
96835
|
canvas.removeEventListener("touchstart", this._canvasTouchStartHandler);
|
|
96818
96836
|
canvas.removeEventListener("touchend", this._canvasTouchEndHandler);
|
|
96837
|
+
canvas.removeEventListener("touchcancel", this._canvasTouchEndHandler);
|
|
96819
96838
|
canvas.removeEventListener("touchmove", this._canvasTouchMoveHandler);
|
|
96820
96839
|
this._scene.off(this._onTick);
|
|
96821
96840
|
}
|
|
@@ -96891,6 +96910,7 @@ class TouchPickHandler {
|
|
|
96891
96910
|
if (!(configs.active && configs.pointerEnabled)) {
|
|
96892
96911
|
return;
|
|
96893
96912
|
}
|
|
96913
|
+
if (!e.isTrusted) return;
|
|
96894
96914
|
|
|
96895
96915
|
if (states.longTouchTimeout !== null) {
|
|
96896
96916
|
clearTimeout(states.longTouchTimeout);
|
|
@@ -97058,6 +97078,8 @@ class TouchPickHandler {
|
|
|
97058
97078
|
}),
|
|
97059
97079
|
{ passive: true }
|
|
97060
97080
|
);
|
|
97081
|
+
|
|
97082
|
+
canvas.addEventListener("touchcancel", this._canvasTouchEndHandler);
|
|
97061
97083
|
}
|
|
97062
97084
|
|
|
97063
97085
|
reset() {
|
|
@@ -97070,6 +97092,7 @@ class TouchPickHandler {
|
|
|
97070
97092
|
const canvas = this._scene.canvas.canvas;
|
|
97071
97093
|
canvas.removeEventListener("touchstart", this._canvasTouchStartHandler);
|
|
97072
97094
|
canvas.removeEventListener("touchend", this._canvasTouchEndHandler);
|
|
97095
|
+
canvas.removeEventListener("touchcancel", this._canvasTouchEndHandler);
|
|
97073
97096
|
}
|
|
97074
97097
|
}
|
|
97075
97098
|
|
|
@@ -120912,7 +120935,7 @@ class Control {
|
|
|
120912
120935
|
//touchend
|
|
120913
120936
|
canvas.addEventListener(
|
|
120914
120937
|
"touchend",
|
|
120915
|
-
(this.
|
|
120938
|
+
(this._canvasTouchEndListener = (e) => {
|
|
120916
120939
|
// if (!this._visible) return;
|
|
120917
120940
|
this._viewer.cameraControl.pointerEnabled = true;
|
|
120918
120941
|
if (lastAffordanceMesh) {
|
|
@@ -120924,6 +120947,7 @@ class Control {
|
|
|
120924
120947
|
grabbed = false;
|
|
120925
120948
|
})
|
|
120926
120949
|
);
|
|
120950
|
+
canvas.addEventListener("touchcancel", this._canvasTouchEndListener);
|
|
120927
120951
|
}
|
|
120928
120952
|
}
|
|
120929
120953
|
|
|
@@ -120945,6 +120969,8 @@ class Control {
|
|
|
120945
120969
|
canvas.removeEventListener("mousemove", this._canvasMouseMoveListener);
|
|
120946
120970
|
canvas.removeEventListener("mouseup", this._canvasMouseUpListener);
|
|
120947
120971
|
canvas.removeEventListener("wheel", this._canvasWheelListener);
|
|
120972
|
+
canvas.removeEventListener("touchend", this._canvasTouchEndListener);
|
|
120973
|
+
canvas.removeEventListener("touchcancel", this._canvasTouchEndListener);
|
|
120948
120974
|
|
|
120949
120975
|
camera.off(this._onCameraViewMatrix);
|
|
120950
120976
|
camera.off(this._onCameraProjMatrix);
|
|
@@ -122669,597 +122695,677 @@ const quat = new Float64Array(4);
|
|
|
122669
122695
|
* Controls a {@link SectionPlane} with mouse and touch input.
|
|
122670
122696
|
*/
|
|
122671
122697
|
class FaceAlignedSectionPlanesControl {
|
|
122698
|
+
/** @private */
|
|
122699
|
+
constructor(plugin) {
|
|
122700
|
+
/**
|
|
122701
|
+
* ID of this FaceAlignedSectionPlanesControl.
|
|
122702
|
+
*
|
|
122703
|
+
* FaceAlignedSectionPlanesControl are mapped by this ID in {@link FaceAlignedSectionPlanesPlugin#controls}.
|
|
122704
|
+
*
|
|
122705
|
+
* @property id
|
|
122706
|
+
* @type {String|Number}
|
|
122707
|
+
*/
|
|
122708
|
+
this.id = null;
|
|
122672
122709
|
|
|
122673
|
-
|
|
122674
|
-
|
|
122675
|
-
|
|
122676
|
-
|
|
122677
|
-
|
|
122678
|
-
|
|
122679
|
-
* FaceAlignedSectionPlanesControl are mapped by this ID in {@link FaceAlignedSectionPlanesPlugin#controls}.
|
|
122680
|
-
*
|
|
122681
|
-
* @property id
|
|
122682
|
-
* @type {String|Number}
|
|
122683
|
-
*/
|
|
122684
|
-
this.id = null;
|
|
122685
|
-
|
|
122686
|
-
this._viewer = plugin.viewer;
|
|
122687
|
-
this._plugin = plugin;
|
|
122688
|
-
this._visible = false;
|
|
122689
|
-
this._pos = math.vec3(); // Full-precision position of the center of the FaceAlignedSectionPlanesControl
|
|
122690
|
-
this._origin = math.vec3();
|
|
122691
|
-
this._rtcPos = math.vec3();
|
|
122692
|
-
|
|
122693
|
-
this._baseDir = math.vec3(); // Saves direction of clip plane when we start dragging an arrow or ring.
|
|
122694
|
-
this._rootNode = null; // Root of Node graph that represents this control in the 3D scene
|
|
122695
|
-
this._displayMeshes = null; // Meshes that are always visible
|
|
122696
|
-
this._affordanceMeshes = null; // Meshes displayed momentarily for affordance
|
|
122710
|
+
this._viewer = plugin.viewer;
|
|
122711
|
+
this._plugin = plugin;
|
|
122712
|
+
this._visible = false;
|
|
122713
|
+
this._pos = math.vec3(); // Full-precision position of the center of the FaceAlignedSectionPlanesControl
|
|
122714
|
+
this._origin = math.vec3();
|
|
122715
|
+
this._rtcPos = math.vec3();
|
|
122697
122716
|
|
|
122698
|
-
|
|
122717
|
+
this._baseDir = math.vec3(); // Saves direction of clip plane when we start dragging an arrow or ring.
|
|
122718
|
+
this._rootNode = null; // Root of Node graph that represents this control in the 3D scene
|
|
122719
|
+
this._displayMeshes = null; // Meshes that are always visible
|
|
122720
|
+
this._affordanceMeshes = null; // Meshes displayed momentarily for affordance
|
|
122699
122721
|
|
|
122700
|
-
|
|
122701
|
-
this._bindEvents();
|
|
122702
|
-
}
|
|
122722
|
+
this._ignoreNextSectionPlaneDirUpdate = false;
|
|
122703
122723
|
|
|
122704
|
-
|
|
122705
|
-
|
|
122706
|
-
|
|
122707
|
-
* Call with a null or undefined value to disconnect the FaceAlignedSectionPlanesControl ffrom whatever SectionPlane it was assigned to.
|
|
122708
|
-
* @private
|
|
122709
|
-
*/
|
|
122710
|
-
_setSectionPlane(sectionPlane) {
|
|
122711
|
-
if (this._sectionPlane) {
|
|
122712
|
-
this._sectionPlane.off(this._onSectionPlanePos);
|
|
122713
|
-
this._sectionPlane.off(this._onSectionPlaneDir);
|
|
122714
|
-
this._onSectionPlanePos = null;
|
|
122715
|
-
this._onSectionPlaneDir = null;
|
|
122716
|
-
this._sectionPlane = null;
|
|
122717
|
-
}
|
|
122718
|
-
if (sectionPlane) {
|
|
122719
|
-
this.id = sectionPlane.id;
|
|
122720
|
-
this._setPos(sectionPlane.pos);
|
|
122721
|
-
this._setDir(sectionPlane.dir);
|
|
122722
|
-
this._sectionPlane = sectionPlane;
|
|
122723
|
-
this._onSectionPlanePos = sectionPlane.on("pos", () => {
|
|
122724
|
-
this._setPos(this._sectionPlane.pos);
|
|
122725
|
-
});
|
|
122726
|
-
this._onSectionPlaneDir = sectionPlane.on("dir", () => {
|
|
122727
|
-
if (!this._ignoreNextSectionPlaneDirUpdate) {
|
|
122728
|
-
this._setDir(this._sectionPlane.dir);
|
|
122729
|
-
} else {
|
|
122730
|
-
this._ignoreNextSectionPlaneDirUpdate = false;
|
|
122731
|
-
}
|
|
122732
|
-
});
|
|
122733
|
-
}
|
|
122734
|
-
}
|
|
122724
|
+
this._createNodes();
|
|
122725
|
+
this._bindEvents();
|
|
122726
|
+
}
|
|
122735
122727
|
|
|
122736
|
-
|
|
122737
|
-
|
|
122738
|
-
|
|
122739
|
-
|
|
122740
|
-
|
|
122741
|
-
|
|
122742
|
-
|
|
122728
|
+
/**
|
|
122729
|
+
* Called by FaceAlignedSectionPlanesPlugin to assign this FaceAlignedSectionPlanesControl to a SectionPlane.
|
|
122730
|
+
* FaceAlignedSectionPlanesPlugin keeps FaceAlignedSectionPlanesControls in a reuse pool.
|
|
122731
|
+
* Call with a null or undefined value to disconnect the FaceAlignedSectionPlanesControl ffrom whatever SectionPlane it was assigned to.
|
|
122732
|
+
* @private
|
|
122733
|
+
*/
|
|
122734
|
+
_setSectionPlane(sectionPlane) {
|
|
122735
|
+
if (this._sectionPlane) {
|
|
122736
|
+
this._sectionPlane.off(this._onSectionPlanePos);
|
|
122737
|
+
this._sectionPlane.off(this._onSectionPlaneDir);
|
|
122738
|
+
this._onSectionPlanePos = null;
|
|
122739
|
+
this._onSectionPlaneDir = null;
|
|
122740
|
+
this._sectionPlane = null;
|
|
122741
|
+
}
|
|
122742
|
+
if (sectionPlane) {
|
|
122743
|
+
this.id = sectionPlane.id;
|
|
122744
|
+
this._setPos(sectionPlane.pos);
|
|
122745
|
+
this._setDir(sectionPlane.dir);
|
|
122746
|
+
this._sectionPlane = sectionPlane;
|
|
122747
|
+
this._onSectionPlanePos = sectionPlane.on("pos", () => {
|
|
122748
|
+
this._setPos(this._sectionPlane.pos);
|
|
122749
|
+
});
|
|
122750
|
+
this._onSectionPlaneDir = sectionPlane.on("dir", () => {
|
|
122751
|
+
if (!this._ignoreNextSectionPlaneDirUpdate) {
|
|
122752
|
+
this._setDir(this._sectionPlane.dir);
|
|
122753
|
+
} else {
|
|
122754
|
+
this._ignoreNextSectionPlaneDirUpdate = false;
|
|
122755
|
+
}
|
|
122756
|
+
});
|
|
122757
|
+
}
|
|
122758
|
+
}
|
|
122743
122759
|
|
|
122744
|
-
|
|
122745
|
-
|
|
122760
|
+
/**
|
|
122761
|
+
* Gets the {@link SectionPlane} controlled by this FaceAlignedSectionPlanesControl.
|
|
122762
|
+
* @returns {SectionPlane} The SectionPlane.
|
|
122763
|
+
*/
|
|
122764
|
+
get sectionPlane() {
|
|
122765
|
+
return this._sectionPlane;
|
|
122766
|
+
}
|
|
122746
122767
|
|
|
122747
|
-
|
|
122768
|
+
/** @private */
|
|
122769
|
+
_setPos(xyz) {
|
|
122770
|
+
this._pos.set(xyz);
|
|
122748
122771
|
|
|
122749
|
-
|
|
122772
|
+
worldToRTCPos(this._pos, this._origin, this._rtcPos);
|
|
122750
122773
|
|
|
122751
|
-
|
|
122752
|
-
|
|
122753
|
-
|
|
122774
|
+
this._rootNode.origin = this._origin;
|
|
122775
|
+
this._rootNode.position = this._rtcPos;
|
|
122776
|
+
}
|
|
122754
122777
|
|
|
122755
|
-
|
|
122756
|
-
|
|
122757
|
-
|
|
122758
|
-
|
|
122759
|
-
|
|
122778
|
+
/** @private */
|
|
122779
|
+
_setDir(xyz) {
|
|
122780
|
+
this._baseDir.set(xyz);
|
|
122781
|
+
this._rootNode.quaternion = math.vec3PairToQuaternion(zeroVec, xyz, quat);
|
|
122782
|
+
}
|
|
122760
122783
|
|
|
122761
|
-
|
|
122762
|
-
|
|
122763
|
-
|
|
122764
|
-
|
|
122765
|
-
|
|
122766
|
-
|
|
122784
|
+
_setSectionPlaneDir(dir) {
|
|
122785
|
+
if (this._sectionPlane) {
|
|
122786
|
+
this._ignoreNextSectionPlaneDirUpdate = true;
|
|
122787
|
+
this._sectionPlane.dir = dir;
|
|
122788
|
+
}
|
|
122789
|
+
}
|
|
122767
122790
|
|
|
122768
|
-
|
|
122769
|
-
|
|
122770
|
-
|
|
122771
|
-
|
|
122772
|
-
|
|
122773
|
-
|
|
122774
|
-
|
|
122775
|
-
|
|
122776
|
-
|
|
122777
|
-
|
|
122778
|
-
|
|
122779
|
-
|
|
122780
|
-
|
|
122781
|
-
|
|
122782
|
-
|
|
122783
|
-
|
|
122784
|
-
|
|
122785
|
-
|
|
122786
|
-
|
|
122787
|
-
|
|
122788
|
-
|
|
122789
|
-
|
|
122790
|
-
|
|
122791
|
-
|
|
122791
|
+
/**
|
|
122792
|
+
* Sets if this FaceAlignedSectionPlanesControl is visible.
|
|
122793
|
+
*
|
|
122794
|
+
* @type {Boolean}
|
|
122795
|
+
*/
|
|
122796
|
+
setVisible(visible = true) {
|
|
122797
|
+
if (this._visible === visible) {
|
|
122798
|
+
return;
|
|
122799
|
+
}
|
|
122800
|
+
this._visible = visible;
|
|
122801
|
+
var id;
|
|
122802
|
+
for (id in this._displayMeshes) {
|
|
122803
|
+
if (this._displayMeshes.hasOwnProperty(id)) {
|
|
122804
|
+
this._displayMeshes[id].visible = visible;
|
|
122805
|
+
}
|
|
122806
|
+
}
|
|
122807
|
+
if (!visible) {
|
|
122808
|
+
for (id in this._affordanceMeshes) {
|
|
122809
|
+
if (this._affordanceMeshes.hasOwnProperty(id)) {
|
|
122810
|
+
this._affordanceMeshes[id].visible = visible;
|
|
122811
|
+
}
|
|
122812
|
+
}
|
|
122813
|
+
}
|
|
122814
|
+
}
|
|
122792
122815
|
|
|
122793
|
-
|
|
122794
|
-
|
|
122795
|
-
|
|
122796
|
-
|
|
122797
|
-
|
|
122798
|
-
|
|
122799
|
-
|
|
122800
|
-
|
|
122816
|
+
/**
|
|
122817
|
+
* Gets if this FaceAlignedSectionPlanesControl is visible.
|
|
122818
|
+
*
|
|
122819
|
+
* @type {Boolean}
|
|
122820
|
+
*/
|
|
122821
|
+
getVisible() {
|
|
122822
|
+
return this._visible;
|
|
122823
|
+
}
|
|
122801
122824
|
|
|
122802
|
-
|
|
122803
|
-
|
|
122804
|
-
|
|
122805
|
-
|
|
122806
|
-
|
|
122807
|
-
|
|
122808
|
-
|
|
122809
|
-
|
|
122810
|
-
|
|
122811
|
-
|
|
122812
|
-
|
|
122813
|
-
|
|
122814
|
-
|
|
122815
|
-
|
|
122816
|
-
|
|
122817
|
-
|
|
122818
|
-
|
|
122819
|
-
|
|
122820
|
-
|
|
122821
|
-
|
|
122825
|
+
/**
|
|
122826
|
+
* Sets if this FaceAlignedSectionPlanesControl is culled. This is called by FaceAlignedSectionPlanesPlugin to
|
|
122827
|
+
* temporarily hide the FaceAlignedSectionPlanesControl while a snapshot is being taken by Viewer#getSnapshot().
|
|
122828
|
+
* @param culled
|
|
122829
|
+
*/
|
|
122830
|
+
setCulled(culled) {
|
|
122831
|
+
var id;
|
|
122832
|
+
for (id in this._displayMeshes) {
|
|
122833
|
+
if (this._displayMeshes.hasOwnProperty(id)) {
|
|
122834
|
+
this._displayMeshes[id].culled = culled;
|
|
122835
|
+
}
|
|
122836
|
+
}
|
|
122837
|
+
if (!culled) {
|
|
122838
|
+
for (id in this._affordanceMeshes) {
|
|
122839
|
+
if (this._affordanceMeshes.hasOwnProperty(id)) {
|
|
122840
|
+
this._affordanceMeshes[id].culled = culled;
|
|
122841
|
+
}
|
|
122842
|
+
}
|
|
122843
|
+
}
|
|
122844
|
+
}
|
|
122822
122845
|
|
|
122823
|
-
|
|
122824
|
-
|
|
122825
|
-
|
|
122826
|
-
|
|
122827
|
-
|
|
122846
|
+
/**
|
|
122847
|
+
* Builds the Entities that represent this FaceAlignedSectionPlanesControl.
|
|
122848
|
+
* @private
|
|
122849
|
+
*/
|
|
122850
|
+
_createNodes() {
|
|
122851
|
+
const NO_STATE_INHERIT = false;
|
|
122852
|
+
const scene = this._viewer.scene;
|
|
122853
|
+
const radius = 1.0;
|
|
122854
|
+
const tubeRadius = 0.01;
|
|
122855
|
+
const arrowRadius = 0.07;
|
|
122828
122856
|
|
|
122829
|
-
|
|
122830
|
-
|
|
122831
|
-
|
|
122832
|
-
|
|
122833
|
-
const arrowRadius = 0.07;
|
|
122857
|
+
this._rootNode = new Node$2(scene, {
|
|
122858
|
+
position: [0, 0, 0],
|
|
122859
|
+
scale: [5, 5, 5]
|
|
122860
|
+
});
|
|
122834
122861
|
|
|
122835
|
-
|
|
122836
|
-
position: [0, 0, 0],
|
|
122837
|
-
scale: [5, 5, 5]
|
|
122838
|
-
});
|
|
122862
|
+
const rootNode = this._rootNode;
|
|
122839
122863
|
|
|
122840
|
-
|
|
122864
|
+
const shapes = {
|
|
122865
|
+
// Reusable geometries
|
|
122841
122866
|
|
|
122842
|
-
|
|
122867
|
+
arrowHead: new ReadableGeometry(
|
|
122868
|
+
rootNode,
|
|
122869
|
+
buildCylinderGeometry({
|
|
122870
|
+
radiusTop: 0.001,
|
|
122871
|
+
radiusBottom: arrowRadius,
|
|
122872
|
+
radialSegments: 32,
|
|
122873
|
+
heightSegments: 1,
|
|
122874
|
+
height: 0.2,
|
|
122875
|
+
openEnded: false
|
|
122876
|
+
})
|
|
122877
|
+
),
|
|
122843
122878
|
|
|
122844
|
-
|
|
122845
|
-
|
|
122846
|
-
|
|
122847
|
-
|
|
122848
|
-
|
|
122849
|
-
|
|
122850
|
-
|
|
122851
|
-
|
|
122879
|
+
arrowHeadBig: new ReadableGeometry(
|
|
122880
|
+
rootNode,
|
|
122881
|
+
buildCylinderGeometry({
|
|
122882
|
+
radiusTop: 0.001,
|
|
122883
|
+
radiusBottom: 0.09,
|
|
122884
|
+
radialSegments: 32,
|
|
122885
|
+
heightSegments: 1,
|
|
122886
|
+
height: 0.25,
|
|
122887
|
+
openEnded: false
|
|
122888
|
+
})
|
|
122889
|
+
),
|
|
122852
122890
|
|
|
122853
|
-
|
|
122854
|
-
|
|
122855
|
-
|
|
122856
|
-
|
|
122857
|
-
|
|
122858
|
-
|
|
122859
|
-
|
|
122860
|
-
|
|
122891
|
+
axis: new ReadableGeometry(
|
|
122892
|
+
rootNode,
|
|
122893
|
+
buildCylinderGeometry({
|
|
122894
|
+
radiusTop: tubeRadius,
|
|
122895
|
+
radiusBottom: tubeRadius,
|
|
122896
|
+
radialSegments: 20,
|
|
122897
|
+
heightSegments: 1,
|
|
122898
|
+
height: radius,
|
|
122899
|
+
openEnded: false
|
|
122900
|
+
})
|
|
122901
|
+
)
|
|
122902
|
+
};
|
|
122861
122903
|
|
|
122862
|
-
|
|
122863
|
-
|
|
122864
|
-
radiusBottom: tubeRadius,
|
|
122865
|
-
radialSegments: 20,
|
|
122866
|
-
heightSegments: 1,
|
|
122867
|
-
height: radius,
|
|
122868
|
-
openEnded: false
|
|
122869
|
-
}))
|
|
122870
|
-
};
|
|
122904
|
+
const materials = {
|
|
122905
|
+
// Reusable materials
|
|
122871
122906
|
|
|
122872
|
-
|
|
122907
|
+
red: new PhongMaterial(rootNode, {
|
|
122908
|
+
diffuse: [1, 0.0, 0.0],
|
|
122909
|
+
emissive: [1, 0.0, 0.0],
|
|
122910
|
+
ambient: [0.0, 0.0, 0.0],
|
|
122911
|
+
specular: [0.6, 0.6, 0.3],
|
|
122912
|
+
shininess: 80,
|
|
122913
|
+
lineWidth: 2
|
|
122914
|
+
}),
|
|
122873
122915
|
|
|
122874
|
-
|
|
122875
|
-
|
|
122876
|
-
|
|
122877
|
-
|
|
122878
|
-
|
|
122879
|
-
|
|
122880
|
-
|
|
122881
|
-
|
|
122916
|
+
green: new PhongMaterial(rootNode, {
|
|
122917
|
+
diffuse: [0, 1.0, 0.0],
|
|
122918
|
+
emissive: [1, 0.0, 0.0],
|
|
122919
|
+
ambient: [0.0, 0.0, 0.0],
|
|
122920
|
+
specular: [0.6, 0.6, 0.3],
|
|
122921
|
+
shininess: 80,
|
|
122922
|
+
lineWidth: 2
|
|
122923
|
+
}),
|
|
122882
122924
|
|
|
122883
|
-
|
|
122884
|
-
|
|
122885
|
-
|
|
122886
|
-
|
|
122887
|
-
|
|
122888
|
-
|
|
122889
|
-
|
|
122890
|
-
|
|
122925
|
+
blue: new PhongMaterial(rootNode, {
|
|
122926
|
+
diffuse: [0, 0.0, 1.0],
|
|
122927
|
+
emissive: [1, 0.0, 0.0],
|
|
122928
|
+
ambient: [0.0, 0.0, 0.0],
|
|
122929
|
+
specular: [0.6, 0.6, 0.3],
|
|
122930
|
+
shininess: 80,
|
|
122931
|
+
lineWidth: 2
|
|
122932
|
+
}),
|
|
122891
122933
|
|
|
122892
|
-
|
|
122893
|
-
|
|
122894
|
-
|
|
122895
|
-
|
|
122896
|
-
|
|
122897
|
-
|
|
122898
|
-
|
|
122899
|
-
|
|
122934
|
+
highlightRed: new EmphasisMaterial(rootNode, {
|
|
122935
|
+
// Emphasis for red rotation affordance hoop
|
|
122936
|
+
edges: false,
|
|
122937
|
+
fill: true,
|
|
122938
|
+
fillColor: [1, 0, 0],
|
|
122939
|
+
fillAlpha: 0.6
|
|
122940
|
+
})
|
|
122941
|
+
};
|
|
122900
122942
|
|
|
122901
|
-
|
|
122902
|
-
|
|
122903
|
-
|
|
122904
|
-
|
|
122905
|
-
|
|
122906
|
-
|
|
122907
|
-
|
|
122943
|
+
this._displayMeshes = {
|
|
122944
|
+
plane: rootNode.addChild(
|
|
122945
|
+
new Mesh(rootNode, {
|
|
122946
|
+
geometry: new ReadableGeometry(rootNode, {
|
|
122947
|
+
primitive: "triangles",
|
|
122948
|
+
positions: [
|
|
122949
|
+
0.5,
|
|
122950
|
+
0.5,
|
|
122951
|
+
0.0,
|
|
122952
|
+
0.5,
|
|
122953
|
+
-0.5,
|
|
122954
|
+
0.0, // 0
|
|
122955
|
+
-0.5,
|
|
122956
|
+
-0.5,
|
|
122957
|
+
0.0,
|
|
122958
|
+
-0.5,
|
|
122959
|
+
0.5,
|
|
122960
|
+
0.0, // 1
|
|
122961
|
+
0.5,
|
|
122962
|
+
0.5,
|
|
122963
|
+
-0.0,
|
|
122964
|
+
0.5,
|
|
122965
|
+
-0.5,
|
|
122966
|
+
-0.0, // 2
|
|
122967
|
+
-0.5,
|
|
122968
|
+
-0.5,
|
|
122969
|
+
-0.0,
|
|
122970
|
+
-0.5,
|
|
122971
|
+
0.5,
|
|
122972
|
+
-0.0 // 3
|
|
122973
|
+
],
|
|
122974
|
+
indices: [0, 1, 2, 2, 3, 0]
|
|
122975
|
+
}),
|
|
122976
|
+
material: new PhongMaterial(rootNode, {
|
|
122977
|
+
emissive: [0, 0.0, 0],
|
|
122978
|
+
diffuse: [0, 0, 0],
|
|
122979
|
+
backfaces: true
|
|
122980
|
+
}),
|
|
122981
|
+
opacity: 0.6,
|
|
122982
|
+
ghosted: true,
|
|
122983
|
+
pickable: false,
|
|
122984
|
+
collidable: true,
|
|
122985
|
+
clippable: false,
|
|
122986
|
+
visible: false,
|
|
122987
|
+
scale: [2.4, 2.4, 1]
|
|
122988
|
+
}),
|
|
122989
|
+
NO_STATE_INHERIT
|
|
122990
|
+
),
|
|
122908
122991
|
|
|
122909
|
-
|
|
122992
|
+
planeFrame: rootNode.addChild(
|
|
122993
|
+
new Mesh(rootNode, {
|
|
122994
|
+
// Visible frame
|
|
122995
|
+
geometry: new ReadableGeometry(
|
|
122996
|
+
rootNode,
|
|
122997
|
+
buildTorusGeometry({
|
|
122998
|
+
center: [0, 0, 0],
|
|
122999
|
+
radius: 1.7,
|
|
123000
|
+
tube: tubeRadius * 2,
|
|
123001
|
+
radialSegments: 4,
|
|
123002
|
+
tubeSegments: 4,
|
|
123003
|
+
arc: Math.PI * 2.0
|
|
123004
|
+
})
|
|
123005
|
+
),
|
|
123006
|
+
material: new PhongMaterial(rootNode, {
|
|
123007
|
+
emissive: [0, 0, 0],
|
|
123008
|
+
diffuse: [0, 0, 0],
|
|
123009
|
+
specular: [0, 0, 0],
|
|
123010
|
+
shininess: 0
|
|
123011
|
+
}),
|
|
123012
|
+
pickable: false,
|
|
123013
|
+
collidable: false,
|
|
123014
|
+
clippable: false,
|
|
123015
|
+
visible: false,
|
|
123016
|
+
scale: [1, 1, 0.1],
|
|
123017
|
+
rotation: [0, 0, 45]
|
|
123018
|
+
}),
|
|
123019
|
+
NO_STATE_INHERIT
|
|
123020
|
+
),
|
|
122910
123021
|
|
|
122911
|
-
|
|
122912
|
-
|
|
122913
|
-
|
|
122914
|
-
|
|
122915
|
-
|
|
122916
|
-
|
|
122917
|
-
|
|
122918
|
-
|
|
122919
|
-
|
|
122920
|
-
|
|
122921
|
-
|
|
122922
|
-
|
|
122923
|
-
|
|
122924
|
-
|
|
122925
|
-
|
|
122926
|
-
|
|
122927
|
-
opacity: 0.6,
|
|
122928
|
-
ghosted: true,
|
|
122929
|
-
pickable: false,
|
|
122930
|
-
collidable: true,
|
|
122931
|
-
clippable: false,
|
|
122932
|
-
visible: false,
|
|
122933
|
-
scale: [2.4, 2.4, 1]
|
|
122934
|
-
}), NO_STATE_INHERIT),
|
|
122935
|
-
|
|
122936
|
-
planeFrame: rootNode.addChild(new Mesh(rootNode, { // Visible frame
|
|
122937
|
-
geometry: new ReadableGeometry(rootNode, buildTorusGeometry({
|
|
122938
|
-
center: [0, 0, 0],
|
|
122939
|
-
radius: 1.7,
|
|
122940
|
-
tube: tubeRadius * 2,
|
|
122941
|
-
radialSegments: 4,
|
|
122942
|
-
tubeSegments: 4,
|
|
122943
|
-
arc: Math.PI * 2.0
|
|
122944
|
-
})),
|
|
122945
|
-
material: new PhongMaterial(rootNode, {
|
|
122946
|
-
emissive: [0, 0, 0],
|
|
122947
|
-
diffuse: [0, 0, 0],
|
|
122948
|
-
specular: [0, 0, 0],
|
|
122949
|
-
shininess: 0
|
|
122950
|
-
}),
|
|
122951
|
-
pickable: false,
|
|
122952
|
-
collidable: false,
|
|
122953
|
-
clippable: false,
|
|
122954
|
-
visible: false,
|
|
122955
|
-
scale: [1, 1, .1],
|
|
122956
|
-
rotation: [0, 0, 45]
|
|
122957
|
-
}), NO_STATE_INHERIT),
|
|
122958
|
-
|
|
122959
|
-
center: rootNode.addChild(new Mesh(rootNode, {
|
|
122960
|
-
geometry: new ReadableGeometry(rootNode, buildSphereGeometry({
|
|
122961
|
-
radius: 0.05
|
|
122962
|
-
})),
|
|
122963
|
-
material: materials.center,
|
|
122964
|
-
pickable: false,
|
|
122965
|
-
collidable: true,
|
|
122966
|
-
clippable: false,
|
|
122967
|
-
visible: false
|
|
122968
|
-
}), NO_STATE_INHERIT),
|
|
122969
|
-
|
|
122970
|
-
zAxisArrow: rootNode.addChild(new Mesh(rootNode, {
|
|
122971
|
-
geometry: shapes.arrowHead,
|
|
122972
|
-
material: materials.blue,
|
|
122973
|
-
matrix: (function () {
|
|
122974
|
-
const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());
|
|
122975
|
-
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());
|
|
122976
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
|
122977
|
-
})(),
|
|
122978
|
-
pickable: false,
|
|
122979
|
-
collidable: true,
|
|
122980
|
-
clippable: false,
|
|
122981
|
-
visible: false
|
|
122982
|
-
}), NO_STATE_INHERIT),
|
|
122983
|
-
|
|
122984
|
-
zShaft: rootNode.addChild(new Mesh(rootNode, {
|
|
122985
|
-
geometry: shapes.axis,
|
|
122986
|
-
material: materials.blue,
|
|
122987
|
-
matrix: (function () {
|
|
122988
|
-
const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());
|
|
122989
|
-
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
|
|
122990
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
|
122991
|
-
})(),
|
|
122992
|
-
clippable: false,
|
|
122993
|
-
pickable: false,
|
|
122994
|
-
collidable: true,
|
|
122995
|
-
visible: false
|
|
122996
|
-
}), NO_STATE_INHERIT)
|
|
122997
|
-
};
|
|
123022
|
+
center: rootNode.addChild(
|
|
123023
|
+
new Mesh(rootNode, {
|
|
123024
|
+
geometry: new ReadableGeometry(
|
|
123025
|
+
rootNode,
|
|
123026
|
+
buildSphereGeometry({
|
|
123027
|
+
radius: 0.05
|
|
123028
|
+
})
|
|
123029
|
+
),
|
|
123030
|
+
material: materials.center,
|
|
123031
|
+
pickable: false,
|
|
123032
|
+
collidable: true,
|
|
123033
|
+
clippable: false,
|
|
123034
|
+
visible: false
|
|
123035
|
+
}),
|
|
123036
|
+
NO_STATE_INHERIT
|
|
123037
|
+
),
|
|
122998
123038
|
|
|
122999
|
-
|
|
123039
|
+
zAxisArrow: rootNode.addChild(
|
|
123040
|
+
new Mesh(rootNode, {
|
|
123041
|
+
geometry: shapes.arrowHead,
|
|
123042
|
+
material: materials.blue,
|
|
123043
|
+
matrix: (function () {
|
|
123044
|
+
const translate = math.translateMat4c(0, radius + 0.1, 0, math.identityMat4());
|
|
123045
|
+
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());
|
|
123046
|
+
return math.mulMat4(rotate, translate, math.identityMat4());
|
|
123047
|
+
})(),
|
|
123048
|
+
pickable: false,
|
|
123049
|
+
collidable: true,
|
|
123050
|
+
clippable: false,
|
|
123051
|
+
visible: false
|
|
123052
|
+
}),
|
|
123053
|
+
NO_STATE_INHERIT
|
|
123054
|
+
),
|
|
123000
123055
|
|
|
123001
|
-
|
|
123002
|
-
|
|
123003
|
-
|
|
123004
|
-
|
|
123005
|
-
|
|
123006
|
-
|
|
123007
|
-
|
|
123008
|
-
|
|
123009
|
-
|
|
123010
|
-
|
|
123011
|
-
|
|
123012
|
-
|
|
123013
|
-
|
|
123014
|
-
|
|
123015
|
-
|
|
123016
|
-
|
|
123017
|
-
|
|
123018
|
-
filled: true,
|
|
123019
|
-
fillColor: [1, 1, 0],
|
|
123020
|
-
fillAlpha: 1.0
|
|
123021
|
-
}),
|
|
123022
|
-
pickable: false,
|
|
123023
|
-
collidable: false,
|
|
123024
|
-
clippable: false,
|
|
123025
|
-
visible: false,
|
|
123026
|
-
scale: [1, 1, 1],
|
|
123027
|
-
rotation: [0, 0, 45]
|
|
123028
|
-
}), NO_STATE_INHERIT),
|
|
123029
|
-
|
|
123030
|
-
zAxisArrow: rootNode.addChild(new Mesh(rootNode, {
|
|
123031
|
-
geometry: shapes.arrowHeadBig,
|
|
123032
|
-
material: materials.blue,
|
|
123033
|
-
matrix: (function () {
|
|
123034
|
-
const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());
|
|
123035
|
-
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());
|
|
123036
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
|
123037
|
-
})(),
|
|
123038
|
-
pickable: false,
|
|
123039
|
-
collidable: true,
|
|
123040
|
-
clippable: false,
|
|
123041
|
-
visible: false
|
|
123042
|
-
}), NO_STATE_INHERIT)
|
|
123043
|
-
};
|
|
123044
|
-
}
|
|
123056
|
+
zShaft: rootNode.addChild(
|
|
123057
|
+
new Mesh(rootNode, {
|
|
123058
|
+
geometry: shapes.axis,
|
|
123059
|
+
material: materials.blue,
|
|
123060
|
+
matrix: (function () {
|
|
123061
|
+
const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());
|
|
123062
|
+
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
|
|
123063
|
+
return math.mulMat4(rotate, translate, math.identityMat4());
|
|
123064
|
+
})(),
|
|
123065
|
+
clippable: false,
|
|
123066
|
+
pickable: false,
|
|
123067
|
+
collidable: true,
|
|
123068
|
+
visible: false
|
|
123069
|
+
}),
|
|
123070
|
+
NO_STATE_INHERIT
|
|
123071
|
+
)
|
|
123072
|
+
};
|
|
123045
123073
|
|
|
123046
|
-
|
|
123074
|
+
this._affordanceMeshes = {
|
|
123075
|
+
planeFrame: rootNode.addChild(
|
|
123076
|
+
new Mesh(rootNode, {
|
|
123077
|
+
geometry: new ReadableGeometry(
|
|
123078
|
+
rootNode,
|
|
123079
|
+
buildTorusGeometry({
|
|
123080
|
+
center: [0, 0, 0],
|
|
123081
|
+
radius: 2,
|
|
123082
|
+
tube: tubeRadius,
|
|
123083
|
+
radialSegments: 4,
|
|
123084
|
+
tubeSegments: 4,
|
|
123085
|
+
arc: Math.PI * 2.0
|
|
123086
|
+
})
|
|
123087
|
+
),
|
|
123088
|
+
material: new PhongMaterial(rootNode, {
|
|
123089
|
+
ambient: [1, 1, 1],
|
|
123090
|
+
diffuse: [0, 0, 0],
|
|
123091
|
+
emissive: [1, 1, 0]
|
|
123092
|
+
}),
|
|
123093
|
+
highlighted: true,
|
|
123094
|
+
highlightMaterial: new EmphasisMaterial(rootNode, {
|
|
123095
|
+
edges: false,
|
|
123096
|
+
filled: true,
|
|
123097
|
+
fillColor: [1, 1, 0],
|
|
123098
|
+
fillAlpha: 1.0
|
|
123099
|
+
}),
|
|
123100
|
+
pickable: false,
|
|
123101
|
+
collidable: false,
|
|
123102
|
+
clippable: false,
|
|
123103
|
+
visible: false,
|
|
123104
|
+
scale: [1, 1, 1],
|
|
123105
|
+
rotation: [0, 0, 45]
|
|
123106
|
+
}),
|
|
123107
|
+
NO_STATE_INHERIT
|
|
123108
|
+
),
|
|
123047
123109
|
|
|
123048
|
-
|
|
123049
|
-
|
|
123050
|
-
|
|
123051
|
-
|
|
123110
|
+
zAxisArrow: rootNode.addChild(
|
|
123111
|
+
new Mesh(rootNode, {
|
|
123112
|
+
geometry: shapes.arrowHeadBig,
|
|
123113
|
+
material: materials.blue,
|
|
123114
|
+
matrix: (function () {
|
|
123115
|
+
const translate = math.translateMat4c(0, radius + 0.1, 0, math.identityMat4());
|
|
123116
|
+
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());
|
|
123117
|
+
return math.mulMat4(rotate, translate, math.identityMat4());
|
|
123118
|
+
})(),
|
|
123119
|
+
pickable: false,
|
|
123120
|
+
collidable: true,
|
|
123121
|
+
clippable: false,
|
|
123122
|
+
visible: false
|
|
123123
|
+
}),
|
|
123124
|
+
NO_STATE_INHERIT
|
|
123125
|
+
)
|
|
123126
|
+
};
|
|
123127
|
+
}
|
|
123052
123128
|
|
|
123053
|
-
|
|
123054
|
-
|
|
123129
|
+
_bindEvents() {
|
|
123130
|
+
const rootNode = this._rootNode;
|
|
123131
|
+
const lastCanvasPos = math.vec2();
|
|
123132
|
+
const camera = this._viewer.camera;
|
|
123133
|
+
const scene = this._viewer.scene;
|
|
123055
123134
|
|
|
123056
|
-
|
|
123135
|
+
let deltaUpdate = 0;
|
|
123136
|
+
let waitForTick = false;
|
|
123057
123137
|
|
|
123058
|
-
|
|
123059
|
-
|
|
123138
|
+
{
|
|
123139
|
+
// Keep gizmo screen size constant
|
|
123060
123140
|
|
|
123061
|
-
|
|
123062
|
-
|
|
123141
|
+
const tempVec3a = math.vec3([0, 0, 0]);
|
|
123142
|
+
let lastDist = -1;
|
|
123063
123143
|
|
|
123064
|
-
|
|
123065
|
-
|
|
123144
|
+
this._onCameraViewMatrix = scene.camera.on("viewMatrix", () => {
|
|
123145
|
+
});
|
|
123066
123146
|
|
|
123067
|
-
|
|
123147
|
+
this._onCameraProjMatrix = scene.camera.on("projMatrix", () => {
|
|
123148
|
+
});
|
|
123068
123149
|
|
|
123069
|
-
|
|
123070
|
-
|
|
123150
|
+
this._onSceneTick = scene.on("tick", () => {
|
|
123151
|
+
waitForTick = false;
|
|
123152
|
+
const dist = Math.abs(math.lenVec3(math.subVec3(scene.camera.eye, this._pos, tempVec3a)));
|
|
123071
123153
|
|
|
123072
|
-
|
|
123073
|
-
|
|
123074
|
-
|
|
123075
|
-
|
|
123076
|
-
|
|
123077
|
-
|
|
123078
|
-
|
|
123079
|
-
|
|
123154
|
+
if (dist !== lastDist) {
|
|
123155
|
+
if (camera.projection === "perspective") {
|
|
123156
|
+
const worldSize = Math.tan(camera.perspective.fov * math.DEGTORAD) * dist;
|
|
123157
|
+
const size = 0.07 * worldSize;
|
|
123158
|
+
rootNode.scale = [size, size, size];
|
|
123159
|
+
lastDist = dist;
|
|
123160
|
+
}
|
|
123161
|
+
}
|
|
123080
123162
|
|
|
123081
|
-
|
|
123082
|
-
|
|
123083
|
-
|
|
123084
|
-
|
|
123085
|
-
|
|
123086
|
-
|
|
123163
|
+
if (camera.projection === "ortho") {
|
|
123164
|
+
const worldSize = camera.ortho.scale / 10;
|
|
123165
|
+
const size = worldSize;
|
|
123166
|
+
rootNode.scale = [size, size, size];
|
|
123167
|
+
lastDist = dist;
|
|
123168
|
+
}
|
|
123087
123169
|
|
|
123088
|
-
|
|
123089
|
-
|
|
123090
|
-
|
|
123091
|
-
|
|
123092
|
-
|
|
123093
|
-
|
|
123170
|
+
if (deltaUpdate !== 0) {
|
|
123171
|
+
moveSectionPlane(deltaUpdate);
|
|
123172
|
+
deltaUpdate = 0;
|
|
123173
|
+
}
|
|
123174
|
+
});
|
|
123175
|
+
}
|
|
123094
123176
|
|
|
123095
|
-
|
|
123096
|
-
|
|
123097
|
-
|
|
123098
|
-
|
|
123099
|
-
|
|
123100
|
-
|
|
123101
|
-
|
|
123102
|
-
|
|
123103
|
-
|
|
123104
|
-
|
|
123105
|
-
|
|
123106
|
-
|
|
123107
|
-
while (element.offsetParent) {
|
|
123108
|
-
totalOffsetLeft += element.offsetLeft;
|
|
123109
|
-
totalOffsetTop += element.offsetTop;
|
|
123110
|
-
element = element.offsetParent;
|
|
123111
|
-
}
|
|
123112
|
-
canvasPos[0] = event.pageX - totalOffsetLeft;
|
|
123113
|
-
canvasPos[1] = event.pageY - totalOffsetTop;
|
|
123114
|
-
}
|
|
123115
|
-
return canvasPos;
|
|
123116
|
-
};
|
|
123117
|
-
})();
|
|
123177
|
+
const getClickCoordsWithinElement = (function () {
|
|
123178
|
+
const canvasPos = new Float64Array(2);
|
|
123179
|
+
return function (event) {
|
|
123180
|
+
if (!event) {
|
|
123181
|
+
event = window.event;
|
|
123182
|
+
canvasPos[0] = event.x;
|
|
123183
|
+
canvasPos[1] = event.y;
|
|
123184
|
+
} else {
|
|
123185
|
+
var element = event.target;
|
|
123186
|
+
var totalOffsetLeft = 0;
|
|
123187
|
+
var totalOffsetTop = 0;
|
|
123118
123188
|
|
|
123119
|
-
|
|
123120
|
-
|
|
123121
|
-
|
|
123122
|
-
|
|
123123
|
-
|
|
123124
|
-
|
|
123189
|
+
while (element.offsetParent) {
|
|
123190
|
+
totalOffsetLeft += element.offsetLeft;
|
|
123191
|
+
totalOffsetTop += element.offsetTop;
|
|
123192
|
+
element = element.offsetParent;
|
|
123193
|
+
}
|
|
123194
|
+
canvasPos[0] = event.pageX - totalOffsetLeft;
|
|
123195
|
+
canvasPos[1] = event.pageY - totalOffsetTop;
|
|
123196
|
+
}
|
|
123197
|
+
return canvasPos;
|
|
123198
|
+
};
|
|
123199
|
+
})();
|
|
123125
123200
|
|
|
123126
|
-
|
|
123127
|
-
|
|
123201
|
+
const moveSectionPlane = (delta) => {
|
|
123202
|
+
const pos = this._sectionPlane.pos;
|
|
123203
|
+
const dir = this._sectionPlane.dir;
|
|
123204
|
+
math.addVec3(pos, math.mulVec3Scalar(dir, 0.1 * delta * this._plugin.getDragSensitivity(), math.vec3()));
|
|
123205
|
+
this._sectionPlane.pos = pos;
|
|
123206
|
+
};
|
|
123128
123207
|
|
|
123129
|
-
|
|
123130
|
-
|
|
123131
|
-
if (!this._visible) {
|
|
123132
|
-
return;
|
|
123133
|
-
}
|
|
123134
|
-
this._viewer.cameraControl.pointerEnabled = false;
|
|
123135
|
-
switch (e.which) {
|
|
123136
|
-
case 1: // Left button
|
|
123137
|
-
down = true;
|
|
123138
|
-
var canvasPos = getClickCoordsWithinElement(e);
|
|
123139
|
-
lastCanvasPos[0] = canvasPos[0];
|
|
123140
|
-
lastCanvasPos[1] = canvasPos[1];
|
|
123141
|
-
break;
|
|
123142
|
-
}
|
|
123143
|
-
});
|
|
123208
|
+
{
|
|
123209
|
+
let down = false;
|
|
123144
123210
|
|
|
123145
|
-
|
|
123146
|
-
|
|
123147
|
-
|
|
123148
|
-
|
|
123149
|
-
|
|
123150
|
-
|
|
123151
|
-
|
|
123152
|
-
|
|
123153
|
-
|
|
123154
|
-
|
|
123155
|
-
|
|
123156
|
-
|
|
123157
|
-
|
|
123158
|
-
|
|
123159
|
-
|
|
123160
|
-
|
|
123161
|
-
|
|
123211
|
+
this._plugin._controlElement.addEventListener(
|
|
123212
|
+
"mousedown",
|
|
123213
|
+
(this._canvasMouseDownListener = (e) => {
|
|
123214
|
+
e.preventDefault();
|
|
123215
|
+
if (!this._visible) {
|
|
123216
|
+
return;
|
|
123217
|
+
}
|
|
123218
|
+
this._viewer.cameraControl.pointerEnabled = false;
|
|
123219
|
+
switch (e.which) {
|
|
123220
|
+
case 1: // Left button
|
|
123221
|
+
down = true;
|
|
123222
|
+
var canvasPos = getClickCoordsWithinElement(e);
|
|
123223
|
+
lastCanvasPos[0] = canvasPos[0];
|
|
123224
|
+
lastCanvasPos[1] = canvasPos[1];
|
|
123225
|
+
break;
|
|
123226
|
+
}
|
|
123227
|
+
})
|
|
123228
|
+
);
|
|
123162
123229
|
|
|
123163
|
-
|
|
123164
|
-
|
|
123165
|
-
|
|
123166
|
-
|
|
123167
|
-
|
|
123168
|
-
|
|
123169
|
-
|
|
123170
|
-
|
|
123171
|
-
|
|
123172
|
-
|
|
123173
|
-
|
|
123174
|
-
|
|
123230
|
+
this._plugin._controlElement.addEventListener(
|
|
123231
|
+
"mousemove",
|
|
123232
|
+
(this._canvasMouseMoveListener = (e) => {
|
|
123233
|
+
if (!this._visible) {
|
|
123234
|
+
return;
|
|
123235
|
+
}
|
|
123236
|
+
if (!down) {
|
|
123237
|
+
return;
|
|
123238
|
+
}
|
|
123239
|
+
if (waitForTick) {
|
|
123240
|
+
// Limit changes detection to one per frame
|
|
123241
|
+
return;
|
|
123242
|
+
}
|
|
123243
|
+
var canvasPos = getClickCoordsWithinElement(e);
|
|
123244
|
+
const x = canvasPos[0];
|
|
123245
|
+
const y = canvasPos[1];
|
|
123246
|
+
moveSectionPlane(y - lastCanvasPos[1]);
|
|
123247
|
+
lastCanvasPos[0] = x;
|
|
123248
|
+
lastCanvasPos[1] = y;
|
|
123249
|
+
})
|
|
123250
|
+
);
|
|
123175
123251
|
|
|
123176
|
-
|
|
123177
|
-
|
|
123178
|
-
|
|
123179
|
-
|
|
123180
|
-
|
|
123181
|
-
|
|
123182
|
-
|
|
123252
|
+
this._plugin._controlElement.addEventListener(
|
|
123253
|
+
"mouseup",
|
|
123254
|
+
(this._canvasMouseUpListener = (e) => {
|
|
123255
|
+
if (!this._visible) {
|
|
123256
|
+
return;
|
|
123257
|
+
}
|
|
123258
|
+
this._viewer.cameraControl.pointerEnabled = true;
|
|
123259
|
+
if (!down) {
|
|
123260
|
+
return;
|
|
123261
|
+
}
|
|
123262
|
+
switch (e.which) {
|
|
123263
|
+
}
|
|
123264
|
+
down = false;
|
|
123265
|
+
})
|
|
123266
|
+
);
|
|
123183
123267
|
|
|
123184
|
-
|
|
123185
|
-
|
|
123186
|
-
|
|
123268
|
+
this._plugin._controlElement.addEventListener(
|
|
123269
|
+
"wheel",
|
|
123270
|
+
(this._canvasWheelListener = (e) => {
|
|
123271
|
+
if (!this._visible) {
|
|
123272
|
+
return;
|
|
123273
|
+
}
|
|
123274
|
+
deltaUpdate += Math.max(-1, Math.min(1, -e.deltaY * 40));
|
|
123275
|
+
})
|
|
123276
|
+
);
|
|
123277
|
+
}
|
|
123187
123278
|
|
|
123188
|
-
|
|
123189
|
-
|
|
123190
|
-
|
|
123191
|
-
if (!this._visible) {
|
|
123192
|
-
return;
|
|
123193
|
-
}
|
|
123194
|
-
touchStartY = e.touches[0].clientY;
|
|
123195
|
-
lastTouchY = touchStartY;
|
|
123196
|
-
deltaUpdate = 0;
|
|
123197
|
-
});
|
|
123279
|
+
{
|
|
123280
|
+
let touchStartY, touchEndY;
|
|
123281
|
+
let lastTouchY = null;
|
|
123198
123282
|
|
|
123199
|
-
|
|
123200
|
-
|
|
123201
|
-
|
|
123202
|
-
|
|
123203
|
-
|
|
123204
|
-
|
|
123205
|
-
|
|
123206
|
-
|
|
123207
|
-
|
|
123208
|
-
|
|
123209
|
-
|
|
123210
|
-
|
|
123211
|
-
|
|
123212
|
-
}
|
|
123213
|
-
lastTouchY = touchEndY;
|
|
123214
|
-
});
|
|
123283
|
+
this._plugin._controlElement.addEventListener(
|
|
123284
|
+
"touchstart",
|
|
123285
|
+
(this._handleTouchStart = (e) => {
|
|
123286
|
+
e.stopPropagation();
|
|
123287
|
+
e.preventDefault();
|
|
123288
|
+
if (!this._visible) {
|
|
123289
|
+
return;
|
|
123290
|
+
}
|
|
123291
|
+
touchStartY = e.touches[0].clientY;
|
|
123292
|
+
lastTouchY = touchStartY;
|
|
123293
|
+
deltaUpdate = 0;
|
|
123294
|
+
})
|
|
123295
|
+
);
|
|
123215
123296
|
|
|
123216
|
-
|
|
123217
|
-
|
|
123218
|
-
|
|
123219
|
-
|
|
123220
|
-
|
|
123221
|
-
|
|
123222
|
-
|
|
123223
|
-
|
|
123224
|
-
|
|
123225
|
-
|
|
123226
|
-
|
|
123227
|
-
|
|
123297
|
+
this._plugin._controlElement.addEventListener(
|
|
123298
|
+
"touchmove",
|
|
123299
|
+
(this._handleTouchMove = (e) => {
|
|
123300
|
+
e.stopPropagation();
|
|
123301
|
+
e.preventDefault();
|
|
123302
|
+
if (!this._visible) {
|
|
123303
|
+
return;
|
|
123304
|
+
}
|
|
123305
|
+
if (waitForTick) {
|
|
123306
|
+
// Limit changes detection to one per frame
|
|
123307
|
+
return;
|
|
123308
|
+
}
|
|
123309
|
+
waitForTick = true;
|
|
123310
|
+
touchEndY = e.touches[0].clientY;
|
|
123311
|
+
if (lastTouchY !== null) {
|
|
123312
|
+
deltaUpdate += touchEndY - lastTouchY;
|
|
123313
|
+
}
|
|
123314
|
+
lastTouchY = touchEndY;
|
|
123315
|
+
})
|
|
123316
|
+
);
|
|
123228
123317
|
|
|
123229
|
-
|
|
123230
|
-
|
|
123231
|
-
|
|
123232
|
-
|
|
123318
|
+
this._plugin._controlElement.addEventListener(
|
|
123319
|
+
"touchend",
|
|
123320
|
+
(this._handleTouchEnd = (e) => {
|
|
123321
|
+
e.stopPropagation();
|
|
123322
|
+
e.preventDefault();
|
|
123323
|
+
if (!this._visible) {
|
|
123324
|
+
return;
|
|
123325
|
+
}
|
|
123326
|
+
touchStartY = null;
|
|
123327
|
+
touchEndY = null;
|
|
123328
|
+
deltaUpdate = 0;
|
|
123329
|
+
})
|
|
123330
|
+
);
|
|
123331
|
+
this._plugin._controlElement.addEventListener("touchcancel", this._handleTouchEnd);
|
|
123332
|
+
}
|
|
123333
|
+
}
|
|
123233
123334
|
|
|
123234
|
-
|
|
123335
|
+
_destroy() {
|
|
123336
|
+
this._unbindEvents();
|
|
123337
|
+
this._destroyNodes();
|
|
123338
|
+
}
|
|
123235
123339
|
|
|
123236
|
-
|
|
123237
|
-
|
|
123238
|
-
|
|
123239
|
-
|
|
123240
|
-
|
|
123340
|
+
_unbindEvents() {
|
|
123341
|
+
const viewer = this._viewer;
|
|
123342
|
+
const scene = viewer.scene;
|
|
123343
|
+
const canvas = scene.canvas.canvas;
|
|
123344
|
+
const camera = viewer.camera;
|
|
123345
|
+
const controlElement = this._plugin._controlElement;
|
|
123241
123346
|
|
|
123242
|
-
|
|
123347
|
+
scene.off(this._onSceneTick);
|
|
123243
123348
|
|
|
123244
|
-
|
|
123245
|
-
|
|
123246
|
-
|
|
123247
|
-
|
|
123349
|
+
canvas.removeEventListener("mousedown", this._canvasMouseDownListener);
|
|
123350
|
+
canvas.removeEventListener("mousemove", this._canvasMouseMoveListener);
|
|
123351
|
+
canvas.removeEventListener("mouseup", this._canvasMouseUpListener);
|
|
123352
|
+
canvas.removeEventListener("wheel", this._canvasWheelListener);
|
|
123248
123353
|
|
|
123249
|
-
|
|
123250
|
-
|
|
123251
|
-
|
|
123354
|
+
controlElement.removeEventListener("touchstart", this._handleTouchStart);
|
|
123355
|
+
controlElement.removeEventListener("touchmove", this._handleTouchMove);
|
|
123356
|
+
controlElement.removeEventListener("touchend", this._handleTouchEnd);
|
|
123357
|
+
controlElement.removeEventListener("touchcancel", this._handleTouchEnd);
|
|
123252
123358
|
|
|
123253
|
-
|
|
123254
|
-
|
|
123255
|
-
|
|
123359
|
+
camera.off(this._onCameraViewMatrix);
|
|
123360
|
+
camera.off(this._onCameraProjMatrix);
|
|
123361
|
+
}
|
|
123256
123362
|
|
|
123257
|
-
|
|
123258
|
-
|
|
123259
|
-
|
|
123260
|
-
|
|
123261
|
-
|
|
123262
|
-
|
|
123363
|
+
_destroyNodes() {
|
|
123364
|
+
this._setSectionPlane(null);
|
|
123365
|
+
this._rootNode.destroy();
|
|
123366
|
+
this._displayMeshes = {};
|
|
123367
|
+
this._affordanceMeshes = {};
|
|
123368
|
+
}
|
|
123263
123369
|
}
|
|
123264
123370
|
|
|
123265
123371
|
/**
|