@xeokit/xeokit-sdk 2.6.53 → 2.6.54
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 +247 -29
- package/dist/xeokit-sdk.es.js +247 -29
- package/dist/xeokit-sdk.es5.js +196 -99
- package/dist/xeokit-sdk.min.cjs.js +3 -3
- package/dist/xeokit-sdk.min.es.js +4 -4
- package/dist/xeokit-sdk.min.es5.js +3 -3
- package/package.json +1 -1
- package/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +22 -12
- package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +2 -2
- package/src/viewer/Viewer.js +5 -9
- package/src/viewer/scene/CameraControl/CameraControl.js +160 -2
- package/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +27 -3
- package/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +7 -1
- package/src/viewer/scene/input/Input.js +24 -0
- package/types/plugins/StoreyViewsPlugin/StoreyViewsPlugin.d.ts +3 -3
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -21948,6 +21948,30 @@ class Input extends Component {
|
|
|
21948
21948
|
*/
|
|
21949
21949
|
this.KEY_SPACE = 32;
|
|
21950
21950
|
|
|
21951
|
+
/**
|
|
21952
|
+
* Code for the left mouse button.
|
|
21953
|
+
* @property MOUSE_LEFT_BUTTON
|
|
21954
|
+
* @final
|
|
21955
|
+
* @type {Number}
|
|
21956
|
+
*/
|
|
21957
|
+
this.MOUSE_LEFT_BUTTON = 260;
|
|
21958
|
+
|
|
21959
|
+
/**
|
|
21960
|
+
* Code for the middle mouse button.
|
|
21961
|
+
* @property MOUSE_MIDDLE_BUTTON
|
|
21962
|
+
* @final
|
|
21963
|
+
* @type {Number}
|
|
21964
|
+
*/
|
|
21965
|
+
this.MOUSE_MIDDLE_BUTTON = 261;
|
|
21966
|
+
|
|
21967
|
+
/**
|
|
21968
|
+
* Code for the right mouse button.
|
|
21969
|
+
* @property MOUSE_RIGHT_BUTTON
|
|
21970
|
+
* @final
|
|
21971
|
+
* @type {Number}
|
|
21972
|
+
*/
|
|
21973
|
+
this.MOUSE_RIGHT_BUTTON = 262;
|
|
21974
|
+
|
|
21951
21975
|
/**
|
|
21952
21976
|
* The canvas element that mouse and keyboards are bound to.
|
|
21953
21977
|
*
|
|
@@ -97406,6 +97430,7 @@ class MousePanRotateDollyHandler {
|
|
|
97406
97430
|
this._scene = scene;
|
|
97407
97431
|
|
|
97408
97432
|
const pickController = controllers.pickController;
|
|
97433
|
+
const cameraControl = controllers.cameraControl;
|
|
97409
97434
|
|
|
97410
97435
|
let lastX = 0;
|
|
97411
97436
|
let lastY = 0;
|
|
@@ -97470,6 +97495,15 @@ class MousePanRotateDollyHandler {
|
|
|
97470
97495
|
}
|
|
97471
97496
|
}
|
|
97472
97497
|
|
|
97498
|
+
function isPanning() {
|
|
97499
|
+
return cameraControl._isKeyDownForAction(cameraControl.MOUSE_PAN, keyDown);
|
|
97500
|
+
}
|
|
97501
|
+
|
|
97502
|
+
function isRotating() {
|
|
97503
|
+
return cameraControl._isKeyDownForAction(cameraControl.MOUSE_ROTATE, keyDown);
|
|
97504
|
+
}
|
|
97505
|
+
|
|
97506
|
+
|
|
97473
97507
|
canvas.addEventListener("mousedown", this._mouseDownHandler = (e) => {
|
|
97474
97508
|
|
|
97475
97509
|
if (!(configs.active && configs.pointerEnabled)) {
|
|
@@ -97483,12 +97517,14 @@ class MousePanRotateDollyHandler {
|
|
|
97483
97517
|
if (keyDown[scene.input.KEY_SHIFT] || configs.planView) {
|
|
97484
97518
|
|
|
97485
97519
|
mouseDownLeft = true;
|
|
97520
|
+
keyDown[scene.input.MOUSE_LEFT_BUTTON] = true;
|
|
97486
97521
|
|
|
97487
97522
|
setMousedownState();
|
|
97488
97523
|
|
|
97489
97524
|
} else {
|
|
97490
97525
|
|
|
97491
97526
|
mouseDownLeft = true;
|
|
97527
|
+
keyDown[scene.input.MOUSE_LEFT_BUTTON] = true;
|
|
97492
97528
|
|
|
97493
97529
|
setMousedownState(false);
|
|
97494
97530
|
}
|
|
@@ -97498,6 +97534,7 @@ class MousePanRotateDollyHandler {
|
|
|
97498
97534
|
case 2: // Middle/both buttons
|
|
97499
97535
|
|
|
97500
97536
|
mouseDownMiddle = true;
|
|
97537
|
+
keyDown[scene.input.MOUSE_MIDDLE_BUTTON] = true;
|
|
97501
97538
|
|
|
97502
97539
|
setMousedownState();
|
|
97503
97540
|
|
|
@@ -97506,6 +97543,7 @@ class MousePanRotateDollyHandler {
|
|
|
97506
97543
|
case 3: // Right button
|
|
97507
97544
|
|
|
97508
97545
|
mouseDownRight = true;
|
|
97546
|
+
keyDown[scene.input.MOUSE_RIGHT_BUTTON] = true;
|
|
97509
97547
|
|
|
97510
97548
|
if (configs.panRightClick) {
|
|
97511
97549
|
|
|
@@ -97535,7 +97573,8 @@ class MousePanRotateDollyHandler {
|
|
|
97535
97573
|
const x = states.pointerCanvasPos[0];
|
|
97536
97574
|
const y = states.pointerCanvasPos[1];
|
|
97537
97575
|
|
|
97538
|
-
const panning =
|
|
97576
|
+
const panning = isPanning();
|
|
97577
|
+
const rotating = isRotating();
|
|
97539
97578
|
|
|
97540
97579
|
const xDelta = document.pointerLockElement ? e.movementX : (x - lastX);
|
|
97541
97580
|
const yDelta = document.pointerLockElement ? e.movementY : (y - lastY);
|
|
@@ -97560,7 +97599,7 @@ class MousePanRotateDollyHandler {
|
|
|
97560
97599
|
updates.panDeltaY += 0.5 * camera.ortho.scale * (yDelta / canvasHeight);
|
|
97561
97600
|
}
|
|
97562
97601
|
|
|
97563
|
-
} else if (
|
|
97602
|
+
} else if (rotating) {
|
|
97564
97603
|
|
|
97565
97604
|
if (!configs.planView) { // No rotating in plan-view mode
|
|
97566
97605
|
|
|
@@ -97601,16 +97640,25 @@ class MousePanRotateDollyHandler {
|
|
|
97601
97640
|
mouseDownLeft = false;
|
|
97602
97641
|
mouseDownMiddle = false;
|
|
97603
97642
|
mouseDownRight = false;
|
|
97643
|
+
keyDown[scene.input.MOUSE_LEFT_BUTTON] = false;
|
|
97644
|
+
keyDown[scene.input.MOUSE_MIDDLE_BUTTON] = false;
|
|
97645
|
+
keyDown[scene.input.MOUSE_RIGHT_BUTTON] = false;
|
|
97604
97646
|
break;
|
|
97605
97647
|
case 2: // Middle/both buttons
|
|
97606
97648
|
mouseDownLeft = false;
|
|
97607
97649
|
mouseDownMiddle = false;
|
|
97608
97650
|
mouseDownRight = false;
|
|
97651
|
+
keyDown[scene.input.MOUSE_LEFT_BUTTON] = false;
|
|
97652
|
+
keyDown[scene.input.MOUSE_MIDDLE_BUTTON] = false;
|
|
97653
|
+
keyDown[scene.input.MOUSE_RIGHT_BUTTON] = false;
|
|
97609
97654
|
break;
|
|
97610
97655
|
case 3: // Right button
|
|
97611
97656
|
mouseDownLeft = false;
|
|
97612
97657
|
mouseDownMiddle = false;
|
|
97613
97658
|
mouseDownRight = false;
|
|
97659
|
+
keyDown[scene.input.MOUSE_LEFT_BUTTON] = false;
|
|
97660
|
+
keyDown[scene.input.MOUSE_MIDDLE_BUTTON] = false;
|
|
97661
|
+
keyDown[scene.input.MOUSE_RIGHT_BUTTON] = false;
|
|
97614
97662
|
break;
|
|
97615
97663
|
}
|
|
97616
97664
|
});
|
|
@@ -97648,7 +97696,7 @@ class MousePanRotateDollyHandler {
|
|
|
97648
97696
|
let secsNowLast = null;
|
|
97649
97697
|
|
|
97650
97698
|
canvas.addEventListener("wheel", this._mouseWheelHandler = (e) => {
|
|
97651
|
-
if (!(configs.active && configs.pointerEnabled && configs.zoomOnMouseWheel)) {
|
|
97699
|
+
if (!(configs.active && configs.pointerEnabled && configs.zoomOnMouseWheel && cameraControl._isKeyDownForAction(cameraControl.MOUSE_DOLLY, keyDown))) {
|
|
97652
97700
|
return;
|
|
97653
97701
|
}
|
|
97654
97702
|
const secsNow = performance.now() / 1000.0;
|
|
@@ -97829,6 +97877,7 @@ class MousePickHandler {
|
|
|
97829
97877
|
this._clicks = 0;
|
|
97830
97878
|
this._timeout = null;
|
|
97831
97879
|
this._lastPickedEntityId = null;
|
|
97880
|
+
this._lastClickedWorldPos = null;
|
|
97832
97881
|
|
|
97833
97882
|
let leftDown = false;
|
|
97834
97883
|
let rightDown = false;
|
|
@@ -97978,11 +98027,16 @@ class MousePickHandler {
|
|
|
97978
98027
|
if (pickResult && pickResult.worldPos) {
|
|
97979
98028
|
pivotController.setPivotPos(pickResult.worldPos);
|
|
97980
98029
|
pivotController.startPivot();
|
|
98030
|
+
this._lastClickedWorldPos = pickResult.worldPos.slice();
|
|
97981
98031
|
} else {
|
|
97982
98032
|
if (configs.smartPivot) {
|
|
97983
98033
|
pivotController.setCanvasPivotPos(states.pointerCanvasPos);
|
|
97984
98034
|
} else {
|
|
97985
|
-
|
|
98035
|
+
if (this._lastClickedWorldPos) {
|
|
98036
|
+
pivotController.setPivotPos(this._lastClickedWorldPos);
|
|
98037
|
+
} else {
|
|
98038
|
+
pivotController.setPivotPos(scene.camera.look);
|
|
98039
|
+
}
|
|
97986
98040
|
}
|
|
97987
98041
|
pivotController.startPivot();
|
|
97988
98042
|
}
|
|
@@ -99698,6 +99752,12 @@ const DEFAULT_SNAP_EDGE = true;
|
|
|
99698
99752
|
* keyMap[cameraControl.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];
|
|
99699
99753
|
* keyMap[cameraControl.AXIS_VIEW_TOP] = [input.KEY_NUM_5];
|
|
99700
99754
|
* keyMap[cameraControl.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];
|
|
99755
|
+
* keyMap[cameraControl.MOUSE_PAN] = [[input.KEY_SHIFT, input.MOUSE_LEFT_BUTTON]];
|
|
99756
|
+
* keyMap[cameraControl.MOUSE_ROTATE] = [
|
|
99757
|
+
* [input.KEY_SHIFT, input.MOUSE_MIDDLE_BUTTON],
|
|
99758
|
+
* [input.KEY_SHIFT, input.MOUSE_RIGHT_BUTTON]
|
|
99759
|
+
* ]
|
|
99760
|
+
* keyMap[cameraControl.MOUSE_DOLLY] = [[input.KEY_CTRL, input.MOUSE_RIGHT_BUTTON]];
|
|
99701
99761
|
*
|
|
99702
99762
|
* cameraControl.keyMap = keyMap;
|
|
99703
99763
|
* ````
|
|
@@ -99716,6 +99776,70 @@ const DEFAULT_SNAP_EDGE = true;
|
|
|
99716
99776
|
*
|
|
99717
99777
|
* * ````"qwerty"````
|
|
99718
99778
|
* * ````"azerty"````
|
|
99779
|
+
*
|
|
99780
|
+
* ## Basic Keyboard Mapping
|
|
99781
|
+
* * ````"OR" Relation````
|
|
99782
|
+
* Set multiple keys to trigger an action if any one is pressed:
|
|
99783
|
+
*
|
|
99784
|
+
* ````javascript
|
|
99785
|
+
* keyMap[cameraControl.DOLLY_BACKWARDS] = [input.KEY_S, input.KEY_SUBTRACT];
|
|
99786
|
+
* ````
|
|
99787
|
+
*
|
|
99788
|
+
* If either ````KEY_S```` or ````KEY_SUBTRACT```` is pressed, the camera will dolly backward.
|
|
99789
|
+
*
|
|
99790
|
+
* * ````"AND" Relation````
|
|
99791
|
+
* To require all keys in a combination to be pressed:
|
|
99792
|
+
*
|
|
99793
|
+
* ````javascript
|
|
99794
|
+
* keyMap[cameraControl.DOLLY_BACKWARDS] = [[input.KEY_S, input.KEY_SUBTRACT]];
|
|
99795
|
+
* ````
|
|
99796
|
+
*
|
|
99797
|
+
* The camera will dolly backward if ````both KEY_S```` and ````KEY_SUBTRACT```` are pressed.
|
|
99798
|
+
*
|
|
99799
|
+
* * ````Mix "AND" and "OR" Relation````
|
|
99800
|
+
* Use a combination of keys and groups for flexibility:
|
|
99801
|
+
*
|
|
99802
|
+
* ````javascript
|
|
99803
|
+
* keyMap[cameraControl.DOLLY_BACKWARDS] = [
|
|
99804
|
+
* [input.KEY_S, input.KEY_SUBTRACT], // 'And' group
|
|
99805
|
+
* input.KEY_SHIFT // 'Or' with previous
|
|
99806
|
+
* ];
|
|
99807
|
+
* ````
|
|
99808
|
+
*
|
|
99809
|
+
* The camera will dolly backward if ````KEY_S```` + ````KEY_SUBTRACT```` are pressed together, or if ````KEY_SHIFT```` is pressed.
|
|
99810
|
+
*
|
|
99811
|
+
* ## Special Mouse Actions
|
|
99812
|
+
* Certain actions support combinations with specific mouse buttons or events:
|
|
99813
|
+
*
|
|
99814
|
+
* * ````MOUSE_PAN````
|
|
99815
|
+
* For panning with a key and mouse movement:
|
|
99816
|
+
*
|
|
99817
|
+
* ````javascript
|
|
99818
|
+
* keyMap[cameraControl.MOUSE_PAN] = [[input.KEY_SHIFT, input.MOUSE_LEFT_BUTTON]];
|
|
99819
|
+
* ````
|
|
99820
|
+
*
|
|
99821
|
+
* Panning is triggered by pressing ````KEY_SHIFT```` + ````MOUSE_LEFT_BUTTON```` while moving the mouse.
|
|
99822
|
+
*
|
|
99823
|
+
* * ````MOUSE_ROTATE````
|
|
99824
|
+
* Similar to panning, rotation can be configured with key and mouse button combinations:
|
|
99825
|
+
*
|
|
99826
|
+
* ````javascript
|
|
99827
|
+
* keyMap[cameraControl.MOUSE_ROTATE] = [[input.KEY_CTRL, input.MOUSE_LEFT_BUTTON]];
|
|
99828
|
+
* ````
|
|
99829
|
+
*
|
|
99830
|
+
* Rotation is triggered by pressing ````KEY_CTRL```` + ````MOUSE_LEFT_BUTTON```` during mouse movement.
|
|
99831
|
+
*
|
|
99832
|
+
* * ````MOUSE_DOLLY````
|
|
99833
|
+
* Dolly with mouse wheel scrolling and optional key combinations:
|
|
99834
|
+
*
|
|
99835
|
+
* ````javascript
|
|
99836
|
+
* keyMap[cameraControl.MOUSE_DOLLY] = [[input.KEY_ALT]];
|
|
99837
|
+
* ````
|
|
99838
|
+
*
|
|
99839
|
+
* Dolly action occurs when scrolling the mouse wheel with ````KEY_ALT```` held (no need to specify MOUSE_WHEEL).
|
|
99840
|
+
*
|
|
99841
|
+
* ## Special Mouse Actions
|
|
99842
|
+
* Use ````input.MOUSE_LEFT_BUTTON````, ````input.MOUSE_MIDDLE_BUTTON````, and ````input.MOUSE_RIGHT_BUTTON```` in combinations only for camera movements involving the mouse.
|
|
99719
99843
|
*/
|
|
99720
99844
|
class CameraControl extends Component {
|
|
99721
99845
|
|
|
@@ -99853,6 +99977,27 @@ class CameraControl extends Component {
|
|
|
99853
99977
|
*/
|
|
99854
99978
|
this.AXIS_VIEW_BOTTOM = 17;
|
|
99855
99979
|
|
|
99980
|
+
/**
|
|
99981
|
+
* Identifies the XX action.
|
|
99982
|
+
* @final
|
|
99983
|
+
* @type {Number}
|
|
99984
|
+
*/
|
|
99985
|
+
this.MOUSE_PAN = 18;
|
|
99986
|
+
|
|
99987
|
+
/**
|
|
99988
|
+
* Identifies the XX action.
|
|
99989
|
+
* @final
|
|
99990
|
+
* @type {Number}
|
|
99991
|
+
*/
|
|
99992
|
+
this.MOUSE_ROTATE = 19;
|
|
99993
|
+
|
|
99994
|
+
/**
|
|
99995
|
+
* Identifies the XX action.
|
|
99996
|
+
* @final
|
|
99997
|
+
* @type {Number}
|
|
99998
|
+
*/
|
|
99999
|
+
this.MOUSE_DOLLY = 20;
|
|
100000
|
+
|
|
99856
100001
|
this._keyMap = {}; // Maps key codes to the above actions
|
|
99857
100002
|
|
|
99858
100003
|
this.scene.canvas.canvas.oncontextmenu = (e) => {
|
|
@@ -100041,6 +100186,12 @@ class CameraControl extends Component {
|
|
|
100041
100186
|
keyMap[this.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];
|
|
100042
100187
|
keyMap[this.AXIS_VIEW_TOP] = [input.KEY_NUM_5];
|
|
100043
100188
|
keyMap[this.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];
|
|
100189
|
+
keyMap[this.MOUSE_PAN] = [
|
|
100190
|
+
[input.MOUSE_LEFT_BUTTON, input.KEY_SHIFT],
|
|
100191
|
+
this._configs.panRightClick ? input.MOUSE_RIGHT_BUTTON : input.MOUSE_MIDDLE_BUTTON
|
|
100192
|
+
];
|
|
100193
|
+
keyMap[this.MOUSE_ROTATE] = [input.MOUSE_LEFT_BUTTON];
|
|
100194
|
+
keyMap[this.MOUSE_DOLLY] = [];
|
|
100044
100195
|
break;
|
|
100045
100196
|
|
|
100046
100197
|
case "azerty":
|
|
@@ -100062,6 +100213,12 @@ class CameraControl extends Component {
|
|
|
100062
100213
|
keyMap[this.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];
|
|
100063
100214
|
keyMap[this.AXIS_VIEW_TOP] = [input.KEY_NUM_5];
|
|
100064
100215
|
keyMap[this.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];
|
|
100216
|
+
keyMap[this.MOUSE_PAN] = [
|
|
100217
|
+
[input.MOUSE_LEFT_BUTTON, input.KEY_SHIFT],
|
|
100218
|
+
this._configs.panRightClick ? input.MOUSE_RIGHT_BUTTON : input.MOUSE_MIDDLE_BUTTON
|
|
100219
|
+
];
|
|
100220
|
+
keyMap[this.MOUSE_ROTATE] = [input.MOUSE_LEFT_BUTTON];
|
|
100221
|
+
keyMap[this.MOUSE_DOLLY] = [];
|
|
100065
100222
|
break;
|
|
100066
100223
|
}
|
|
100067
100224
|
|
|
@@ -100081,6 +100238,44 @@ class CameraControl extends Component {
|
|
|
100081
100238
|
return this._keyMap;
|
|
100082
100239
|
}
|
|
100083
100240
|
|
|
100241
|
+
_areAllKeysDown(keyDownMap, keys) {
|
|
100242
|
+
if (!keys || keys.length <= 0) {
|
|
100243
|
+
return true;
|
|
100244
|
+
}
|
|
100245
|
+
if (!keyDownMap) {
|
|
100246
|
+
return false;
|
|
100247
|
+
}
|
|
100248
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
100249
|
+
const key = keys[i];
|
|
100250
|
+
if (!keyDownMap[key])
|
|
100251
|
+
return false;
|
|
100252
|
+
}
|
|
100253
|
+
return true;
|
|
100254
|
+
}
|
|
100255
|
+
|
|
100256
|
+
_isAnyOtherKeyDown(keyDownMap, keyMap) {
|
|
100257
|
+
for (let i = 0, len = keyDownMap.length; i < len; i++) {
|
|
100258
|
+
if (keyDownMap[i]) {
|
|
100259
|
+
if (Array.isArray(keyMap)) {
|
|
100260
|
+
if (keyMap.indexOf(i) < 0) return true;
|
|
100261
|
+
}
|
|
100262
|
+
else if (i !== keyMap) return true;
|
|
100263
|
+
}
|
|
100264
|
+
}
|
|
100265
|
+
return false;
|
|
100266
|
+
}
|
|
100267
|
+
|
|
100268
|
+
_isMouseAction(action) {
|
|
100269
|
+
switch (action) {
|
|
100270
|
+
case this.MOUSE_ROTATE:
|
|
100271
|
+
case this.MOUSE_DOLLY:
|
|
100272
|
+
case this.MOUSE_PAN:
|
|
100273
|
+
return true;
|
|
100274
|
+
default:
|
|
100275
|
+
return false;
|
|
100276
|
+
}
|
|
100277
|
+
}
|
|
100278
|
+
|
|
100084
100279
|
/**
|
|
100085
100280
|
* Returns true if any keys configured for the given action are down.
|
|
100086
100281
|
* @param action
|
|
@@ -100092,14 +100287,21 @@ class CameraControl extends Component {
|
|
|
100092
100287
|
if (!keys) {
|
|
100093
100288
|
return false;
|
|
100094
100289
|
}
|
|
100290
|
+
if (keys.length === 0 && this._isMouseAction(action)) return true;
|
|
100095
100291
|
if (!keyDownMap) {
|
|
100096
100292
|
keyDownMap = this.scene.input.keyDown;
|
|
100097
100293
|
}
|
|
100098
100294
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
100099
100295
|
const key = keys[i];
|
|
100100
|
-
if (
|
|
100101
|
-
|
|
100296
|
+
if (!Array.isArray(key)) {
|
|
100297
|
+
if (keyDownMap[key] && !this._isAnyOtherKeyDown(keyDownMap, key))
|
|
100298
|
+
return true;
|
|
100299
|
+
}
|
|
100300
|
+
else {
|
|
100301
|
+
if (this._areAllKeysDown(keyDownMap, key) && !this._isAnyOtherKeyDown(keyDownMap, key))
|
|
100302
|
+
return true;
|
|
100102
100303
|
}
|
|
100304
|
+
|
|
100103
100305
|
}
|
|
100104
100306
|
return false;
|
|
100105
100307
|
}
|
|
@@ -100535,6 +100737,16 @@ class CameraControl extends Component {
|
|
|
100535
100737
|
*/
|
|
100536
100738
|
set panRightClick(value) {
|
|
100537
100739
|
this._configs.panRightClick = value !== false;
|
|
100740
|
+
const panKeyMap = this._keyMap[this.MOUSE_PAN];
|
|
100741
|
+
if (panKeyMap && panKeyMap.length > 0) {
|
|
100742
|
+
const input = this.scene.input;
|
|
100743
|
+
for (let i = 0, len = panKeyMap.length; i < len; i++) {
|
|
100744
|
+
if (this._configs.panRightClick && panKeyMap[i] === input.MOUSE_MIDDLE_BUTTON)
|
|
100745
|
+
this._keyMap[this.MOUSE_PAN][i] = input.MOUSE_RIGHT_BUTTON;
|
|
100746
|
+
else if (!this._configs.panRightClick && panKeyMap[i] === input.MOUSE_RIGHT_BUTTON)
|
|
100747
|
+
this._keyMap[this.MOUSE_PAN][i] = input.MOUSE_MIDDLE_BUTTON;
|
|
100748
|
+
}
|
|
100749
|
+
}
|
|
100538
100750
|
}
|
|
100539
100751
|
|
|
100540
100752
|
/**
|
|
@@ -110469,19 +110681,15 @@ class Viewer {
|
|
|
110469
110681
|
|
|
110470
110682
|
for (let i = 0, len = pluginContainerElements.length; i < len; i++) {
|
|
110471
110683
|
const containerElement = pluginContainerElements[i];
|
|
110472
|
-
//only calculate the scale for first plugin
|
|
110473
|
-
//for all others keep the scale 1 otherwise it will keep multiplying the scale with the base scale of canvas
|
|
110474
|
-
//resulting in increase/decreased size for the the canvas that is being overlapped
|
|
110475
|
-
const scale = i == 0 ? snapshotCanvas.width / containerElement.clientWidth : 1;
|
|
110476
|
-
const off = math.vec2([ 0, 0 ]);
|
|
110477
|
-
transformToNode(canvas, containerElement, off);
|
|
110478
110684
|
await html2canvas(containerElement, {
|
|
110479
110685
|
canvas: snapshotCanvas,
|
|
110480
110686
|
backgroundColor: null,
|
|
110481
|
-
|
|
110482
|
-
y: off[1],
|
|
110483
|
-
scale
|
|
110687
|
+
scale: snapshotCanvas.width / containerElement.clientWidth
|
|
110484
110688
|
});
|
|
110689
|
+
// Reverts translation and scaling applied to the snapshotCanvas's context
|
|
110690
|
+
// by the html2canvas call (inside the ForeignObjectRenderer's constructor)
|
|
110691
|
+
// (implemented to compensate XCD-153 issue)
|
|
110692
|
+
snapshotCanvas.getContext("2d").resetTransform();
|
|
110485
110693
|
}
|
|
110486
110694
|
if (!params.includeGizmos) {
|
|
110487
110695
|
this.sendToPlugins("snapshotFinished");
|
|
@@ -123729,9 +123937,10 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123729
123937
|
* @param {Number[]} worldPos 3D World-space position.
|
|
123730
123938
|
* @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
|
|
123731
123939
|
*/
|
|
123732
|
-
getStoreyContainingWorldPos(worldPos) {
|
|
123733
|
-
|
|
123734
|
-
|
|
123940
|
+
getStoreyContainingWorldPos(worldPos, modelId = null) {
|
|
123941
|
+
const storeys = modelId ? this._filterStoreys(modelId) : this.storeys;
|
|
123942
|
+
for (let storeyId in storeys) {
|
|
123943
|
+
const storey = storeys[storeyId];
|
|
123735
123944
|
if (math.point3AABB3AbsoluteIntersect(storey.storeyAABB, worldPos)) {
|
|
123736
123945
|
return storeyId;
|
|
123737
123946
|
}
|
|
@@ -123745,9 +123954,10 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123745
123954
|
* @param {Number[]} worldPos 3D World-space position.
|
|
123746
123955
|
* @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
|
|
123747
123956
|
*/
|
|
123748
|
-
getStoreyInVerticalRange(worldPos) {
|
|
123749
|
-
|
|
123750
|
-
|
|
123957
|
+
getStoreyInVerticalRange(worldPos, modelId = null) {
|
|
123958
|
+
const storeys = modelId ? this._filterStoreys(modelId) : this.storeys;
|
|
123959
|
+
for (let storeyId in storeys) {
|
|
123960
|
+
const storey = storeys[storeyId];
|
|
123751
123961
|
const aabb = [0, 0, 0, 0, 0, 0], pos = [0, 0, 0];
|
|
123752
123962
|
aabb[1] = storey.storeyAABB[1];
|
|
123753
123963
|
aabb[4] = storey.storeyAABB[4];
|
|
@@ -123765,12 +123975,14 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123765
123975
|
* @param {Number[]} worldPos 3D World-space position.
|
|
123766
123976
|
* @returns {String} ID of the lowest/highest story or null.
|
|
123767
123977
|
*/
|
|
123768
|
-
isPositionAboveOrBelowBuilding(worldPos) {
|
|
123769
|
-
const
|
|
123978
|
+
isPositionAboveOrBelowBuilding(worldPos, modelId = null) {
|
|
123979
|
+
const storeys = modelId ? this._filterStoreys(modelId) : this.storeys;
|
|
123980
|
+
const keys = Object.keys(storeys);
|
|
123981
|
+
if(keys.length <= 0) return null;
|
|
123770
123982
|
const ids = [keys[0], keys[keys.length - 1]];
|
|
123771
|
-
if (worldPos[1] <
|
|
123983
|
+
if (worldPos[1] < storeys[ids[0]].storeyAABB[1])
|
|
123772
123984
|
return ids[0];
|
|
123773
|
-
else if (worldPos[1] >
|
|
123985
|
+
else if (worldPos[1] > storeys[ids[1]].storeyAABB[4])
|
|
123774
123986
|
return ids[1];
|
|
123775
123987
|
return null;
|
|
123776
123988
|
}
|
|
@@ -123894,8 +124106,8 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123894
124106
|
|
|
123895
124107
|
if (storey1MetaObject && (storey1MetaObject.attributes && storey1MetaObject.attributes.elevation !== undefined) &&
|
|
123896
124108
|
storey2MetaObject && (storey2MetaObject.attributes && storey2MetaObject.attributes.elevation !== undefined)) {
|
|
123897
|
-
const elevation1 = storey1MetaObject.attributes.elevation;
|
|
123898
|
-
const elevation2 = storey2MetaObject.attributes.elevation;
|
|
124109
|
+
const elevation1 = Number.parseFloat(storey1MetaObject.attributes.elevation);
|
|
124110
|
+
const elevation2 = Number.parseFloat(storey2MetaObject.attributes.elevation);
|
|
123899
124111
|
if (elevation1 > elevation2) {
|
|
123900
124112
|
return -1;
|
|
123901
124113
|
}
|
|
@@ -123914,6 +124126,12 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123914
124126
|
}
|
|
123915
124127
|
});
|
|
123916
124128
|
}
|
|
124129
|
+
|
|
124130
|
+
_filterStoreys(modelId) {
|
|
124131
|
+
return Object.fromEntries(
|
|
124132
|
+
Object.entries(this.storeys).filter(([_, value]) => value.modelId === modelId)
|
|
124133
|
+
);
|
|
124134
|
+
}
|
|
123917
124135
|
}
|
|
123918
124136
|
|
|
123919
124137
|
const zeroVec = new Float64Array([0, 0, 1]);
|
|
@@ -127500,8 +127718,8 @@ class TreeViewPlugin extends Plugin {
|
|
|
127500
127718
|
|
|
127501
127719
|
if (storey1MetaObject && (storey1MetaObject.attributes && storey1MetaObject.attributes.elevation !== undefined) &&
|
|
127502
127720
|
storey2MetaObject && (storey2MetaObject.attributes && storey2MetaObject.attributes.elevation !== undefined)) {
|
|
127503
|
-
const elevation1 = storey1MetaObject.attributes.elevation;
|
|
127504
|
-
const elevation2 = storey2MetaObject.attributes.elevation;
|
|
127721
|
+
const elevation1 = Number.parseFloat(storey1MetaObject.attributes.elevation);
|
|
127722
|
+
const elevation2 = Number.parseFloat(storey2MetaObject.attributes.elevation);
|
|
127505
127723
|
if (elevation1 > elevation2) {
|
|
127506
127724
|
return -1;
|
|
127507
127725
|
}
|