@itwin/core-frontend 5.1.0-dev.61 → 5.1.0-dev.64
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/lib/cjs/AccuDraw.js +2 -2
- package/lib/cjs/AccuDraw.js.map +1 -1
- package/lib/cjs/AccuSnap.d.ts.map +1 -1
- package/lib/cjs/AccuSnap.js +13 -4
- package/lib/cjs/AccuSnap.js.map +1 -1
- package/lib/cjs/AuxCoordSys.js +1 -1
- package/lib/cjs/AuxCoordSys.js.map +1 -1
- package/lib/cjs/core-frontend.d.ts +1 -1
- package/lib/cjs/core-frontend.d.ts.map +1 -1
- package/lib/cjs/core-frontend.js.map +1 -1
- package/lib/cjs/internal/tile/RealityModelTileTree.d.ts +6 -4
- package/lib/cjs/internal/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/cjs/internal/tile/RealityModelTileTree.js +9 -7
- package/lib/cjs/internal/tile/RealityModelTileTree.js.map +1 -1
- package/lib/cjs/internal/tile/RealityTileLoader.d.ts +2 -2
- package/lib/cjs/internal/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/cjs/internal/tile/RealityTileLoader.js +10 -2
- package/lib/cjs/internal/tile/RealityTileLoader.js.map +1 -1
- package/lib/cjs/tile/RealityTile.d.ts +4 -0
- package/lib/cjs/tile/RealityTile.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTile.js +7 -0
- package/lib/cjs/tile/RealityTile.js.map +1 -1
- package/lib/cjs/tile/RealityTileTree.d.ts +4 -0
- package/lib/cjs/tile/RealityTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTileTree.js +4 -0
- package/lib/cjs/tile/RealityTileTree.js.map +1 -1
- package/lib/cjs/tile/TileGeometryCollector.d.ts +5 -0
- package/lib/cjs/tile/TileGeometryCollector.d.ts.map +1 -1
- package/lib/cjs/tile/TileGeometryCollector.js.map +1 -1
- package/lib/cjs/tile/TileTreeReference.d.ts +16 -2
- package/lib/cjs/tile/TileTreeReference.d.ts.map +1 -1
- package/lib/cjs/tile/TileTreeReference.js +10 -4
- package/lib/cjs/tile/TileTreeReference.js.map +1 -1
- package/lib/cjs/tools/ClipViewTool.d.ts.map +1 -1
- package/lib/cjs/tools/ClipViewTool.js +18 -7
- package/lib/cjs/tools/ClipViewTool.js.map +1 -1
- package/lib/cjs/tools/ElementSetTool.d.ts.map +1 -1
- package/lib/cjs/tools/ElementSetTool.js +2 -0
- package/lib/cjs/tools/ElementSetTool.js.map +1 -1
- package/lib/cjs/tools/IdleTool.d.ts.map +1 -1
- package/lib/cjs/tools/IdleTool.js +4 -1
- package/lib/cjs/tools/IdleTool.js.map +1 -1
- package/lib/cjs/tools/MeasureTool.d.ts.map +1 -1
- package/lib/cjs/tools/MeasureTool.js +4 -2
- package/lib/cjs/tools/MeasureTool.js.map +1 -1
- package/lib/cjs/tools/PrimitiveTool.d.ts.map +1 -1
- package/lib/cjs/tools/PrimitiveTool.js +2 -1
- package/lib/cjs/tools/PrimitiveTool.js.map +1 -1
- package/lib/cjs/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/cjs/tools/ToolAdmin.js +51 -16
- package/lib/cjs/tools/ToolAdmin.js.map +1 -1
- package/lib/cjs/tools/ToolAssistance.d.ts +1 -1
- package/lib/cjs/tools/ToolAssistance.js.map +1 -1
- package/lib/cjs/tools/ViewTool.d.ts.map +1 -1
- package/lib/cjs/tools/ViewTool.js +133 -37
- package/lib/cjs/tools/ViewTool.js.map +1 -1
- package/lib/esm/AccuDraw.js +2 -2
- package/lib/esm/AccuDraw.js.map +1 -1
- package/lib/esm/AccuSnap.d.ts.map +1 -1
- package/lib/esm/AccuSnap.js +13 -4
- package/lib/esm/AccuSnap.js.map +1 -1
- package/lib/esm/AuxCoordSys.js +1 -1
- package/lib/esm/AuxCoordSys.js.map +1 -1
- package/lib/esm/core-frontend.d.ts +1 -1
- package/lib/esm/core-frontend.d.ts.map +1 -1
- package/lib/esm/core-frontend.js.map +1 -1
- package/lib/esm/internal/tile/RealityModelTileTree.d.ts +6 -4
- package/lib/esm/internal/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/esm/internal/tile/RealityModelTileTree.js +10 -8
- package/lib/esm/internal/tile/RealityModelTileTree.js.map +1 -1
- package/lib/esm/internal/tile/RealityTileLoader.d.ts +2 -2
- package/lib/esm/internal/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/esm/internal/tile/RealityTileLoader.js +10 -2
- package/lib/esm/internal/tile/RealityTileLoader.js.map +1 -1
- package/lib/esm/tile/RealityTile.d.ts +4 -0
- package/lib/esm/tile/RealityTile.d.ts.map +1 -1
- package/lib/esm/tile/RealityTile.js +7 -0
- package/lib/esm/tile/RealityTile.js.map +1 -1
- package/lib/esm/tile/RealityTileTree.d.ts +4 -0
- package/lib/esm/tile/RealityTileTree.d.ts.map +1 -1
- package/lib/esm/tile/RealityTileTree.js +4 -0
- package/lib/esm/tile/RealityTileTree.js.map +1 -1
- package/lib/esm/tile/TileGeometryCollector.d.ts +5 -0
- package/lib/esm/tile/TileGeometryCollector.d.ts.map +1 -1
- package/lib/esm/tile/TileGeometryCollector.js.map +1 -1
- package/lib/esm/tile/TileTreeReference.d.ts +16 -2
- package/lib/esm/tile/TileTreeReference.d.ts.map +1 -1
- package/lib/esm/tile/TileTreeReference.js +10 -4
- package/lib/esm/tile/TileTreeReference.js.map +1 -1
- package/lib/esm/tools/ClipViewTool.d.ts.map +1 -1
- package/lib/esm/tools/ClipViewTool.js +18 -7
- package/lib/esm/tools/ClipViewTool.js.map +1 -1
- package/lib/esm/tools/ElementSetTool.d.ts.map +1 -1
- package/lib/esm/tools/ElementSetTool.js +2 -0
- package/lib/esm/tools/ElementSetTool.js.map +1 -1
- package/lib/esm/tools/IdleTool.d.ts.map +1 -1
- package/lib/esm/tools/IdleTool.js +4 -1
- package/lib/esm/tools/IdleTool.js.map +1 -1
- package/lib/esm/tools/MeasureTool.d.ts.map +1 -1
- package/lib/esm/tools/MeasureTool.js +4 -2
- package/lib/esm/tools/MeasureTool.js.map +1 -1
- package/lib/esm/tools/PrimitiveTool.d.ts.map +1 -1
- package/lib/esm/tools/PrimitiveTool.js +2 -1
- package/lib/esm/tools/PrimitiveTool.js.map +1 -1
- package/lib/esm/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/esm/tools/ToolAdmin.js +51 -16
- package/lib/esm/tools/ToolAdmin.js.map +1 -1
- package/lib/esm/tools/ToolAssistance.d.ts +1 -1
- package/lib/esm/tools/ToolAssistance.js.map +1 -1
- package/lib/esm/tools/ViewTool.d.ts.map +1 -1
- package/lib/esm/tools/ViewTool.js +133 -37
- package/lib/esm/tools/ViewTool.js.map +1 -1
- package/package.json +20 -20
|
@@ -132,11 +132,13 @@ class ViewingToolHandle {
|
|
|
132
132
|
}
|
|
133
133
|
// if we have a valid depth point, set the focus distance to
|
|
134
134
|
changeFocusFromDepthPoint() {
|
|
135
|
-
if (undefined
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
if (undefined === this._depthPoint)
|
|
136
|
+
return;
|
|
137
|
+
const view = this.viewTool.viewport?.view;
|
|
138
|
+
if (undefined === view)
|
|
139
|
+
return;
|
|
140
|
+
if (view.is3d() && view.isCameraOn)
|
|
141
|
+
view.changeFocusFromPoint(this._depthPoint); // set the focus distance to the depth point
|
|
140
142
|
}
|
|
141
143
|
}
|
|
142
144
|
exports.ViewingToolHandle = ViewingToolHandle;
|
|
@@ -628,11 +630,15 @@ class ViewManip extends ViewTool {
|
|
|
628
630
|
return inDynamics || (doUpdate && hitHandle.checkOneShot());
|
|
629
631
|
}
|
|
630
632
|
lensAngleMatches(angle, tolerance) {
|
|
631
|
-
const cameraView = this.viewport
|
|
633
|
+
const cameraView = this.viewport?.view;
|
|
634
|
+
if (undefined === cameraView)
|
|
635
|
+
return false;
|
|
632
636
|
return !cameraView.is3d() ? false : Math.abs(cameraView.calcLensAngle().radians - angle.radians) < tolerance;
|
|
633
637
|
}
|
|
634
638
|
get isZUp() {
|
|
635
|
-
const view = this.viewport
|
|
639
|
+
const view = this.viewport?.view;
|
|
640
|
+
if (undefined === view)
|
|
641
|
+
return true;
|
|
636
642
|
const viewX = view.getXVector();
|
|
637
643
|
const viewY = view.getXVector();
|
|
638
644
|
const zVec = core_geometry_1.Vector3d.unitZ();
|
|
@@ -776,9 +782,12 @@ class ViewTargetCenter extends ViewingToolHandle {
|
|
|
776
782
|
testHandleForHit(ptScreen, out) {
|
|
777
783
|
if (this.viewTool.isDraggingRequired)
|
|
778
784
|
return false; // Target center handle is not movable in this mode, but it's still nice to display the point we're rotating about...
|
|
779
|
-
const
|
|
785
|
+
const vp = this.viewTool.viewport;
|
|
786
|
+
if (undefined === vp)
|
|
787
|
+
return false;
|
|
788
|
+
const targetPt = vp.worldToView(this.viewTool.targetCenterWorld);
|
|
780
789
|
const distance = targetPt.distanceXY(ptScreen);
|
|
781
|
-
const locateThreshold =
|
|
790
|
+
const locateThreshold = vp.pixelsFromInches(0.15);
|
|
782
791
|
if (distance > locateThreshold)
|
|
783
792
|
return false;
|
|
784
793
|
out.distance = distance;
|
|
@@ -855,7 +864,10 @@ class HandleWithInertia extends ViewingToolHandle {
|
|
|
855
864
|
doManipulation(ev, inDynamics) {
|
|
856
865
|
if (ToolSettings_1.ToolSettings.viewingInertia.enabled && !inDynamics && undefined !== this._inertiaVec)
|
|
857
866
|
return this.beginAnimation();
|
|
858
|
-
const
|
|
867
|
+
const vp = ev.viewport;
|
|
868
|
+
if (undefined === vp)
|
|
869
|
+
return false;
|
|
870
|
+
const thisPtNpc = vp.worldToNpc(ev.point);
|
|
859
871
|
thisPtNpc.z = this._lastPtNpc.z;
|
|
860
872
|
this._inertiaVec = undefined;
|
|
861
873
|
if (this._lastPtNpc.isAlmostEqual(thisPtNpc, 1.0e-10))
|
|
@@ -868,7 +880,9 @@ class HandleWithInertia extends ViewingToolHandle {
|
|
|
868
880
|
this._duration = ToolSettings_1.ToolSettings.viewingInertia.duration;
|
|
869
881
|
if (this._duration.isTowardsFuture) { // ensure duration is towards future. Otherwise, don't start animation
|
|
870
882
|
this._end = core_bentley_1.BeTimePoint.fromNow(this._duration);
|
|
871
|
-
this.viewTool.viewport
|
|
883
|
+
const vp = this.viewTool.viewport;
|
|
884
|
+
if (undefined !== vp)
|
|
885
|
+
vp.setAnimator(this);
|
|
872
886
|
}
|
|
873
887
|
return true;
|
|
874
888
|
}
|
|
@@ -882,7 +896,10 @@ class HandleWithInertia extends ViewingToolHandle {
|
|
|
882
896
|
const pt = this._lastPtNpc.plusScaled(this._inertiaVec, remaining);
|
|
883
897
|
// if we're not moving any more, or if the duration has elapsed, we're done
|
|
884
898
|
if (remaining <= 0 || (this._lastPtNpc.minus(pt).magnitudeSquared() < .000001)) {
|
|
885
|
-
this.viewTool.viewport
|
|
899
|
+
const vp = this.viewTool.viewport;
|
|
900
|
+
if (undefined === vp)
|
|
901
|
+
return false;
|
|
902
|
+
vp.saveViewUndo();
|
|
886
903
|
return true; // remove this as the animator
|
|
887
904
|
}
|
|
888
905
|
this.perform(pt); // perform the viewing operation
|
|
@@ -896,10 +913,12 @@ class ViewPan extends HandleWithInertia {
|
|
|
896
913
|
get handleType() { return ViewHandleType.Pan; }
|
|
897
914
|
getHandleCursor() { return this.viewTool.inHandleModify ? IModelApp_1.IModelApp.viewManager.grabbingCursor : IModelApp_1.IModelApp.viewManager.grabCursor; }
|
|
898
915
|
firstPoint(ev) {
|
|
916
|
+
this._inertiaVec = undefined;
|
|
899
917
|
const tool = this.viewTool;
|
|
900
918
|
const vp = tool.viewport;
|
|
919
|
+
if (undefined === vp)
|
|
920
|
+
return false;
|
|
901
921
|
vp.worldToNpc(ev.point, this._lastPtNpc);
|
|
902
|
-
this._inertiaVec = undefined;
|
|
903
922
|
// if the camera is on, we need to find the element under the starting point to get the z
|
|
904
923
|
if (this.needDepthPoint(ev, false)) {
|
|
905
924
|
this.pickDepthPoint(ev);
|
|
@@ -921,6 +940,8 @@ class ViewPan extends HandleWithInertia {
|
|
|
921
940
|
perform(thisPtNpc) {
|
|
922
941
|
const tool = this.viewTool;
|
|
923
942
|
const vp = tool.viewport;
|
|
943
|
+
if (undefined === vp)
|
|
944
|
+
return false;
|
|
924
945
|
const view = vp.view;
|
|
925
946
|
const lastWorld = vp.npcToWorld(this._lastPtNpc);
|
|
926
947
|
const thisWorld = vp.npcToWorld(thisPtNpc);
|
|
@@ -939,7 +960,10 @@ class ViewPan extends HandleWithInertia {
|
|
|
939
960
|
}
|
|
940
961
|
/** @internal */
|
|
941
962
|
needDepthPoint(ev, _isPreview) {
|
|
942
|
-
|
|
963
|
+
const vp = ev.viewport;
|
|
964
|
+
if (undefined === vp)
|
|
965
|
+
return false;
|
|
966
|
+
return vp.isCameraOn && Tool_1.CoordSource.User === ev.coordsFrom;
|
|
943
967
|
}
|
|
944
968
|
}
|
|
945
969
|
/** ViewingToolHandle for performing the "rotate view" operation */
|
|
@@ -958,6 +982,8 @@ class ViewRotate extends HandleWithInertia {
|
|
|
958
982
|
this._inertiaVec = undefined;
|
|
959
983
|
const tool = this.viewTool;
|
|
960
984
|
const vp = ev.viewport;
|
|
985
|
+
if (undefined === vp)
|
|
986
|
+
return false;
|
|
961
987
|
this.pickDepthPoint(ev);
|
|
962
988
|
if (undefined !== this._depthPoint)
|
|
963
989
|
tool.setTargetCenterWorld(this._depthPoint, false, false);
|
|
@@ -972,6 +998,8 @@ class ViewRotate extends HandleWithInertia {
|
|
|
972
998
|
perform(ptNpc) {
|
|
973
999
|
const tool = this.viewTool;
|
|
974
1000
|
const vp = tool.viewport;
|
|
1001
|
+
if (undefined === vp)
|
|
1002
|
+
return false;
|
|
975
1003
|
if (this._anchorPtNpc.isAlmostEqual(ptNpc, 1.0e-2)) // too close to anchor pt
|
|
976
1004
|
ptNpc.setFrom(this._anchorPtNpc);
|
|
977
1005
|
const currentFrustum = vp.getFrustum(CoordSystem_1.CoordSystem.World, false);
|
|
@@ -1007,8 +1035,8 @@ class ViewRotate extends HandleWithInertia {
|
|
|
1007
1035
|
const xAxis = ToolSettings_1.ToolSettings.preserveWorldUp && !vp.viewingGlobe ? (undefined !== this._depthPoint ? vp.view.getUpVector(this._depthPoint) : core_geometry_1.Vector3d.unitZ()) : vp.rotation.getRow(1);
|
|
1008
1036
|
// Movement in screen y == rotation about screen X...
|
|
1009
1037
|
const yAxis = vp.rotation.getRow(0);
|
|
1010
|
-
const xRMatrix = xDelta ? core_geometry_1.Matrix3d.createRotationAroundVector(xAxis, core_geometry_1.Angle.createRadians(Math.PI / (viewRect.width / xDelta))) : core_geometry_1.Matrix3d.identity;
|
|
1011
|
-
const yRMatrix = yDelta ? core_geometry_1.Matrix3d.createRotationAroundVector(yAxis, core_geometry_1.Angle.createRadians(Math.PI / (viewRect.height / yDelta))) : core_geometry_1.Matrix3d.identity;
|
|
1038
|
+
const xRMatrix = (xDelta ? core_geometry_1.Matrix3d.createRotationAroundVector(xAxis, core_geometry_1.Angle.createRadians(Math.PI / (viewRect.width / xDelta))) : undefined) ?? core_geometry_1.Matrix3d.identity;
|
|
1039
|
+
const yRMatrix = (yDelta ? core_geometry_1.Matrix3d.createRotationAroundVector(yAxis, core_geometry_1.Angle.createRadians(Math.PI / (viewRect.height / yDelta))) : undefined) ?? core_geometry_1.Matrix3d.identity;
|
|
1012
1040
|
const worldRMatrix = yRMatrix.multiplyMatrixMatrix(xRMatrix);
|
|
1013
1041
|
const result = worldRMatrix.getAxisAndAngleOfRotation();
|
|
1014
1042
|
angle = core_geometry_1.Angle.createRadians(-result.angle.radians);
|
|
@@ -1039,11 +1067,14 @@ class ViewRotate extends HandleWithInertia {
|
|
|
1039
1067
|
}
|
|
1040
1068
|
/** @internal */
|
|
1041
1069
|
needDepthPoint(ev, _isPreview) {
|
|
1042
|
-
|
|
1070
|
+
const vp = ev.viewport;
|
|
1071
|
+
if (undefined === vp)
|
|
1072
|
+
return false;
|
|
1073
|
+
return (!this.viewTool.targetCenterLocked && vp.view.allow3dManipulations());
|
|
1043
1074
|
}
|
|
1044
1075
|
/** @internal */
|
|
1045
1076
|
adjustDepthPoint(isValid, vp, plane, source) {
|
|
1046
|
-
if (vp.viewingGlobe && this.viewTool.isPointVisible(vp.iModel.ecefLocation.earthCenter)) {
|
|
1077
|
+
if (vp.viewingGlobe && vp.iModel.ecefLocation && this.viewTool.isPointVisible(vp.iModel.ecefLocation.earthCenter)) {
|
|
1047
1078
|
plane.getOriginRef().setFrom(vp.iModel.ecefLocation.earthCenter);
|
|
1048
1079
|
plane.getNormalRef().setFrom(vp.view.getZVector());
|
|
1049
1080
|
return true;
|
|
@@ -1070,6 +1101,8 @@ class ViewLook extends ViewingToolHandle {
|
|
|
1070
1101
|
firstPoint(ev) {
|
|
1071
1102
|
const tool = this.viewTool;
|
|
1072
1103
|
const vp = ev.viewport;
|
|
1104
|
+
if (undefined === vp)
|
|
1105
|
+
return true;
|
|
1073
1106
|
const view = vp.view;
|
|
1074
1107
|
if (!view || !view.is3d() || !view.allow3dManipulations())
|
|
1075
1108
|
return false;
|
|
@@ -1094,11 +1127,13 @@ class ViewLook extends ViewingToolHandle {
|
|
|
1094
1127
|
doManipulation(ev, _inDynamics) {
|
|
1095
1128
|
const tool = this.viewTool;
|
|
1096
1129
|
const viewport = tool.viewport;
|
|
1130
|
+
if (undefined === viewport)
|
|
1131
|
+
return false;
|
|
1097
1132
|
if (ev.viewport !== viewport)
|
|
1098
1133
|
return false;
|
|
1099
1134
|
const worldTransform = this.getLookTransform(viewport, this._firstPtView, ev.viewPoint);
|
|
1100
1135
|
const frustum = this._frustum.transformBy(worldTransform);
|
|
1101
|
-
|
|
1136
|
+
viewport.setupViewFromFrustum(frustum);
|
|
1102
1137
|
return true;
|
|
1103
1138
|
}
|
|
1104
1139
|
getLookTransform(vp, firstPt, currPt) {
|
|
@@ -1171,7 +1206,8 @@ class AnimatedHandle extends ViewingToolHandle {
|
|
|
1171
1206
|
}
|
|
1172
1207
|
this._lastPtView.setFrom(this._anchorPtView);
|
|
1173
1208
|
this._lastMotionTime = Date.now();
|
|
1174
|
-
tool.viewport
|
|
1209
|
+
if (undefined !== tool.viewport)
|
|
1210
|
+
tool.viewport.setAnimator(this);
|
|
1175
1211
|
return true;
|
|
1176
1212
|
}
|
|
1177
1213
|
getDirection() {
|
|
@@ -1180,10 +1216,13 @@ class AnimatedHandle extends ViewingToolHandle {
|
|
|
1180
1216
|
return dir.magnitudeSquared() < this._deadZone ? undefined : dir; // dead zone around starting point
|
|
1181
1217
|
}
|
|
1182
1218
|
getInputVector() {
|
|
1219
|
+
const vp = this.viewTool.viewport;
|
|
1220
|
+
if (undefined === vp)
|
|
1221
|
+
return undefined;
|
|
1183
1222
|
const dir = this.getDirection();
|
|
1184
1223
|
if (undefined === dir)
|
|
1185
1224
|
return undefined;
|
|
1186
|
-
const viewRect =
|
|
1225
|
+
const viewRect = vp.viewRect;
|
|
1187
1226
|
return new core_geometry_1.Vector3d(dir.x * (2.0 / viewRect.width), dir.y * (2.0 / viewRect.height));
|
|
1188
1227
|
}
|
|
1189
1228
|
onReinitialize() {
|
|
@@ -1259,6 +1298,8 @@ class ViewScroll extends AnimatedHandle {
|
|
|
1259
1298
|
dist.scaleInPlace(ToolSettings_1.ToolSettings.scrollSpeed * this.getElapsedTime());
|
|
1260
1299
|
const tool = this.viewTool;
|
|
1261
1300
|
const viewport = tool.viewport;
|
|
1301
|
+
if (undefined === viewport)
|
|
1302
|
+
return false;
|
|
1262
1303
|
if (viewport.isCameraOn) {
|
|
1263
1304
|
const points = new Array(2);
|
|
1264
1305
|
points[0] = this._anchorPtView.clone();
|
|
@@ -1279,7 +1320,10 @@ class ViewScroll extends AnimatedHandle {
|
|
|
1279
1320
|
}
|
|
1280
1321
|
/** @internal */
|
|
1281
1322
|
needDepthPoint(ev, _isPreview) {
|
|
1282
|
-
|
|
1323
|
+
const vp = ev.viewport;
|
|
1324
|
+
if (undefined === vp)
|
|
1325
|
+
return false;
|
|
1326
|
+
return vp.isCameraOn && Tool_1.CoordSource.User === ev.coordsFrom;
|
|
1283
1327
|
}
|
|
1284
1328
|
}
|
|
1285
1329
|
/** ViewingToolHandle for performing the "zoom view" operation */
|
|
@@ -1329,6 +1373,8 @@ class ViewZoom extends ViewingToolHandle {
|
|
|
1329
1373
|
}
|
|
1330
1374
|
firstPoint(ev) {
|
|
1331
1375
|
const vp = ev.viewport;
|
|
1376
|
+
if (undefined === vp)
|
|
1377
|
+
return false;
|
|
1332
1378
|
this.viewTool.inDynamicUpdate = true;
|
|
1333
1379
|
if (this.needDepthPoint(ev, false)) {
|
|
1334
1380
|
this.pickDepthPoint(ev);
|
|
@@ -1373,6 +1419,8 @@ class ViewZoom extends ViewingToolHandle {
|
|
|
1373
1419
|
if (undefined === this._startFrust || undefined === this.getDirection()) // on anchor point?
|
|
1374
1420
|
return false;
|
|
1375
1421
|
const viewport = this.viewTool.viewport;
|
|
1422
|
+
if (undefined === viewport)
|
|
1423
|
+
return false;
|
|
1376
1424
|
const view = viewport.view;
|
|
1377
1425
|
const thisPtNpc = viewport.viewToNpc(this._lastPtView);
|
|
1378
1426
|
const dist = this._anchorPtNpc.minus(thisPtNpc);
|
|
@@ -1399,7 +1447,10 @@ class ViewZoom extends ViewingToolHandle {
|
|
|
1399
1447
|
}
|
|
1400
1448
|
/** @internal */
|
|
1401
1449
|
needDepthPoint(ev, _isPreview) {
|
|
1402
|
-
|
|
1450
|
+
const vp = ev.viewport;
|
|
1451
|
+
if (undefined === vp)
|
|
1452
|
+
return false;
|
|
1453
|
+
return vp.isCameraOn && Tool_1.CoordSource.User === ev.coordsFrom;
|
|
1403
1454
|
}
|
|
1404
1455
|
}
|
|
1405
1456
|
/** @internal */
|
|
@@ -1463,11 +1514,17 @@ class NavigateMotion {
|
|
|
1463
1514
|
const yAngle = -(accumulator.y / yExtent) * Math.PI;
|
|
1464
1515
|
const viewRot = vp.rotation;
|
|
1465
1516
|
const invViewRot = viewRot.inverse();
|
|
1517
|
+
if (undefined === invViewRot)
|
|
1518
|
+
return core_geometry_1.Transform.createIdentity();
|
|
1466
1519
|
const pitchAngle = core_geometry_1.Angle.createRadians(this.modifyPitchAngleToPreventInversion(yAngle));
|
|
1467
1520
|
const pitchMatrix = core_geometry_1.Matrix3d.createRotationAroundVector(core_geometry_1.Vector3d.unitX(), pitchAngle);
|
|
1521
|
+
if (undefined === pitchMatrix)
|
|
1522
|
+
return core_geometry_1.Transform.createIdentity();
|
|
1468
1523
|
const pitchTimesView = pitchMatrix.multiplyMatrixMatrix(viewRot);
|
|
1469
1524
|
const inverseViewTimesPitchTimesView = invViewRot.multiplyMatrixMatrix(pitchTimesView);
|
|
1470
1525
|
const yawMatrix = core_geometry_1.Matrix3d.createRotationAroundVector(core_geometry_1.Vector3d.unitZ(), core_geometry_1.Angle.createRadians(xAngle));
|
|
1526
|
+
if (undefined === yawMatrix)
|
|
1527
|
+
return core_geometry_1.Transform.createIdentity();
|
|
1471
1528
|
const yawTimesInverseViewTimesPitchTimesView = yawMatrix.multiplyMatrixMatrix(inverseViewTimesPitchTimesView);
|
|
1472
1529
|
return core_geometry_1.Transform.createFixedPointAndMatrix(view.getEyePoint(), yawTimesInverseViewTimesPitchTimesView, result);
|
|
1473
1530
|
}
|
|
@@ -1478,11 +1535,17 @@ class NavigateMotion {
|
|
|
1478
1535
|
return core_geometry_1.Transform.createIdentity();
|
|
1479
1536
|
const viewRot = vp.rotation;
|
|
1480
1537
|
const invViewRot = viewRot.inverse();
|
|
1538
|
+
if (undefined === invViewRot)
|
|
1539
|
+
return core_geometry_1.Transform.createIdentity();
|
|
1481
1540
|
const pitchAngle = core_geometry_1.Angle.createRadians(this.modifyPitchAngleToPreventInversion(pitchRate * this._seconds));
|
|
1482
1541
|
const pitchMatrix = core_geometry_1.Matrix3d.createRotationAroundVector(core_geometry_1.Vector3d.unitX(), pitchAngle);
|
|
1542
|
+
if (undefined === pitchMatrix)
|
|
1543
|
+
return core_geometry_1.Transform.createIdentity();
|
|
1483
1544
|
const pitchTimesView = pitchMatrix.multiplyMatrixMatrix(viewRot);
|
|
1484
1545
|
const inverseViewTimesPitchTimesView = invViewRot.multiplyMatrixMatrix(pitchTimesView);
|
|
1485
1546
|
const yawMatrix = core_geometry_1.Matrix3d.createRotationAroundVector(core_geometry_1.Vector3d.unitZ(), core_geometry_1.Angle.createRadians(yawRate * this._seconds));
|
|
1547
|
+
if (undefined === yawMatrix)
|
|
1548
|
+
return core_geometry_1.Transform.createIdentity();
|
|
1486
1549
|
const yawTimesInverseViewTimesPitchTimesView = yawMatrix.multiplyMatrixMatrix(inverseViewTimesPitchTimesView);
|
|
1487
1550
|
return core_geometry_1.Transform.createFixedPointAndMatrix(view.getEyePoint(), yawTimesInverseViewTimesPitchTimesView, result);
|
|
1488
1551
|
}
|
|
@@ -1540,6 +1603,8 @@ class NavigateMotion {
|
|
|
1540
1603
|
if (!view.is3d() || !view.isCameraOn)
|
|
1541
1604
|
return;
|
|
1542
1605
|
const angles = core_geometry_1.YawPitchRollAngles.createFromMatrix3d(this.viewport.rotation);
|
|
1606
|
+
if (undefined === angles)
|
|
1607
|
+
return;
|
|
1543
1608
|
angles.pitch.setRadians(0); // reset pitch to zero
|
|
1544
1609
|
core_geometry_1.Transform.createFixedPointAndMatrix(view.getEyePoint(), angles.toMatrix3d(), this.transform);
|
|
1545
1610
|
}
|
|
@@ -1552,7 +1617,7 @@ class ViewNavigate extends AnimatedHandle {
|
|
|
1552
1617
|
getMaxAngularVelocity() { return Math.PI / 4; }
|
|
1553
1618
|
getNavigateMode() {
|
|
1554
1619
|
const state = IModelApp_1.IModelApp.toolAdmin.currentInputState;
|
|
1555
|
-
return (state.isShiftDown ||
|
|
1620
|
+
return (state.isShiftDown || (false === this.viewTool.viewport?.isCameraOn)) ? 0 /* NavigateMode.Pan */ :
|
|
1556
1621
|
state.isControlDown ? 1 /* NavigateMode.Look */ : 2 /* NavigateMode.Travel */;
|
|
1557
1622
|
}
|
|
1558
1623
|
// called in animation loop
|
|
@@ -1562,6 +1627,8 @@ class ViewNavigate extends AnimatedHandle {
|
|
|
1562
1627
|
const motion = this.getNavigateMotion(this.getElapsedTime());
|
|
1563
1628
|
if (undefined !== motion) {
|
|
1564
1629
|
const vp = this.viewTool.viewport;
|
|
1630
|
+
if (undefined === vp)
|
|
1631
|
+
return false;
|
|
1565
1632
|
const frust = vp.getWorldFrustum();
|
|
1566
1633
|
frust.multiply(motion.transform);
|
|
1567
1634
|
vp.setupViewFromFrustum(frust);
|
|
@@ -1633,6 +1700,7 @@ class ViewLookAndMove extends ViewNavigate {
|
|
|
1633
1700
|
_pointerLockKeyEngagementListener;
|
|
1634
1701
|
constructor(viewManip) {
|
|
1635
1702
|
super(viewManip);
|
|
1703
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1636
1704
|
this._navigateMotion = new NavigateMotion(this.viewTool.viewport);
|
|
1637
1705
|
}
|
|
1638
1706
|
get handleType() { return ViewHandleType.LookAndMove; }
|
|
@@ -1755,10 +1823,10 @@ class ViewLookAndMove extends ViewNavigate {
|
|
|
1755
1823
|
getMaxAngularVelocityY() { return this.getMaxAngularVelocity(); }
|
|
1756
1824
|
getLinearVelocity() {
|
|
1757
1825
|
const positionInput = core_geometry_1.Vector3d.create();
|
|
1758
|
-
const vp = this.viewTool.viewport;
|
|
1759
1826
|
const position = this.getTouchStartPosition(this._touchStartL);
|
|
1760
1827
|
if (undefined !== position) {
|
|
1761
|
-
const
|
|
1828
|
+
const vp = this.viewTool.viewport;
|
|
1829
|
+
const outerRadius = vp ? this.getTouchControlRadius(vp) : 1;
|
|
1762
1830
|
const offset = this.getTouchOffset(this._touchStartL, outerRadius);
|
|
1763
1831
|
const inputL = new core_geometry_1.Vector3d(offset.x * (1.0 / outerRadius), offset.y * (1.0 / outerRadius));
|
|
1764
1832
|
positionInput.x = inputL.x * this.getMaxLinearVelocity();
|
|
@@ -1773,10 +1841,10 @@ class ViewLookAndMove extends ViewNavigate {
|
|
|
1773
1841
|
}
|
|
1774
1842
|
getAngularVelocity() {
|
|
1775
1843
|
const angularInput = core_geometry_1.Vector3d.create();
|
|
1776
|
-
const vp = this.viewTool.viewport;
|
|
1777
1844
|
const position = this.getTouchStartPosition(this._touchStartR);
|
|
1778
1845
|
if (undefined !== position) {
|
|
1779
|
-
const
|
|
1846
|
+
const vp = this.viewTool.viewport;
|
|
1847
|
+
const outerRadius = vp ? this.getTouchControlRadius(vp) : 1;
|
|
1780
1848
|
const offset = this.getTouchOffset(this._touchStartR, outerRadius);
|
|
1781
1849
|
const inputA = new core_geometry_1.Vector3d(offset.x * (1.0 / outerRadius), offset.y * (1.0 / outerRadius));
|
|
1782
1850
|
angularInput.x = inputA.x * -this.getMaxAngularVelocityX();
|
|
@@ -2029,7 +2097,8 @@ class ViewLookAndMove extends ViewNavigate {
|
|
|
2029
2097
|
if (tool.inDynamicUpdate)
|
|
2030
2098
|
return;
|
|
2031
2099
|
tool.changeViewport(vp);
|
|
2032
|
-
tool.viewport
|
|
2100
|
+
if (undefined !== tool.viewport)
|
|
2101
|
+
tool.viewport.setAnimator(this);
|
|
2033
2102
|
tool.inDynamicUpdate = true;
|
|
2034
2103
|
tool.inHandleModify = true;
|
|
2035
2104
|
vp.npcToView(core_common_1.NpcCenter, this._anchorPtView);
|
|
@@ -2194,6 +2263,8 @@ class ViewLookAndMove extends ViewNavigate {
|
|
|
2194
2263
|
const position = this.getTouchStartPosition(touchStart);
|
|
2195
2264
|
if (undefined === position)
|
|
2196
2265
|
return offset;
|
|
2266
|
+
if (undefined === touchStart?.viewport)
|
|
2267
|
+
return offset;
|
|
2197
2268
|
const lastTouch = Tool_1.BeTouchEvent.findTouchById(this._touchLast.touchEvent.targetTouches, touchStart.touchEvent.changedTouches[0].identifier);
|
|
2198
2269
|
if (undefined === lastTouch)
|
|
2199
2270
|
return offset;
|
|
@@ -2409,6 +2480,7 @@ class ViewWalk extends ViewNavigate {
|
|
|
2409
2480
|
_navigateMotion;
|
|
2410
2481
|
constructor(viewManip) {
|
|
2411
2482
|
super(viewManip);
|
|
2483
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2412
2484
|
this._navigateMotion = new NavigateMotion(this.viewTool.viewport);
|
|
2413
2485
|
}
|
|
2414
2486
|
get handleType() { return ViewHandleType.Walk; }
|
|
@@ -2443,6 +2515,7 @@ class ViewFly extends ViewNavigate {
|
|
|
2443
2515
|
_navigateMotion;
|
|
2444
2516
|
constructor(viewManip) {
|
|
2445
2517
|
super(viewManip);
|
|
2518
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2446
2519
|
this._navigateMotion = new NavigateMotion(this.viewTool.viewport);
|
|
2447
2520
|
}
|
|
2448
2521
|
get handleType() { return ViewHandleType.Fly; }
|
|
@@ -3023,6 +3096,8 @@ class WindowAreaTool extends ViewTool {
|
|
|
3023
3096
|
}
|
|
3024
3097
|
computeWindowCorners() {
|
|
3025
3098
|
const vp = this.viewport;
|
|
3099
|
+
if (undefined === vp)
|
|
3100
|
+
return undefined;
|
|
3026
3101
|
const corners = this._corners;
|
|
3027
3102
|
corners[0].setFrom(this._firstPtWorld);
|
|
3028
3103
|
corners[1].setFrom(this._secondPtWorld);
|
|
@@ -3111,13 +3186,15 @@ class WindowAreaTool extends ViewTool {
|
|
|
3111
3186
|
const corners = this.computeWindowCorners();
|
|
3112
3187
|
if (undefined === corners)
|
|
3113
3188
|
return;
|
|
3114
|
-
let delta;
|
|
3115
3189
|
const vp = this.viewport;
|
|
3190
|
+
if (undefined === vp)
|
|
3191
|
+
return;
|
|
3116
3192
|
const view = vp.view;
|
|
3117
3193
|
vp.viewToWorldArray(corners);
|
|
3118
3194
|
const opts = {
|
|
3119
3195
|
onExtentsError: (stat) => view.outputStatusMessage(stat),
|
|
3120
3196
|
};
|
|
3197
|
+
let delta;
|
|
3121
3198
|
let globalAlignment;
|
|
3122
3199
|
if (view.is3d() && view.isCameraOn) {
|
|
3123
3200
|
const windowArray = [corners[0].clone(), corners[1].clone()];
|
|
@@ -3190,7 +3267,10 @@ class DefaultViewTouchTool extends ViewManip {
|
|
|
3190
3267
|
const vec = this._lastPtView.minus(pt);
|
|
3191
3268
|
// if we're not moving any more, or if the duration has elapsed, we're done
|
|
3192
3269
|
if (remaining <= 0 || (vec.magnitudeSquared() < .000001)) {
|
|
3193
|
-
this.viewport
|
|
3270
|
+
const vp = this.viewport;
|
|
3271
|
+
if (undefined === vp)
|
|
3272
|
+
return false;
|
|
3273
|
+
vp.saveViewUndo();
|
|
3194
3274
|
return true; // remove this as the animator
|
|
3195
3275
|
}
|
|
3196
3276
|
this._lastPtView.setFrom(pt);
|
|
@@ -3206,6 +3286,8 @@ class DefaultViewTouchTool extends ViewManip {
|
|
|
3206
3286
|
}
|
|
3207
3287
|
onStart(ev) {
|
|
3208
3288
|
const vp = this.viewport;
|
|
3289
|
+
if (undefined === vp)
|
|
3290
|
+
return;
|
|
3209
3291
|
vp.getWorldFrustum(this._frustum);
|
|
3210
3292
|
const visiblePoint = vp.pickNearestVisibleGeometry(ev.rawPoint);
|
|
3211
3293
|
if (undefined !== visiblePoint) {
|
|
@@ -3228,8 +3310,10 @@ class DefaultViewTouchTool extends ViewManip {
|
|
|
3228
3310
|
if (undefined === ev || 0.0 === this._startDistance)
|
|
3229
3311
|
return 1.0;
|
|
3230
3312
|
const vp = this.viewport;
|
|
3313
|
+
if (undefined === vp)
|
|
3314
|
+
return 1.0;
|
|
3231
3315
|
const distance = (2 === ev.touchCount ? Tool_1.BeTouchEvent.getTouchPosition(ev.touchEvent.targetTouches[0], vp).distance(Tool_1.BeTouchEvent.getTouchPosition(ev.touchEvent.targetTouches[1], vp)) : 0.0);
|
|
3232
|
-
const threshold =
|
|
3316
|
+
const threshold = vp.pixelsFromInches(ToolSettings_1.ToolSettings.touchZoomChangeThresholdInches);
|
|
3233
3317
|
if (0.0 === distance || Math.abs(this._startDistance - distance) < threshold)
|
|
3234
3318
|
return 1.0;
|
|
3235
3319
|
// Remove inertia if the viewing operation includes zoom, only use it for pan and rotate.
|
|
@@ -3241,6 +3325,8 @@ class DefaultViewTouchTool extends ViewManip {
|
|
|
3241
3325
|
if (undefined === ev || ev.touchCount < 2 || this._rotate2dDisabled)
|
|
3242
3326
|
return core_geometry_1.Angle.createDegrees(0.0);
|
|
3243
3327
|
const vp = this.viewport;
|
|
3328
|
+
if (undefined === vp)
|
|
3329
|
+
return core_geometry_1.Angle.createDegrees(0.0);
|
|
3244
3330
|
const direction = core_geometry_1.Vector2d.createStartEnd(Tool_1.BeTouchEvent.getTouchPosition(ev.touchEvent.targetTouches[0], vp), Tool_1.BeTouchEvent.getTouchPosition(ev.touchEvent.targetTouches[1], vp));
|
|
3245
3331
|
const rotation = this._startDirection.angleTo(direction);
|
|
3246
3332
|
if (undefined === this._rotate2dThreshold) {
|
|
@@ -3260,15 +3346,18 @@ class DefaultViewTouchTool extends ViewManip {
|
|
|
3260
3346
|
}
|
|
3261
3347
|
handle2dPan() {
|
|
3262
3348
|
const screenDist = core_geometry_1.Point2d.create(this._startPtView.x - this._lastPtView.x, this._startPtView.y - this._lastPtView.y);
|
|
3263
|
-
this.viewport
|
|
3349
|
+
if (undefined !== this.viewport)
|
|
3350
|
+
this.viewport.scroll(screenDist, { noSaveInUndo: true });
|
|
3264
3351
|
}
|
|
3265
3352
|
handle2dRotateZoom(ev) {
|
|
3266
3353
|
const vp = this.viewport;
|
|
3354
|
+
if (undefined === vp)
|
|
3355
|
+
return;
|
|
3267
3356
|
const rotation = this.computeRotation(ev);
|
|
3268
3357
|
const zoomRatio = this.computeZoomRatio(ev);
|
|
3269
3358
|
const targetWorld = vp.viewToWorld(this._lastPtView);
|
|
3270
3359
|
const translateTransform = core_geometry_1.Transform.createTranslation(this._startPtWorld.minus(targetWorld));
|
|
3271
|
-
const rotationTransform = core_geometry_1.Transform.createFixedPointAndMatrix(targetWorld, core_geometry_1.Matrix3d.createRotationAroundVector(vp.view.getZVector(), rotation));
|
|
3360
|
+
const rotationTransform = core_geometry_1.Transform.createFixedPointAndMatrix(targetWorld, core_geometry_1.Matrix3d.createRotationAroundVector(vp.view.getZVector(), rotation) ?? core_geometry_1.Matrix3d.identity);
|
|
3272
3361
|
const scaleTransform = core_geometry_1.Transform.createScaleAboutPoint(this._startPtWorld, zoomRatio);
|
|
3273
3362
|
const transform = translateTransform.multiplyTransformTransform(rotationTransform);
|
|
3274
3363
|
scaleTransform.multiplyTransformTransform(transform, transform);
|
|
@@ -3277,6 +3366,8 @@ class DefaultViewTouchTool extends ViewManip {
|
|
|
3277
3366
|
}
|
|
3278
3367
|
handle3dRotate() {
|
|
3279
3368
|
const vp = this.viewport;
|
|
3369
|
+
if (undefined === vp)
|
|
3370
|
+
return;
|
|
3280
3371
|
const viewRect = vp.viewRect;
|
|
3281
3372
|
const xExtent = viewRect.width;
|
|
3282
3373
|
const yExtent = viewRect.height;
|
|
@@ -3284,8 +3375,8 @@ class DefaultViewTouchTool extends ViewManip {
|
|
|
3284
3375
|
const yDelta = this._lastPtView.y - this._startPtView.y;
|
|
3285
3376
|
const xAxis = ToolSettings_1.ToolSettings.preserveWorldUp ? core_geometry_1.Vector3d.unitZ() : vp.rotation.getRow(1);
|
|
3286
3377
|
const yAxis = vp.rotation.getRow(0);
|
|
3287
|
-
const xRMatrix = (
|
|
3288
|
-
const yRMatrix = (
|
|
3378
|
+
const xRMatrix = (xDelta ? core_geometry_1.Matrix3d.createRotationAroundVector(xAxis, core_geometry_1.Angle.createRadians(Math.PI / (xExtent / xDelta))) : undefined) ?? core_geometry_1.Matrix3d.identity;
|
|
3379
|
+
const yRMatrix = (yDelta ? core_geometry_1.Matrix3d.createRotationAroundVector(yAxis, core_geometry_1.Angle.createRadians(Math.PI / (yExtent / yDelta))) : undefined) ?? core_geometry_1.Matrix3d.identity;
|
|
3289
3380
|
const worldRMatrix = yRMatrix.multiplyMatrixMatrix(xRMatrix);
|
|
3290
3381
|
const result = worldRMatrix.getAxisAndAngleOfRotation();
|
|
3291
3382
|
const radians = core_geometry_1.Angle.createRadians(-result.angle.radians);
|
|
@@ -3299,6 +3390,8 @@ class DefaultViewTouchTool extends ViewManip {
|
|
|
3299
3390
|
}
|
|
3300
3391
|
handle3dPanZoom(ev) {
|
|
3301
3392
|
const vp = this.viewport;
|
|
3393
|
+
if (undefined === vp)
|
|
3394
|
+
return;
|
|
3302
3395
|
const zoomRatio = this.computeZoomRatio(ev);
|
|
3303
3396
|
if (vp.isCameraOn) {
|
|
3304
3397
|
const targetWorld = vp.viewToWorld(this._lastPtView);
|
|
@@ -3357,6 +3450,8 @@ class DefaultViewTouchTool extends ViewManip {
|
|
|
3357
3450
|
}
|
|
3358
3451
|
perform(ev) {
|
|
3359
3452
|
const vp = this.viewport;
|
|
3453
|
+
if (undefined === vp)
|
|
3454
|
+
return;
|
|
3360
3455
|
vp.setupViewFromFrustum(this._frustum);
|
|
3361
3456
|
const singleTouch = this._singleTouch;
|
|
3362
3457
|
return (!this._only2dManipulations && vp.view.allow3dManipulations()) ?
|
|
@@ -3379,7 +3474,8 @@ class DefaultViewTouchTool extends ViewManip {
|
|
|
3379
3474
|
this._duration = ToolSettings_1.ToolSettings.viewingInertia.duration;
|
|
3380
3475
|
if (this._duration.isTowardsFuture) { // ensure duration is towards future. Otherwise, don't start animation
|
|
3381
3476
|
this._end = core_bentley_1.BeTimePoint.fromNow(this._duration);
|
|
3382
|
-
this.viewport
|
|
3477
|
+
if (undefined !== this.viewport)
|
|
3478
|
+
this.viewport.setAnimator(this);
|
|
3383
3479
|
}
|
|
3384
3480
|
}
|
|
3385
3481
|
return this.exitTool();
|