@xtctwins/tctwins-core 1.0.21 → 1.0.23
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 +284 -156
- package/dist/tctwins-core.min.es.js +3 -3
- package/package.json +1 -1
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.d.ts +2 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.d.ts +2 -0
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.d.ts +2 -0
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.d.ts +2 -0
- package/types/plugins/NavCubePlugin/NavCubePlugin.d.ts +6 -0
- package/types/viewer/scene/CameraControl/CameraControl.d.ts +41 -0
package/dist/tctwins-core.es.js
CHANGED
|
@@ -11012,11 +11012,13 @@ class Label {
|
|
|
11012
11012
|
style.color = "white";
|
|
11013
11013
|
style.padding = "4px";
|
|
11014
11014
|
style.border = "solid 1px";
|
|
11015
|
+
style.borderRadius = "20px";
|
|
11015
11016
|
style.background = "lightgreen";
|
|
11016
11017
|
style.position = "absolute";
|
|
11017
11018
|
style["z-index"] = cfg.zIndex === undefined ? "5000005" : cfg.zIndex;
|
|
11018
11019
|
style.width = "auto";
|
|
11019
11020
|
style.height = "auto";
|
|
11021
|
+
style.fontSize = "14px";
|
|
11020
11022
|
style.visibility = "visible";
|
|
11021
11023
|
style.top = 0 + "px";
|
|
11022
11024
|
style.left = 0 + "px";
|
|
@@ -11186,7 +11188,7 @@ class AngleMeasurement extends Component {
|
|
|
11186
11188
|
}
|
|
11187
11189
|
|
|
11188
11190
|
this._color = cfg.color ? cfg.color : plugin.defaultColor;
|
|
11189
|
-
this._borderColor =
|
|
11191
|
+
this._borderColor = plugin.defaultColor ? plugin.defaultColor : "white";
|
|
11190
11192
|
var scene = this.plugin.viewer.scene;
|
|
11191
11193
|
|
|
11192
11194
|
this._originMarker = new Marker(scene, cfg.origin);
|
|
@@ -12011,7 +12013,8 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12011
12013
|
*
|
|
12012
12014
|
* @param {AngleMeasurementsPlugin} angleMeasurementsPlugin The AngleMeasurementsPlugin to control.
|
|
12013
12015
|
* @param {*} [cfg] Configuration
|
|
12014
|
-
* @param {
|
|
12016
|
+
* @param {container} [cfg.container] container that hold myAnglePivotMarker
|
|
12017
|
+
s * @param {function} [cfg.canvasToPagePos] Optional function to map canvas-space coordinates to page coordinates.
|
|
12015
12018
|
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
12016
12019
|
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.
|
|
12017
12020
|
* @param {_offsetX} [cfg._offsetX] _offsetX of the mouse
|
|
@@ -12019,6 +12022,7 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12019
12022
|
* */
|
|
12020
12023
|
constructor(angleMeasurementsPlugin, cfg = {}) {
|
|
12021
12024
|
super(angleMeasurementsPlugin.viewer.scene);
|
|
12025
|
+
this.cfg = cfg;
|
|
12022
12026
|
|
|
12023
12027
|
this._canvasToPagePos = cfg.canvasToPagePos;
|
|
12024
12028
|
|
|
@@ -12050,7 +12054,7 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12050
12054
|
|
|
12051
12055
|
_initMarkerDiv() {
|
|
12052
12056
|
const markerDiv = document.createElement("div");
|
|
12053
|
-
markerDiv.setAttribute("id", "
|
|
12057
|
+
markerDiv.setAttribute("id", "myAnglePivotMarker");
|
|
12054
12058
|
const canvas = this.scene.canvas.canvas;
|
|
12055
12059
|
canvas.parentNode.insertBefore(markerDiv, canvas);
|
|
12056
12060
|
|
|
@@ -12069,7 +12073,7 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12069
12073
|
|
|
12070
12074
|
_destroyMarkerDiv() {
|
|
12071
12075
|
if (this.markerDiv) {
|
|
12072
|
-
const element = document.getElementById("
|
|
12076
|
+
const element = document.getElementById("myAnglePivotMarker");
|
|
12073
12077
|
element.parentNode.removeChild(element);
|
|
12074
12078
|
this._markerDiv = null;
|
|
12075
12079
|
}
|
|
@@ -13039,6 +13043,12 @@ const TOUCH_CANCELING$1 = 7;
|
|
|
13039
13043
|
class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
13040
13044
|
/**
|
|
13041
13045
|
* Creates a AngleMeasurementsTouchControl bound to the given AngleMeasurementsPlugin.
|
|
13046
|
+
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
13047
|
+
* @param {container} [cfg.container] container that hold myDistancePivotMarker_touch
|
|
13048
|
+
* @param {boolean} [cfg.snapToEdge=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.
|
|
13049
|
+
* @param {boolean} [cfg.snapToVertex=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.
|
|
13050
|
+
* @param {_offsetX} [cfg._offsetX] _offsetX of the mouse
|
|
13051
|
+
* @param {_offsetY} [cfg._offsetY] _offsetY of the mouse
|
|
13042
13052
|
*/
|
|
13043
13053
|
constructor(angleMeasurementsPlugin, cfg = {}) {
|
|
13044
13054
|
super(angleMeasurementsPlugin.viewer.scene);
|
|
@@ -13049,6 +13059,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13049
13059
|
this._active = false;
|
|
13050
13060
|
|
|
13051
13061
|
const markerDiv = document.createElement("div");
|
|
13062
|
+
markerDiv.setAttribute("id", "myDistancePivotMarker_touch");
|
|
13052
13063
|
const canvas = this.scene.canvas.canvas;
|
|
13053
13064
|
canvas.parentNode.insertBefore(markerDiv, canvas);
|
|
13054
13065
|
|
|
@@ -15149,7 +15160,11 @@ class Spinner extends Component {
|
|
|
15149
15160
|
<div class="sk-circle12 sk-circle"></div>\
|
|
15150
15161
|
</div>';
|
|
15151
15162
|
element.setAttribute("class", "loading-circle");
|
|
15152
|
-
this._canvas.parentElement.appendChild(element);
|
|
15163
|
+
if (this._canvas.parentElement) this._canvas.parentElement.appendChild(element);
|
|
15164
|
+
else {
|
|
15165
|
+
const viewer = document.getElementById("myViewer");
|
|
15166
|
+
viewer.appendChild(element);
|
|
15167
|
+
}
|
|
15153
15168
|
this._element = element;
|
|
15154
15169
|
this._isCustom = false;
|
|
15155
15170
|
this._adjustPosition();
|
|
@@ -15166,7 +15181,11 @@ class Spinner extends Component {
|
|
|
15166
15181
|
const defaultCSSNode = document.createElement("style");
|
|
15167
15182
|
defaultCSSNode.innerHTML = defaultCSS;
|
|
15168
15183
|
defaultCSSNode.id = elementId;
|
|
15169
|
-
this._canvas.parentElement.appendChild(defaultCSSNode);
|
|
15184
|
+
if (this._canvas.parentElement) this._canvas.parentElement.appendChild(defaultCSSNode);
|
|
15185
|
+
else {
|
|
15186
|
+
const viewer = document.getElementById("myViewer");
|
|
15187
|
+
viewer.appendChild(defaultCSSNode);
|
|
15188
|
+
}
|
|
15170
15189
|
}
|
|
15171
15190
|
|
|
15172
15191
|
/**
|
|
@@ -85813,7 +85832,7 @@ class DistanceMeasurement extends Component {
|
|
|
85813
85832
|
this._eventSubs = {};
|
|
85814
85833
|
|
|
85815
85834
|
this._color = cfg.color ? cfg.color : plugin.defaultColor;
|
|
85816
|
-
this._borderColor =
|
|
85835
|
+
this._borderColor = plugin.defaultColor ? plugin.defaultColor : "white";
|
|
85817
85836
|
var scene = this.plugin.viewer.scene;
|
|
85818
85837
|
|
|
85819
85838
|
this._originMarker = new Marker(scene, cfg.origin);
|
|
@@ -86898,6 +86917,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
86898
86917
|
*
|
|
86899
86918
|
* @param {DistanceMeasurementsPlugin} distanceMeasurementsPlugin The AngleMeasurementsPlugin to control.
|
|
86900
86919
|
* @param [cfg] Configuration
|
|
86920
|
+
* @param {container} [cfg.container] container that hold myDistancePivotMarker
|
|
86901
86921
|
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
86902
86922
|
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.
|
|
86903
86923
|
* @param {_offsetX} [cfg._offsetX] _offsetX of the mouse
|
|
@@ -86906,6 +86926,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
86906
86926
|
|
|
86907
86927
|
constructor(distanceMeasurementsPlugin, cfg = {}) {
|
|
86908
86928
|
super(distanceMeasurementsPlugin.viewer.scene);
|
|
86929
|
+
this.cfg = cfg;
|
|
86909
86930
|
|
|
86910
86931
|
this.pointerLens = cfg.pointerLens;
|
|
86911
86932
|
|
|
@@ -86941,7 +86962,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
86941
86962
|
|
|
86942
86963
|
_initMarkerDiv() {
|
|
86943
86964
|
const markerDiv = document.createElement("div");
|
|
86944
|
-
markerDiv.setAttribute("id", "
|
|
86965
|
+
markerDiv.setAttribute("id", "myDistancePivotMarker");
|
|
86945
86966
|
const canvas = this.scene.canvas.canvas;
|
|
86946
86967
|
canvas.parentNode.insertBefore(markerDiv, canvas);
|
|
86947
86968
|
markerDiv.style.background = "black";
|
|
@@ -86959,7 +86980,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
86959
86980
|
|
|
86960
86981
|
_destroyMarkerDiv() {
|
|
86961
86982
|
if (this._markerDiv) {
|
|
86962
|
-
const element = document.getElementById("
|
|
86983
|
+
const element = document.getElementById("myDistancePivotMarker");
|
|
86963
86984
|
element.parentNode.removeChild(element);
|
|
86964
86985
|
this._markerDiv = null;
|
|
86965
86986
|
}
|
|
@@ -87870,6 +87891,12 @@ const TOUCH_CANCELING = 7;
|
|
|
87870
87891
|
class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
87871
87892
|
/**
|
|
87872
87893
|
* Creates a DistanceMeasurementsTouchControl bound to the given DistanceMeasurementsPlugin.
|
|
87894
|
+
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
87895
|
+
* @param {container} [cfg.container] container that hold myDistancePivotMarker_touch
|
|
87896
|
+
* @param {boolean} [cfg.snapToEdge=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsTouchControl.
|
|
87897
|
+
* @param {boolean} [cfg.snapToVertex=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsTouchControl.
|
|
87898
|
+
* @param {_offsetX} [cfg._offsetX] _offsetX of the mouse
|
|
87899
|
+
* @param {_offsetY} [cfg._offsetY] _offsetY of the mouse
|
|
87873
87900
|
*/
|
|
87874
87901
|
constructor(distanceMeasurementsPlugin, cfg = {}) {
|
|
87875
87902
|
super(distanceMeasurementsPlugin.viewer.scene);
|
|
@@ -87881,6 +87908,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
87881
87908
|
this._active = false;
|
|
87882
87909
|
|
|
87883
87910
|
const markerDiv = document.createElement("div");
|
|
87911
|
+
markerDiv.setAttribute("id", "myDistancePivotMarker_touch");
|
|
87884
87912
|
const canvas = this.scene.canvas.canvas;
|
|
87885
87913
|
canvas.parentNode.insertBefore(markerDiv, canvas);
|
|
87886
87914
|
|
|
@@ -95792,182 +95820,168 @@ class MousePickHandler {
|
|
|
95792
95820
|
* @private
|
|
95793
95821
|
*/
|
|
95794
95822
|
class KeyboardPanRotateDollyHandler {
|
|
95823
|
+
constructor(scene, controllers, configs, states, updates) {
|
|
95824
|
+
this._scene = scene;
|
|
95825
|
+
this._updates = updates;
|
|
95826
|
+
const input = scene.input;
|
|
95795
95827
|
|
|
95796
|
-
|
|
95797
|
-
|
|
95798
|
-
this._scene = scene;
|
|
95799
|
-
const input = scene.input;
|
|
95800
|
-
|
|
95801
|
-
const keyDownMap = [];
|
|
95802
|
-
|
|
95803
|
-
const canvas = scene.canvas.canvas;
|
|
95804
|
-
|
|
95805
|
-
let mouseMovedSinceLastKeyboardDolly = true;
|
|
95806
|
-
|
|
95807
|
-
this._onSceneMouseMove = input.on("mousemove", () => {
|
|
95808
|
-
mouseMovedSinceLastKeyboardDolly = true;
|
|
95809
|
-
});
|
|
95810
|
-
|
|
95811
|
-
this._onSceneKeyDown = input.on("keydown", (keyCode) => {
|
|
95812
|
-
if (!(configs.active && configs.pointerEnabled) || (!scene.input.keyboardEnabled)) {
|
|
95813
|
-
return;
|
|
95814
|
-
}
|
|
95815
|
-
if (!states.mouseover) {
|
|
95816
|
-
return;
|
|
95817
|
-
}
|
|
95818
|
-
keyDownMap[keyCode] = true;
|
|
95819
|
-
|
|
95820
|
-
if (keyCode === input.KEY_SHIFT) {
|
|
95821
|
-
canvas.style.cursor = "move";
|
|
95822
|
-
}
|
|
95823
|
-
});
|
|
95824
|
-
|
|
95825
|
-
this._onSceneKeyUp = input.on("keyup", (keyCode) => {
|
|
95826
|
-
if (!(configs.active && configs.pointerEnabled) || (!scene.input.keyboardEnabled)) {
|
|
95827
|
-
return;
|
|
95828
|
-
}
|
|
95829
|
-
keyDownMap[keyCode] = false;
|
|
95830
|
-
|
|
95831
|
-
if (keyCode === input.KEY_SHIFT) {
|
|
95832
|
-
canvas.style.cursor = null;
|
|
95833
|
-
}
|
|
95834
|
-
|
|
95835
|
-
if (controllers.pivotController.getPivoting()) {
|
|
95836
|
-
controllers.pivotController.endPivot();
|
|
95837
|
-
}
|
|
95838
|
-
});
|
|
95839
|
-
|
|
95840
|
-
this._onTick = scene.on("tick", (e) => {
|
|
95841
|
-
|
|
95842
|
-
if (!(configs.active && configs.pointerEnabled) || (!scene.input.keyboardEnabled)) {
|
|
95843
|
-
return;
|
|
95844
|
-
}
|
|
95845
|
-
|
|
95846
|
-
if (!states.mouseover) {
|
|
95847
|
-
return;
|
|
95848
|
-
}
|
|
95849
|
-
|
|
95850
|
-
const cameraControl = controllers.cameraControl;
|
|
95851
|
-
const elapsedSecs = (e.deltaTime / 1000.0);
|
|
95828
|
+
const keyDownMap = [];
|
|
95852
95829
|
|
|
95853
|
-
|
|
95854
|
-
// Keyboard rotation
|
|
95855
|
-
//-------------------------------------------------------------------------------------------------
|
|
95830
|
+
const canvas = scene.canvas.canvas;
|
|
95856
95831
|
|
|
95857
|
-
|
|
95832
|
+
let mouseMovedSinceLastKeyboardDolly = true;
|
|
95858
95833
|
|
|
95859
|
-
|
|
95860
|
-
|
|
95861
|
-
|
|
95862
|
-
const rotateXNeg = cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_NEG, keyDownMap);
|
|
95834
|
+
this._onSceneMouseMove = input.on("mousemove", () => {
|
|
95835
|
+
mouseMovedSinceLastKeyboardDolly = true;
|
|
95836
|
+
});
|
|
95863
95837
|
|
|
95864
|
-
|
|
95838
|
+
this._onSceneKeyDown = input.on("keydown", (keyCode) => {
|
|
95839
|
+
if (!(configs.active && configs.pointerEnabled) || !scene.input.keyboardEnabled) {
|
|
95840
|
+
return;
|
|
95841
|
+
}
|
|
95842
|
+
if (!states.mouseover) {
|
|
95843
|
+
return;
|
|
95844
|
+
}
|
|
95845
|
+
keyDownMap[keyCode] = true;
|
|
95865
95846
|
|
|
95866
|
-
|
|
95847
|
+
if (keyCode === input.KEY_SHIFT) {
|
|
95848
|
+
canvas.style.cursor = "move";
|
|
95849
|
+
}
|
|
95850
|
+
});
|
|
95867
95851
|
|
|
95868
|
-
|
|
95869
|
-
|
|
95870
|
-
|
|
95852
|
+
this._onSceneKeyUp = input.on("keyup", (keyCode) => {
|
|
95853
|
+
if (!(configs.active && configs.pointerEnabled) || !scene.input.keyboardEnabled) {
|
|
95854
|
+
return;
|
|
95855
|
+
}
|
|
95856
|
+
keyDownMap[keyCode] = false;
|
|
95871
95857
|
|
|
95872
|
-
|
|
95873
|
-
|
|
95858
|
+
if (keyCode === input.KEY_SHIFT) {
|
|
95859
|
+
canvas.style.cursor = null;
|
|
95860
|
+
}
|
|
95874
95861
|
|
|
95875
|
-
|
|
95876
|
-
|
|
95877
|
-
|
|
95862
|
+
if (controllers.pivotController.getPivoting()) {
|
|
95863
|
+
controllers.pivotController.endPivot();
|
|
95864
|
+
}
|
|
95865
|
+
});
|
|
95878
95866
|
|
|
95879
|
-
|
|
95880
|
-
|
|
95867
|
+
this._onTick = scene.on("tick", (e) => {
|
|
95868
|
+
if (!(configs.active && configs.pointerEnabled) || !scene.input.keyboardEnabled) {
|
|
95869
|
+
return;
|
|
95870
|
+
}
|
|
95881
95871
|
|
|
95882
|
-
|
|
95883
|
-
|
|
95884
|
-
|
|
95872
|
+
if (!states.mouseover) {
|
|
95873
|
+
return;
|
|
95874
|
+
}
|
|
95885
95875
|
|
|
95886
|
-
|
|
95887
|
-
|
|
95888
|
-
}
|
|
95889
|
-
}
|
|
95890
|
-
}
|
|
95876
|
+
const cameraControl = controllers.cameraControl;
|
|
95877
|
+
const elapsedSecs = e.deltaTime / 1000.0;
|
|
95891
95878
|
|
|
95892
|
-
|
|
95893
|
-
|
|
95894
|
-
|
|
95879
|
+
//-------------------------------------------------------------------------------------------------
|
|
95880
|
+
// Keyboard rotation
|
|
95881
|
+
//-------------------------------------------------------------------------------------------------
|
|
95895
95882
|
|
|
95896
|
-
|
|
95883
|
+
if (!configs.planView) {
|
|
95884
|
+
const rotateYPos = cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_POS, keyDownMap);
|
|
95885
|
+
const rotateYNeg = cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_NEG, keyDownMap);
|
|
95886
|
+
const rotateXPos = cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_POS, keyDownMap);
|
|
95887
|
+
const rotateXNeg = cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_NEG, keyDownMap);
|
|
95897
95888
|
|
|
95898
|
-
|
|
95899
|
-
const dollyForwards = cameraControl._isKeyDownForAction(cameraControl.DOLLY_FORWARDS, keyDownMap);
|
|
95889
|
+
const orbitDelta = elapsedSecs * configs.keyboardRotationRate;
|
|
95900
95890
|
|
|
95901
|
-
|
|
95891
|
+
if (rotateYPos || rotateYNeg || rotateXPos || rotateXNeg) {
|
|
95892
|
+
if (!configs.firstPerson && configs.followPointer) {
|
|
95893
|
+
controllers.pivotController.startPivot();
|
|
95894
|
+
}
|
|
95902
95895
|
|
|
95903
|
-
|
|
95896
|
+
if (rotateYPos) {
|
|
95897
|
+
updates.rotateDeltaY += orbitDelta;
|
|
95898
|
+
} else if (rotateYNeg) {
|
|
95899
|
+
updates.rotateDeltaY -= orbitDelta;
|
|
95900
|
+
}
|
|
95904
95901
|
|
|
95905
|
-
|
|
95906
|
-
|
|
95907
|
-
|
|
95908
|
-
|
|
95909
|
-
|
|
95910
|
-
} else if (dollyBackwards) {
|
|
95911
|
-
updates.dollyDelta += dollyDelta;
|
|
95912
|
-
}
|
|
95902
|
+
if (rotateXPos) {
|
|
95903
|
+
updates.rotateDeltaX += orbitDelta;
|
|
95904
|
+
} else if (rotateXNeg) {
|
|
95905
|
+
updates.rotateDeltaX -= orbitDelta;
|
|
95906
|
+
}
|
|
95913
95907
|
|
|
95914
|
-
|
|
95915
|
-
|
|
95916
|
-
|
|
95917
|
-
|
|
95918
|
-
|
|
95919
|
-
}
|
|
95908
|
+
if (!configs.firstPerson && configs.followPointer) {
|
|
95909
|
+
controllers.pivotController.startPivot();
|
|
95910
|
+
}
|
|
95911
|
+
}
|
|
95912
|
+
}
|
|
95920
95913
|
|
|
95921
|
-
|
|
95922
|
-
|
|
95923
|
-
|
|
95924
|
-
const panRight = cameraControl._isKeyDownForAction(cameraControl.PAN_RIGHT, keyDownMap);
|
|
95925
|
-
const panUp = cameraControl._isKeyDownForAction(cameraControl.PAN_UP, keyDownMap);
|
|
95926
|
-
const panDown = cameraControl._isKeyDownForAction(cameraControl.PAN_DOWN, keyDownMap);
|
|
95914
|
+
//-------------------------------------------------------------------------------------------------
|
|
95915
|
+
// Keyboard panning
|
|
95916
|
+
//-------------------------------------------------------------------------------------------------
|
|
95927
95917
|
|
|
95928
|
-
|
|
95918
|
+
if (!keyDownMap[input.KEY_CTRL] && !keyDownMap[input.KEY_ALT]) {
|
|
95919
|
+
const dollyBackwards = cameraControl._isKeyDownForAction(cameraControl.DOLLY_BACKWARDS, keyDownMap);
|
|
95920
|
+
const dollyForwards = cameraControl._isKeyDownForAction(cameraControl.DOLLY_FORWARDS, keyDownMap);
|
|
95929
95921
|
|
|
95930
|
-
|
|
95922
|
+
if (dollyBackwards || dollyForwards) {
|
|
95923
|
+
const dollyDelta = elapsedSecs * configs.keyboardDollyRate;
|
|
95931
95924
|
|
|
95932
|
-
|
|
95933
|
-
|
|
95934
|
-
|
|
95925
|
+
if (!configs.firstPerson && configs.followPointer) {
|
|
95926
|
+
controllers.pivotController.startPivot();
|
|
95927
|
+
}
|
|
95928
|
+
if (dollyForwards) {
|
|
95929
|
+
updates.dollyDelta -= dollyDelta;
|
|
95930
|
+
} else if (dollyBackwards) {
|
|
95931
|
+
updates.dollyDelta += dollyDelta;
|
|
95932
|
+
}
|
|
95935
95933
|
|
|
95936
|
-
|
|
95937
|
-
|
|
95934
|
+
if (mouseMovedSinceLastKeyboardDolly) {
|
|
95935
|
+
states.followPointerDirty = true;
|
|
95936
|
+
mouseMovedSinceLastKeyboardDolly = false;
|
|
95937
|
+
}
|
|
95938
|
+
}
|
|
95939
|
+
}
|
|
95938
95940
|
|
|
95939
|
-
|
|
95940
|
-
|
|
95941
|
-
|
|
95941
|
+
const panForwards = cameraControl._isKeyDownForAction(cameraControl.PAN_FORWARDS, keyDownMap);
|
|
95942
|
+
const panBackwards = cameraControl._isKeyDownForAction(cameraControl.PAN_BACKWARDS, keyDownMap);
|
|
95943
|
+
const panLeft = cameraControl._isKeyDownForAction(cameraControl.PAN_LEFT, keyDownMap);
|
|
95944
|
+
const panRight = cameraControl._isKeyDownForAction(cameraControl.PAN_RIGHT, keyDownMap);
|
|
95945
|
+
const panUp = cameraControl._isKeyDownForAction(cameraControl.PAN_UP, keyDownMap);
|
|
95946
|
+
const panDown = cameraControl._isKeyDownForAction(cameraControl.PAN_DOWN, keyDownMap);
|
|
95942
95947
|
|
|
95943
|
-
|
|
95944
|
-
updates.panDeltaX += -panDelta;
|
|
95948
|
+
const panDelta = (keyDownMap[input.KEY_ALT] ? 0.3 : 1.0) * elapsedSecs * configs.keyboardPanRate; // ALT for slower pan rate
|
|
95945
95949
|
|
|
95946
|
-
|
|
95947
|
-
|
|
95948
|
-
|
|
95950
|
+
if (panForwards || panBackwards || panLeft || panRight || panUp || panDown) {
|
|
95951
|
+
if (!configs.firstPerson && configs.followPointer) {
|
|
95952
|
+
controllers.pivotController.startPivot();
|
|
95953
|
+
}
|
|
95949
95954
|
|
|
95950
|
-
|
|
95951
|
-
|
|
95955
|
+
if (panDown) {
|
|
95956
|
+
updates.panDeltaY += panDelta;
|
|
95957
|
+
} else if (panUp) {
|
|
95958
|
+
updates.panDeltaY += -panDelta;
|
|
95959
|
+
}
|
|
95952
95960
|
|
|
95953
|
-
|
|
95954
|
-
|
|
95955
|
-
|
|
95956
|
-
|
|
95957
|
-
|
|
95958
|
-
}
|
|
95961
|
+
if (panRight) {
|
|
95962
|
+
updates.panDeltaX += -panDelta;
|
|
95963
|
+
} else if (panLeft) {
|
|
95964
|
+
updates.panDeltaX += panDelta;
|
|
95965
|
+
}
|
|
95959
95966
|
|
|
95960
|
-
|
|
95961
|
-
|
|
95967
|
+
if (panBackwards) {
|
|
95968
|
+
updates.panDeltaZ += panDelta;
|
|
95969
|
+
} else if (panForwards) {
|
|
95970
|
+
updates.panDeltaZ += -panDelta;
|
|
95971
|
+
}
|
|
95972
|
+
}
|
|
95973
|
+
});
|
|
95974
|
+
}
|
|
95962
95975
|
|
|
95963
|
-
|
|
95976
|
+
reset() {}
|
|
95964
95977
|
|
|
95965
|
-
|
|
95978
|
+
destroy() {
|
|
95979
|
+
this._scene.off(this._onTick);
|
|
95966
95980
|
|
|
95967
|
-
|
|
95968
|
-
|
|
95969
|
-
|
|
95970
|
-
|
|
95981
|
+
this._scene.input.off(this._onSceneMouseMove);
|
|
95982
|
+
this._scene.input.off(this._onSceneKeyDown);
|
|
95983
|
+
this._scene.input.off(this._onSceneKeyUp);
|
|
95984
|
+
}
|
|
95971
95985
|
}
|
|
95972
95986
|
|
|
95973
95987
|
const SCALE_DOLLY_EACH_FRAME = 1; // Recalculate dolly speed for eye->target distance on each Nth frame
|
|
@@ -97611,6 +97625,95 @@ class CameraControl extends Component {
|
|
|
97611
97625
|
this.pointerEnabled = true;
|
|
97612
97626
|
this.keyboardDollyRate = cfg.keyboardDollyRate;
|
|
97613
97627
|
this.mouseWheelDollyRate = cfg.mouseWheelDollyRate;
|
|
97628
|
+
this._moveRate = 1;
|
|
97629
|
+
this.scene.on("tick", () => {
|
|
97630
|
+
// if (!(this._configs.active && this._configs.pointerEnabled)) return;
|
|
97631
|
+
// if (!this._states.mouseover) return;
|
|
97632
|
+
if (!(this._goLeft || this._goRight || this._goUp || this._goDown || this._goForward || this._goBackward)) {
|
|
97633
|
+
// this._inputDirectionCommand = false;
|
|
97634
|
+
return;
|
|
97635
|
+
}
|
|
97636
|
+
if (this._goRight) {
|
|
97637
|
+
this._updates.panDeltaX += -0.1 * this._moveRate;
|
|
97638
|
+
} else if (this._goLeft) {
|
|
97639
|
+
this._updates.panDeltaX += 0.1 * this._moveRate;
|
|
97640
|
+
}
|
|
97641
|
+
|
|
97642
|
+
if (this._goUp) {
|
|
97643
|
+
this._updates.panDeltaY += 0.1 * this._moveRate;
|
|
97644
|
+
} else if (this._goDown) {
|
|
97645
|
+
this._updates.panDeltaY += -0.1 * this._moveRate;
|
|
97646
|
+
}
|
|
97647
|
+
|
|
97648
|
+
if (this._goForward) {
|
|
97649
|
+
this._updates.panDeltaZ += -0.1 * this._moveRate;
|
|
97650
|
+
} else if (this._goBackward) {
|
|
97651
|
+
this._updates.panDeltaZ += +0.1 * this._moveRate;
|
|
97652
|
+
}
|
|
97653
|
+
this._inputDirectionCommand = true;
|
|
97654
|
+
});
|
|
97655
|
+
}
|
|
97656
|
+
/**
|
|
97657
|
+
* 停止漫游
|
|
97658
|
+
*/
|
|
97659
|
+
setdirectionChangeCancel() {
|
|
97660
|
+
this._goLeft = false;
|
|
97661
|
+
this._goRight = false;
|
|
97662
|
+
this._goUp = false;
|
|
97663
|
+
this._goDown = false;
|
|
97664
|
+
this._goForward = false;
|
|
97665
|
+
this._goBackward = false;
|
|
97666
|
+
}
|
|
97667
|
+
|
|
97668
|
+
/**
|
|
97669
|
+
* 设置漫游移动速率
|
|
97670
|
+
* @param {number} rate
|
|
97671
|
+
*/
|
|
97672
|
+
set moveRate(rate) {
|
|
97673
|
+
this._moveRate = rate;
|
|
97674
|
+
}
|
|
97675
|
+
|
|
97676
|
+
/**
|
|
97677
|
+
* 漫游向右
|
|
97678
|
+
* @param {boolean} go
|
|
97679
|
+
*/
|
|
97680
|
+
set goRight(go) {
|
|
97681
|
+
this._goRight = go;
|
|
97682
|
+
}
|
|
97683
|
+
/**
|
|
97684
|
+
* 漫游向左
|
|
97685
|
+
* @param {boolean} go
|
|
97686
|
+
*/
|
|
97687
|
+
set goLeft(go) {
|
|
97688
|
+
this._goLeft = go;
|
|
97689
|
+
}
|
|
97690
|
+
/**
|
|
97691
|
+
* 漫游向上
|
|
97692
|
+
* @param {boolean} go
|
|
97693
|
+
*/
|
|
97694
|
+
set goUp(go) {
|
|
97695
|
+
this._goUp = go;
|
|
97696
|
+
}
|
|
97697
|
+
/**
|
|
97698
|
+
* 漫游向下
|
|
97699
|
+
* @param {boolean} go
|
|
97700
|
+
*/
|
|
97701
|
+
set goDown(go) {
|
|
97702
|
+
this._goDown = go;
|
|
97703
|
+
}
|
|
97704
|
+
/**
|
|
97705
|
+
* 漫游向前
|
|
97706
|
+
* @param {boolean} go
|
|
97707
|
+
*/
|
|
97708
|
+
set goForward(go) {
|
|
97709
|
+
this._goForward = go;
|
|
97710
|
+
}
|
|
97711
|
+
/**
|
|
97712
|
+
* 漫游向后
|
|
97713
|
+
* @param {boolean} go
|
|
97714
|
+
*/
|
|
97715
|
+
set goBackward(go) {
|
|
97716
|
+
this._goBackward = go;
|
|
97614
97717
|
}
|
|
97615
97718
|
|
|
97616
97719
|
updatePivotElement() {
|
|
@@ -117464,14 +117567,14 @@ class NavCubePlugin extends Plugin {
|
|
|
117464
117567
|
this.setIsProjectNorth(cfg.isProjectNorth);
|
|
117465
117568
|
this.setProjectNorthOffsetAngle(cfg.projectNorthOffsetAngle);
|
|
117466
117569
|
|
|
117467
|
-
const rotateTrueNorth = (function () {
|
|
117570
|
+
const rotateTrueNorth = (this.rotateTrueNorth = (function () {
|
|
117468
117571
|
const trueNorthMatrix = math.mat4();
|
|
117469
117572
|
return function (dir, vec, dest) {
|
|
117470
117573
|
math.identityMat4(trueNorthMatrix);
|
|
117471
117574
|
math.rotationMat4v(dir * self._projectNorthOffsetAngle * math.DEGTORAD, [0, 1, 0], trueNorthMatrix);
|
|
117472
117575
|
return math.transformVec3(trueNorthMatrix, vec, dest);
|
|
117473
117576
|
};
|
|
117474
|
-
})();
|
|
117577
|
+
})());
|
|
117475
117578
|
|
|
117476
117579
|
this._synchCamera = (function () {
|
|
117477
117580
|
var matrix = math.rotationMat4c(-90 * math.DEGTORAD, 1, 0, 0);
|
|
@@ -117699,6 +117802,7 @@ class NavCubePlugin extends Plugin {
|
|
|
117699
117802
|
if (hit) {
|
|
117700
117803
|
if (hit.uv) {
|
|
117701
117804
|
var areaId = self._cubeTextureCanvas.getArea(hit.uv);
|
|
117805
|
+
console.log(areaId);
|
|
117702
117806
|
if (areaId >= 0) {
|
|
117703
117807
|
document.body.style.cursor = "pointer";
|
|
117704
117808
|
if (lastAreaId >= 0) {
|
|
@@ -117720,6 +117824,8 @@ class NavCubePlugin extends Plugin {
|
|
|
117720
117824
|
dir = rotateTrueNorth(+1, dir, tempVec3a$4);
|
|
117721
117825
|
up = rotateTrueNorth(+1, up, tempVec3b$1);
|
|
117722
117826
|
}
|
|
117827
|
+
console.log(dir);
|
|
117828
|
+
console.log(up);
|
|
117723
117829
|
flyTo(dir, up, function () {
|
|
117724
117830
|
if (lastAreaId >= 0) {
|
|
117725
117831
|
self._cubeTextureCanvas.setAreaHighlighted(lastAreaId, false);
|
|
@@ -117799,7 +117905,7 @@ class NavCubePlugin extends Plugin {
|
|
|
117799
117905
|
})
|
|
117800
117906
|
);
|
|
117801
117907
|
|
|
117802
|
-
var flyTo = (function () {
|
|
117908
|
+
var flyTo = (this.flyTo = (function () {
|
|
117803
117909
|
var center = math.vec3();
|
|
117804
117910
|
return function (dir, up, ok) {
|
|
117805
117911
|
var aabb = self._fitVisible ? viewer.scene.getAABB(viewer.scene.visibleObjectIds) : viewer.scene.aabb;
|
|
@@ -117832,7 +117938,7 @@ class NavCubePlugin extends Plugin {
|
|
|
117832
117938
|
);
|
|
117833
117939
|
}
|
|
117834
117940
|
};
|
|
117835
|
-
})();
|
|
117941
|
+
})());
|
|
117836
117942
|
}
|
|
117837
117943
|
|
|
117838
117944
|
this._onUpdated = viewer.localeService.on("updated", () => {
|
|
@@ -117848,6 +117954,28 @@ class NavCubePlugin extends Plugin {
|
|
|
117848
117954
|
this.setSynchProjection(cfg.synchProjection);
|
|
117849
117955
|
}
|
|
117850
117956
|
|
|
117957
|
+
flyByClick(areaId) {
|
|
117958
|
+
if (areaId >= 0) {
|
|
117959
|
+
this._cubeTextureCanvas.setAreaHighlighted(areaId, true);
|
|
117960
|
+
this._repaint();
|
|
117961
|
+
var dir = this._cubeTextureCanvas.getAreaDir(areaId);
|
|
117962
|
+
if (dir) {
|
|
117963
|
+
var up = this._cubeTextureCanvas.getAreaUp(areaId);
|
|
117964
|
+
if (this._isProjectNorth && this._projectNorthOffsetAngle) {
|
|
117965
|
+
dir = this.rotateTrueNorth(+1, dir, tempVec3a$4);
|
|
117966
|
+
up = this.rotateTrueNorth(+1, up, tempVec3b$1);
|
|
117967
|
+
}
|
|
117968
|
+
this.flyTo(dir, up, function () {
|
|
117969
|
+
document.body.style.cursor = "pointer";
|
|
117970
|
+
});
|
|
117971
|
+
}
|
|
117972
|
+
}
|
|
117973
|
+
}
|
|
117974
|
+
|
|
117975
|
+
get navCubeScene() {
|
|
117976
|
+
return this._navCubeScene;
|
|
117977
|
+
}
|
|
117978
|
+
|
|
117851
117979
|
send(name, value) {
|
|
117852
117980
|
switch (name) {
|
|
117853
117981
|
case "language":
|