@itwin/core-frontend 5.12.0-dev.6 → 5.12.0-dev.7
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/CHANGELOG.md +6 -1
- package/lib/cjs/tools/AccuDrawShortcutTool.d.ts.map +1 -1
- package/lib/cjs/tools/AccuDrawShortcutTool.js +6 -2
- package/lib/cjs/tools/AccuDrawShortcutTool.js.map +1 -1
- package/lib/cjs/tools/AccuDrawTool.d.ts +109 -23
- package/lib/cjs/tools/AccuDrawTool.d.ts.map +1 -1
- package/lib/cjs/tools/AccuDrawTool.js +234 -34
- package/lib/cjs/tools/AccuDrawTool.js.map +1 -1
- package/lib/cjs/tools/ClipViewTool.d.ts +2 -1
- package/lib/cjs/tools/ClipViewTool.d.ts.map +1 -1
- package/lib/cjs/tools/ClipViewTool.js +8 -7
- package/lib/cjs/tools/ClipViewTool.js.map +1 -1
- package/lib/esm/tools/AccuDrawShortcutTool.d.ts.map +1 -1
- package/lib/esm/tools/AccuDrawShortcutTool.js +6 -2
- package/lib/esm/tools/AccuDrawShortcutTool.js.map +1 -1
- package/lib/esm/tools/AccuDrawTool.d.ts +109 -23
- package/lib/esm/tools/AccuDrawTool.d.ts.map +1 -1
- package/lib/esm/tools/AccuDrawTool.js +233 -34
- package/lib/esm/tools/AccuDrawTool.js.map +1 -1
- package/lib/esm/tools/ClipViewTool.d.ts +2 -1
- package/lib/esm/tools/ClipViewTool.d.ts.map +1 -1
- package/lib/esm/tools/ClipViewTool.js +9 -8
- package/lib/esm/tools/ClipViewTool.js.map +1 -1
- package/lib/public/locales/en/CoreTools.json +10 -0
- package/package.json +20 -20
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module Tools
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.DefineACSByPointsTool = exports.DefineACSByElementTool = exports.AccuDrawRotateElementTool = exports.AccuDrawRotateAxesTool = exports.AccuDrawRotate90AboutZTool = exports.AccuDrawRotate90AboutYTool = exports.AccuDrawRotate90AboutXTool = exports.AccuDrawRotateViewTool = exports.AccuDrawRotateSideTool = exports.AccuDrawRotateFrontTool = exports.AccuDrawRotateTopTool = exports.AccuDrawRotateCycleTool = exports.AccuDrawChangeModeTool = exports.AccuDrawSetLockAngleTool = exports.AccuDrawSetLockDistanceTool = exports.AccuDrawSetLockZTool = exports.AccuDrawSetLockYTool = exports.AccuDrawSetLockXTool = exports.AccuDrawSetLockIndexTool = exports.AccuDrawSetLockSmartTool = exports.AccuDrawSetOriginTool = exports.AccuDrawSuspendToggleTool = exports.AccuDrawSessionToggleTool = exports.AccuDrawShortcuts = void 0;
|
|
10
|
+
exports.DefineACSByPointsTool = exports.DefineACSByElementTool = exports.AccuDrawRotatePointsTool = exports.AccuDrawRotateElementTool = exports.AccuDrawRotateAxesTool = exports.AccuDrawRotate90AboutZTool = exports.AccuDrawRotate90AboutYTool = exports.AccuDrawRotate90AboutXTool = exports.AccuDrawRotateViewTool = exports.AccuDrawRotateSideTool = exports.AccuDrawRotateFrontTool = exports.AccuDrawRotateTopTool = exports.AccuDrawRotateCycleTool = exports.AccuDrawChangeModeTool = exports.AccuDrawSetLockAngleTool = exports.AccuDrawSetLockDistanceTool = exports.AccuDrawSetLockZTool = exports.AccuDrawSetLockYTool = exports.AccuDrawSetLockXTool = exports.AccuDrawSetLockIndexTool = exports.AccuDrawSetLockSmartTool = exports.AccuDrawSetOriginTool = exports.AccuDrawSuspendToggleTool = exports.AccuDrawSessionToggleTool = exports.AccuDrawShortcuts = void 0;
|
|
11
11
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
12
|
const core_geometry_1 = require("@itwin/core-geometry");
|
|
13
13
|
const AccuDraw_1 = require("../AccuDraw");
|
|
@@ -16,6 +16,7 @@ const AuxCoordSys_1 = require("../AuxCoordSys");
|
|
|
16
16
|
const IModelApp_1 = require("../IModelApp");
|
|
17
17
|
const Tool_1 = require("./Tool");
|
|
18
18
|
const AccuDrawShortcutTool_1 = require("./AccuDrawShortcutTool");
|
|
19
|
+
const GraphicType_1 = require("../common/render/GraphicType");
|
|
19
20
|
// cSpell:ignore dont unlockedz
|
|
20
21
|
function normalizedDifference(point1, point2, out) {
|
|
21
22
|
return point2.vectorTo(point1).normalizeWithLength(out).mag;
|
|
@@ -78,15 +79,13 @@ class AccuDrawShortcuts {
|
|
|
78
79
|
}
|
|
79
80
|
static updateACSByPoints(acs, vp, points, isDynamics) {
|
|
80
81
|
const accudraw = IModelApp_1.IModelApp.accuDraw;
|
|
81
|
-
if (!accudraw.isEnabled)
|
|
82
|
-
return false;
|
|
83
82
|
let accept = false;
|
|
84
83
|
const vec = [new core_geometry_1.Vector3d(), new core_geometry_1.Vector3d(), new core_geometry_1.Vector3d()];
|
|
85
84
|
acs.setOrigin(points[0]);
|
|
86
85
|
switch (points.length) {
|
|
87
86
|
case 1:
|
|
88
87
|
acs.setRotation(vp.rotation);
|
|
89
|
-
if (!isDynamics) {
|
|
88
|
+
if (!isDynamics && accudraw.isEnabled) {
|
|
90
89
|
accudraw.published.origin.setFrom(points[0]);
|
|
91
90
|
accudraw.published.flags = AccuDraw_1.AccuDrawFlags.SetOrigin;
|
|
92
91
|
accudraw.flags.fixedOrg = true;
|
|
@@ -98,7 +97,7 @@ class AccuDrawShortcuts {
|
|
|
98
97
|
break;
|
|
99
98
|
}
|
|
100
99
|
if (vp.view.is3d()) {
|
|
101
|
-
if (normalizedCrossProduct(accudraw.axes.y, vec[0], vec[1]) < 0.00001) {
|
|
100
|
+
if (accudraw.isEnabled && normalizedCrossProduct(accudraw.axes.y, vec[0], vec[1]) < 0.00001) {
|
|
102
101
|
vec[2].set(0.0, 0.0, 1.0);
|
|
103
102
|
if (normalizedCrossProduct(vec[2], vec[0], vec[1]) < 0.00001) {
|
|
104
103
|
vec[2].set(0.0, 1.0, 0.0);
|
|
@@ -107,7 +106,7 @@ class AccuDrawShortcuts {
|
|
|
107
106
|
}
|
|
108
107
|
normalizedCrossProduct(vec[0], vec[1], vec[2]);
|
|
109
108
|
acs.setRotation(core_geometry_1.Matrix3d.createRows(vec[0], vec[1], vec[2]));
|
|
110
|
-
if (!isDynamics) {
|
|
109
|
+
if (!isDynamics && accudraw.isEnabled) {
|
|
111
110
|
accudraw.published.origin.setFrom(points[0]);
|
|
112
111
|
accudraw.published.flags = AccuDraw_1.AccuDrawFlags.SetOrigin | AccuDraw_1.AccuDrawFlags.SetNormal;
|
|
113
112
|
accudraw.published.vector.setFrom(vec[0]);
|
|
@@ -829,7 +828,11 @@ class AccuDrawShortcuts {
|
|
|
829
828
|
}
|
|
830
829
|
}
|
|
831
830
|
exports.AccuDrawShortcuts = AccuDrawShortcuts;
|
|
832
|
-
/**
|
|
831
|
+
/**
|
|
832
|
+
* Immediate tool to toggle AccuDraw's availability for the current session.
|
|
833
|
+
* @note AccuDraw is enabled by default
|
|
834
|
+
* @beta
|
|
835
|
+
*/
|
|
833
836
|
class AccuDrawSessionToggleTool extends Tool_1.Tool {
|
|
834
837
|
static toolId = "AccuDraw.SessionToggle";
|
|
835
838
|
async run() {
|
|
@@ -838,7 +841,11 @@ class AccuDrawSessionToggleTool extends Tool_1.Tool {
|
|
|
838
841
|
}
|
|
839
842
|
}
|
|
840
843
|
exports.AccuDrawSessionToggleTool = AccuDrawSessionToggleTool;
|
|
841
|
-
/**
|
|
844
|
+
/**
|
|
845
|
+
* Immediate tool to toggle AccuDraw on/off temporarily for the current interactive tool.
|
|
846
|
+
* @note Typically used to disable AccuDraw for a single data button.
|
|
847
|
+
* @beta
|
|
848
|
+
*/
|
|
842
849
|
class AccuDrawSuspendToggleTool extends Tool_1.Tool {
|
|
843
850
|
static toolId = "AccuDraw.SuspendToggle";
|
|
844
851
|
async run() {
|
|
@@ -847,7 +854,11 @@ class AccuDrawSuspendToggleTool extends Tool_1.Tool {
|
|
|
847
854
|
}
|
|
848
855
|
}
|
|
849
856
|
exports.AccuDrawSuspendToggleTool = AccuDrawSuspendToggleTool;
|
|
850
|
-
/**
|
|
857
|
+
/**
|
|
858
|
+
* Immediate tool to enable AccuDraw and position it at the current AccuSnap or Tentative snap location.
|
|
859
|
+
* @note When not snapped, AccuDraw is activated at the last data button location when inactive, or moved to the current cursor location when active.
|
|
860
|
+
* @beta
|
|
861
|
+
*/
|
|
851
862
|
class AccuDrawSetOriginTool extends Tool_1.Tool {
|
|
852
863
|
static toolId = "AccuDraw.SetOrigin";
|
|
853
864
|
async run() {
|
|
@@ -856,7 +867,11 @@ class AccuDrawSetOriginTool extends Tool_1.Tool {
|
|
|
856
867
|
}
|
|
857
868
|
}
|
|
858
869
|
exports.AccuDrawSetOriginTool = AccuDrawSetOriginTool;
|
|
859
|
-
/**
|
|
870
|
+
/**
|
|
871
|
+
* Immediate tool to lock the closer of the x or y axis based on the current cursor location.
|
|
872
|
+
* @note When an axis is locked, points are projected onto the axis line.
|
|
873
|
+
* @beta
|
|
874
|
+
*/
|
|
860
875
|
class AccuDrawSetLockSmartTool extends Tool_1.Tool {
|
|
861
876
|
static toolId = "AccuDraw.LockSmart";
|
|
862
877
|
async run() {
|
|
@@ -865,7 +880,10 @@ class AccuDrawSetLockSmartTool extends Tool_1.Tool {
|
|
|
865
880
|
}
|
|
866
881
|
}
|
|
867
882
|
exports.AccuDrawSetLockSmartTool = AccuDrawSetLockSmartTool;
|
|
868
|
-
/**
|
|
883
|
+
/**
|
|
884
|
+
* Immediate tool to toggle the locked state of an indexed axis of the AccuDraw compass.
|
|
885
|
+
* @beta
|
|
886
|
+
*/
|
|
869
887
|
class AccuDrawSetLockIndexTool extends Tool_1.Tool {
|
|
870
888
|
static toolId = "AccuDraw.LockIndex";
|
|
871
889
|
async run() {
|
|
@@ -874,7 +892,10 @@ class AccuDrawSetLockIndexTool extends Tool_1.Tool {
|
|
|
874
892
|
}
|
|
875
893
|
}
|
|
876
894
|
exports.AccuDrawSetLockIndexTool = AccuDrawSetLockIndexTool;
|
|
877
|
-
/**
|
|
895
|
+
/**
|
|
896
|
+
* Immediate tool to toggle the locked state of the X text field.
|
|
897
|
+
* @beta
|
|
898
|
+
*/
|
|
878
899
|
class AccuDrawSetLockXTool extends Tool_1.Tool {
|
|
879
900
|
static toolId = "AccuDraw.LockX";
|
|
880
901
|
async run() {
|
|
@@ -883,7 +904,10 @@ class AccuDrawSetLockXTool extends Tool_1.Tool {
|
|
|
883
904
|
}
|
|
884
905
|
}
|
|
885
906
|
exports.AccuDrawSetLockXTool = AccuDrawSetLockXTool;
|
|
886
|
-
/**
|
|
907
|
+
/**
|
|
908
|
+
* Immediate tool to toggle the locked state of the Y text field.
|
|
909
|
+
* @beta
|
|
910
|
+
*/
|
|
887
911
|
class AccuDrawSetLockYTool extends Tool_1.Tool {
|
|
888
912
|
static toolId = "AccuDraw.LockY";
|
|
889
913
|
async run() {
|
|
@@ -892,7 +916,10 @@ class AccuDrawSetLockYTool extends Tool_1.Tool {
|
|
|
892
916
|
}
|
|
893
917
|
}
|
|
894
918
|
exports.AccuDrawSetLockYTool = AccuDrawSetLockYTool;
|
|
895
|
-
/**
|
|
919
|
+
/**
|
|
920
|
+
* Immediate tool to toggle the locked state of the Z text field.
|
|
921
|
+
* @beta
|
|
922
|
+
*/
|
|
896
923
|
class AccuDrawSetLockZTool extends Tool_1.Tool {
|
|
897
924
|
static toolId = "AccuDraw.LockZ";
|
|
898
925
|
async run() {
|
|
@@ -901,7 +928,10 @@ class AccuDrawSetLockZTool extends Tool_1.Tool {
|
|
|
901
928
|
}
|
|
902
929
|
}
|
|
903
930
|
exports.AccuDrawSetLockZTool = AccuDrawSetLockZTool;
|
|
904
|
-
/**
|
|
931
|
+
/**
|
|
932
|
+
* Immediate tool to toggle the locked state of the Distance text field.
|
|
933
|
+
* @beta
|
|
934
|
+
*/
|
|
905
935
|
class AccuDrawSetLockDistanceTool extends Tool_1.Tool {
|
|
906
936
|
static toolId = "AccuDraw.LockDistance";
|
|
907
937
|
async run() {
|
|
@@ -910,7 +940,10 @@ class AccuDrawSetLockDistanceTool extends Tool_1.Tool {
|
|
|
910
940
|
}
|
|
911
941
|
}
|
|
912
942
|
exports.AccuDrawSetLockDistanceTool = AccuDrawSetLockDistanceTool;
|
|
913
|
-
/**
|
|
943
|
+
/**
|
|
944
|
+
* Immediate tool to toggle the locked state of the Angle text field.
|
|
945
|
+
* @beta
|
|
946
|
+
*/
|
|
914
947
|
class AccuDrawSetLockAngleTool extends Tool_1.Tool {
|
|
915
948
|
static toolId = "AccuDraw.LockAngle";
|
|
916
949
|
async run() {
|
|
@@ -919,7 +952,10 @@ class AccuDrawSetLockAngleTool extends Tool_1.Tool {
|
|
|
919
952
|
}
|
|
920
953
|
}
|
|
921
954
|
exports.AccuDrawSetLockAngleTool = AccuDrawSetLockAngleTool;
|
|
922
|
-
/**
|
|
955
|
+
/**
|
|
956
|
+
* Immediate tool to toggle between polar and rectangular compass modes.
|
|
957
|
+
* @beta
|
|
958
|
+
*/
|
|
923
959
|
class AccuDrawChangeModeTool extends Tool_1.Tool {
|
|
924
960
|
static toolId = "AccuDraw.ChangeMode";
|
|
925
961
|
async run() {
|
|
@@ -928,7 +964,10 @@ class AccuDrawChangeModeTool extends Tool_1.Tool {
|
|
|
928
964
|
}
|
|
929
965
|
}
|
|
930
966
|
exports.AccuDrawChangeModeTool = AccuDrawChangeModeTool;
|
|
931
|
-
/**
|
|
967
|
+
/**
|
|
968
|
+
* Immediate tool to cycle between XY, XZ, and YZ planes for the current AccuDraw rotation.
|
|
969
|
+
* @beta
|
|
970
|
+
*/
|
|
932
971
|
class AccuDrawRotateCycleTool extends Tool_1.Tool {
|
|
933
972
|
static toolId = "AccuDraw.RotateCycle";
|
|
934
973
|
async run() {
|
|
@@ -937,7 +976,11 @@ class AccuDrawRotateCycleTool extends Tool_1.Tool {
|
|
|
937
976
|
}
|
|
938
977
|
}
|
|
939
978
|
exports.AccuDrawRotateCycleTool = AccuDrawRotateCycleTool;
|
|
940
|
-
/**
|
|
979
|
+
/**
|
|
980
|
+
* Immediate tool to set the AccuDraw rotation to a standard Top view.
|
|
981
|
+
* @note When IModelApp.toolAdmin.acsContextLock is true, rotation is set relative to the view's ACS.
|
|
982
|
+
* @beta
|
|
983
|
+
*/
|
|
941
984
|
class AccuDrawRotateTopTool extends Tool_1.Tool {
|
|
942
985
|
static toolId = "AccuDraw.RotateTop";
|
|
943
986
|
async run() {
|
|
@@ -946,7 +989,11 @@ class AccuDrawRotateTopTool extends Tool_1.Tool {
|
|
|
946
989
|
}
|
|
947
990
|
}
|
|
948
991
|
exports.AccuDrawRotateTopTool = AccuDrawRotateTopTool;
|
|
949
|
-
/**
|
|
992
|
+
/**
|
|
993
|
+
* Immediate tool to set the AccuDraw rotation to a standard Front view.
|
|
994
|
+
* @note When IModelApp.toolAdmin.acsContextLock is true, rotation is set relative to the view's ACS.
|
|
995
|
+
* @beta
|
|
996
|
+
*/
|
|
950
997
|
class AccuDrawRotateFrontTool extends Tool_1.Tool {
|
|
951
998
|
static toolId = "AccuDraw.RotateFront";
|
|
952
999
|
async run() {
|
|
@@ -955,7 +1002,11 @@ class AccuDrawRotateFrontTool extends Tool_1.Tool {
|
|
|
955
1002
|
}
|
|
956
1003
|
}
|
|
957
1004
|
exports.AccuDrawRotateFrontTool = AccuDrawRotateFrontTool;
|
|
958
|
-
/**
|
|
1005
|
+
/**
|
|
1006
|
+
* Immediate tool to set the AccuDraw rotation to a standard Side view.
|
|
1007
|
+
* @note When IModelApp.toolAdmin.acsContextLock is true, rotation is set relative to the view's ACS.
|
|
1008
|
+
* @beta
|
|
1009
|
+
*/
|
|
959
1010
|
class AccuDrawRotateSideTool extends Tool_1.Tool {
|
|
960
1011
|
static toolId = "AccuDraw.RotateSide";
|
|
961
1012
|
async run() {
|
|
@@ -964,7 +1015,10 @@ class AccuDrawRotateSideTool extends Tool_1.Tool {
|
|
|
964
1015
|
}
|
|
965
1016
|
}
|
|
966
1017
|
exports.AccuDrawRotateSideTool = AccuDrawRotateSideTool;
|
|
967
|
-
/**
|
|
1018
|
+
/**
|
|
1019
|
+
* Immediate tool to set the AccuDraw rotation to match the rotation of the current view.
|
|
1020
|
+
* @beta
|
|
1021
|
+
*/
|
|
968
1022
|
class AccuDrawRotateViewTool extends Tool_1.Tool {
|
|
969
1023
|
static toolId = "AccuDraw.RotateView";
|
|
970
1024
|
async run() {
|
|
@@ -973,7 +1027,10 @@ class AccuDrawRotateViewTool extends Tool_1.Tool {
|
|
|
973
1027
|
}
|
|
974
1028
|
}
|
|
975
1029
|
exports.AccuDrawRotateViewTool = AccuDrawRotateViewTool;
|
|
976
|
-
/**
|
|
1030
|
+
/**
|
|
1031
|
+
* Immediate tool to set the AccuDraw rotation to be a 90 degree rotation about the current x axis.
|
|
1032
|
+
* @beta
|
|
1033
|
+
*/
|
|
977
1034
|
class AccuDrawRotate90AboutXTool extends Tool_1.Tool {
|
|
978
1035
|
static toolId = "AccuDraw.Rotate90AboutX";
|
|
979
1036
|
async run() {
|
|
@@ -982,7 +1039,10 @@ class AccuDrawRotate90AboutXTool extends Tool_1.Tool {
|
|
|
982
1039
|
}
|
|
983
1040
|
}
|
|
984
1041
|
exports.AccuDrawRotate90AboutXTool = AccuDrawRotate90AboutXTool;
|
|
985
|
-
/**
|
|
1042
|
+
/**
|
|
1043
|
+
* Immediate tool to set the AccuDraw rotation to be a 90 degree rotation about the current y axis.
|
|
1044
|
+
* @beta
|
|
1045
|
+
*/
|
|
986
1046
|
class AccuDrawRotate90AboutYTool extends Tool_1.Tool {
|
|
987
1047
|
static toolId = "AccuDraw.Rotate90AboutY";
|
|
988
1048
|
async run() {
|
|
@@ -991,7 +1051,10 @@ class AccuDrawRotate90AboutYTool extends Tool_1.Tool {
|
|
|
991
1051
|
}
|
|
992
1052
|
}
|
|
993
1053
|
exports.AccuDrawRotate90AboutYTool = AccuDrawRotate90AboutYTool;
|
|
994
|
-
/**
|
|
1054
|
+
/**
|
|
1055
|
+
* Immediate tool to set the AccuDraw rotation to be a 90 degree rotation about the current z axis.
|
|
1056
|
+
* @beta
|
|
1057
|
+
*/
|
|
995
1058
|
class AccuDrawRotate90AboutZTool extends Tool_1.Tool {
|
|
996
1059
|
static toolId = "AccuDraw.Rotate90AboutZ";
|
|
997
1060
|
async run() {
|
|
@@ -1038,7 +1101,11 @@ class RotateAxesImplementation extends AccuDrawShortcutTool_1.AccuDrawShortcutIm
|
|
|
1038
1101
|
return true;
|
|
1039
1102
|
}
|
|
1040
1103
|
}
|
|
1041
|
-
/**
|
|
1104
|
+
/**
|
|
1105
|
+
* Interactive tool to set the AccuDraw rotation by rotating about the current z axis to a point on the x axis.
|
|
1106
|
+
* @note When AccuSnap or Tentative snap is active, the snap point is immediately used to define the x axis and not further input is required.
|
|
1107
|
+
* @beta
|
|
1108
|
+
*/
|
|
1042
1109
|
class AccuDrawRotateAxesTool extends AccuDrawShortcutTool_1.AccuDrawShortcutTool {
|
|
1043
1110
|
aboutCurrentZ;
|
|
1044
1111
|
static toolId = "AccuDraw.RotateAxes";
|
|
@@ -1104,7 +1171,10 @@ class RotateElementImplementation extends AccuDrawShortcutTool_1.AccuDrawShortcu
|
|
|
1104
1171
|
return true;
|
|
1105
1172
|
}
|
|
1106
1173
|
}
|
|
1107
|
-
/**
|
|
1174
|
+
/**
|
|
1175
|
+
* Interactive tool to set the AccuDraw rotation using the snapped to geometry under the cursor.
|
|
1176
|
+
* @beta
|
|
1177
|
+
*/
|
|
1108
1178
|
class AccuDrawRotateElementTool extends AccuDrawShortcutTool_1.AccuDrawShortcutTool {
|
|
1109
1179
|
static toolId = "AccuDraw.RotateElement";
|
|
1110
1180
|
/** @internal */
|
|
@@ -1114,6 +1184,125 @@ class AccuDrawRotateElementTool extends AccuDrawShortcutTool_1.AccuDrawShortcutT
|
|
|
1114
1184
|
}
|
|
1115
1185
|
exports.AccuDrawRotateElementTool = AccuDrawRotateElementTool;
|
|
1116
1186
|
/** @internal */
|
|
1187
|
+
class RotatePointsImplementation extends AccuDrawShortcutTool_1.AccuDrawShortcutImplementation {
|
|
1188
|
+
_points = [];
|
|
1189
|
+
_origin = IModelApp_1.IModelApp.tentativePoint.isActive ? IModelApp_1.IModelApp.tentativePoint.getPoint().clone() : undefined;
|
|
1190
|
+
_moveOrigin = !IModelApp_1.IModelApp.accuDraw.isActive || IModelApp_1.IModelApp.tentativePoint.isActive; // Preserve current origin if AccuDraw already active and not tentative snap...
|
|
1191
|
+
_lastPoint;
|
|
1192
|
+
onProvideToolAssistance() {
|
|
1193
|
+
switch (this._points.length) {
|
|
1194
|
+
case 0:
|
|
1195
|
+
Tool_1.CoreTools.outputPromptByKey("AccuDraw.RotatePoints.Prompts.FirstPoint");
|
|
1196
|
+
break;
|
|
1197
|
+
case 1:
|
|
1198
|
+
Tool_1.CoreTools.outputPromptByKey("AccuDraw.RotatePoints.Prompts.SecondPoint");
|
|
1199
|
+
break;
|
|
1200
|
+
default:
|
|
1201
|
+
Tool_1.CoreTools.outputPromptByKey("AccuDraw.RotatePoints.Prompts.NextPoint");
|
|
1202
|
+
break;
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
onInitialize() {
|
|
1206
|
+
if (undefined === this._origin)
|
|
1207
|
+
return;
|
|
1208
|
+
this._points.push(this._origin);
|
|
1209
|
+
IModelApp_1.IModelApp.tentativePoint.clear(true); // Necessary when installed as an InputCollector...
|
|
1210
|
+
IModelApp_1.IModelApp.accuDraw.activate();
|
|
1211
|
+
IModelApp_1.IModelApp.accuDraw.setContext(AccuDraw_1.AccuDrawFlags.SetOrigin | AccuDraw_1.AccuDrawFlags.FixedOrigin, this._origin);
|
|
1212
|
+
IModelApp_1.IModelApp.accuDraw.refreshDecorationsAndDynamics();
|
|
1213
|
+
}
|
|
1214
|
+
onComplete() {
|
|
1215
|
+
let ignoreFlags = AccuDraw_1.AccuDrawFlags.SetRMatrix | AccuDraw_1.AccuDrawFlags.Disable; // If AccuDraw wasn't active when the shortcut started, let it remain active for suspended tool when shortcut completes...
|
|
1216
|
+
if (this._moveOrigin)
|
|
1217
|
+
ignoreFlags |= AccuDraw_1.AccuDrawFlags.SetOrigin;
|
|
1218
|
+
return ignoreFlags;
|
|
1219
|
+
}
|
|
1220
|
+
doManipulation(ev, isMotion) {
|
|
1221
|
+
if (!ev || !ev.viewport)
|
|
1222
|
+
return false;
|
|
1223
|
+
IModelApp_1.IModelApp.viewManager.invalidateDecorationsAllViews();
|
|
1224
|
+
if (isMotion) {
|
|
1225
|
+
this._lastPoint = ev.point.clone();
|
|
1226
|
+
return false;
|
|
1227
|
+
}
|
|
1228
|
+
const accuDraw = IModelApp_1.IModelApp.accuDraw;
|
|
1229
|
+
accuDraw.activate();
|
|
1230
|
+
switch (this._points.length) {
|
|
1231
|
+
case 0: {
|
|
1232
|
+
this._points.push(ev.point.clone());
|
|
1233
|
+
accuDraw.setContext(AccuDraw_1.AccuDrawFlags.SetOrigin | AccuDraw_1.AccuDrawFlags.FixedOrigin, this._points[0]);
|
|
1234
|
+
break;
|
|
1235
|
+
}
|
|
1236
|
+
case 1: {
|
|
1237
|
+
const xVec = core_geometry_1.Vector3d.createNormalizedStartEnd(this._points[0], ev.point);
|
|
1238
|
+
if (undefined === xVec)
|
|
1239
|
+
return false;
|
|
1240
|
+
if (!ev.viewport.view.is3d() || !ev.viewport.view.allow3dManipulations()) {
|
|
1241
|
+
accuDraw.setContext(AccuDraw_1.AccuDrawFlags.SetOrigin | AccuDraw_1.AccuDrawFlags.SetXAxis, this._points[0], xVec);
|
|
1242
|
+
return true; // Complete
|
|
1243
|
+
}
|
|
1244
|
+
this._points.push(ev.point.clone());
|
|
1245
|
+
accuDraw.setContext(AccuDraw_1.AccuDrawFlags.SetOrigin | AccuDraw_1.AccuDrawFlags.FixedOrigin | AccuDraw_1.AccuDrawFlags.SetNormal, this._points[0], xVec);
|
|
1246
|
+
break;
|
|
1247
|
+
}
|
|
1248
|
+
case 2: {
|
|
1249
|
+
const xVec = core_geometry_1.Vector3d.createNormalizedStartEnd(this._points[0], this._points[1]);
|
|
1250
|
+
if (undefined === xVec)
|
|
1251
|
+
return false;
|
|
1252
|
+
const yVec = core_geometry_1.Vector3d.createNormalizedStartEnd(this._points[0], ev.point);
|
|
1253
|
+
if (undefined === yVec)
|
|
1254
|
+
return false;
|
|
1255
|
+
const matrix = core_geometry_1.Matrix3d.createRigidFromColumns(xVec, yVec, core_geometry_1.AxisOrder.XYZ);
|
|
1256
|
+
if (undefined === matrix)
|
|
1257
|
+
return false;
|
|
1258
|
+
const invMatrix = matrix.inverse();
|
|
1259
|
+
if (undefined === invMatrix)
|
|
1260
|
+
return false;
|
|
1261
|
+
accuDraw.setContext(AccuDraw_1.AccuDrawFlags.SetOrigin | AccuDraw_1.AccuDrawFlags.SetRMatrix, this._points[0], invMatrix);
|
|
1262
|
+
return true; // Complete
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
this.onProvideToolAssistance();
|
|
1266
|
+
return false;
|
|
1267
|
+
}
|
|
1268
|
+
doDecorate(context) {
|
|
1269
|
+
if (0 === this._points.length)
|
|
1270
|
+
return;
|
|
1271
|
+
const currentPoint = this._lastPoint;
|
|
1272
|
+
if (undefined === currentPoint)
|
|
1273
|
+
return;
|
|
1274
|
+
if (2 === this._points.length) {
|
|
1275
|
+
const xVec = core_geometry_1.Vector3d.createNormalizedStartEnd(this._points[0], this._points[1]);
|
|
1276
|
+
if (undefined === xVec)
|
|
1277
|
+
return;
|
|
1278
|
+
const plane = core_geometry_1.Plane3dByOriginAndUnitNormal.create(this._points[0], xVec);
|
|
1279
|
+
if (undefined === plane)
|
|
1280
|
+
return;
|
|
1281
|
+
plane.projectPointToPlane(currentPoint, currentPoint);
|
|
1282
|
+
}
|
|
1283
|
+
const tmpPoints = this._points.slice(0, 1);
|
|
1284
|
+
tmpPoints.push(currentPoint);
|
|
1285
|
+
const vp = context.viewport;
|
|
1286
|
+
const color = vp.getContrastToBackgroundColor();
|
|
1287
|
+
const builder = context.createGraphicBuilder(GraphicType_1.GraphicType.WorldOverlay);
|
|
1288
|
+
builder.setSymbology(color, color, 2);
|
|
1289
|
+
builder.addLineString(tmpPoints);
|
|
1290
|
+
context.addDecorationFromBuilder(builder);
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Interactive tool to set the AccuDraw rotation by 3 points: x axis origin, x axis direction, and y axis direction.
|
|
1295
|
+
* @beta
|
|
1296
|
+
*/
|
|
1297
|
+
class AccuDrawRotatePointsTool extends AccuDrawShortcutTool_1.AccuDrawShortcutTool {
|
|
1298
|
+
static toolId = "AccuDraw.RotatePoints";
|
|
1299
|
+
/** @internal */
|
|
1300
|
+
createImplementation() {
|
|
1301
|
+
return new RotatePointsImplementation();
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
exports.AccuDrawRotatePointsTool = AccuDrawRotatePointsTool;
|
|
1305
|
+
/** @internal */
|
|
1117
1306
|
class DefineACSByElementImplementation extends AccuDrawShortcutTool_1.AccuDrawShortcutImplementation {
|
|
1118
1307
|
_origin = core_geometry_1.Point3d.create();
|
|
1119
1308
|
_rMatrix = core_geometry_1.Matrix3d.createIdentity();
|
|
@@ -1156,7 +1345,10 @@ class DefineACSByElementImplementation extends AccuDrawShortcutTool_1.AccuDrawSh
|
|
|
1156
1345
|
this._acs.display(context, AuxCoordSys_1.ACSDisplayOptions.Active | AuxCoordSys_1.ACSDisplayOptions.Dynamics);
|
|
1157
1346
|
}
|
|
1158
1347
|
}
|
|
1159
|
-
/**
|
|
1348
|
+
/**
|
|
1349
|
+
* Interactive tool to set the view's ACS rotation by 3 points: x axis origin, x axis direction, and y axis direction/
|
|
1350
|
+
* @beta
|
|
1351
|
+
*/
|
|
1160
1352
|
class DefineACSByElementTool extends AccuDrawShortcutTool_1.AccuDrawShortcutTool {
|
|
1161
1353
|
static toolId = "AccuDraw.DefineACSByElement";
|
|
1162
1354
|
/** @internal */
|
|
@@ -1170,6 +1362,7 @@ class DefineACSByPointsImplementation extends AccuDrawShortcutTool_1.AccuDrawSho
|
|
|
1170
1362
|
_points = [];
|
|
1171
1363
|
_acs;
|
|
1172
1364
|
_origin = IModelApp_1.IModelApp.tentativePoint.isActive ? IModelApp_1.IModelApp.tentativePoint.getPoint().clone() : undefined;
|
|
1365
|
+
_lastPoint;
|
|
1173
1366
|
onProvideToolAssistance() {
|
|
1174
1367
|
switch (this._points.length) {
|
|
1175
1368
|
case 0:
|
|
@@ -1186,16 +1379,20 @@ class DefineACSByPointsImplementation extends AccuDrawShortcutTool_1.AccuDrawSho
|
|
|
1186
1379
|
onInitialize() {
|
|
1187
1380
|
if (undefined === this._origin)
|
|
1188
1381
|
return;
|
|
1189
|
-
IModelApp_1.IModelApp.accuDraw.setContext(AccuDraw_1.AccuDrawFlags.SetOrigin | AccuDraw_1.AccuDrawFlags.FixedOrigin, this._origin);
|
|
1190
1382
|
this._points.push(this._origin);
|
|
1191
1383
|
IModelApp_1.IModelApp.tentativePoint.clear(true); // Necessary when installed as an InputCollector...
|
|
1384
|
+
IModelApp_1.IModelApp.accuDraw.activate();
|
|
1385
|
+
IModelApp_1.IModelApp.accuDraw.setContext(AccuDraw_1.AccuDrawFlags.SetOrigin | AccuDraw_1.AccuDrawFlags.FixedOrigin, this._origin);
|
|
1386
|
+
IModelApp_1.IModelApp.accuDraw.refreshDecorationsAndDynamics();
|
|
1192
1387
|
}
|
|
1193
1388
|
doManipulation(ev, isMotion) {
|
|
1194
1389
|
if (!ev || !ev.viewport)
|
|
1195
1390
|
return false;
|
|
1196
1391
|
IModelApp_1.IModelApp.viewManager.invalidateDecorationsAllViews();
|
|
1197
|
-
if (isMotion)
|
|
1392
|
+
if (isMotion) {
|
|
1393
|
+
this._lastPoint = ev.point.clone();
|
|
1198
1394
|
return false;
|
|
1395
|
+
}
|
|
1199
1396
|
IModelApp_1.IModelApp.accuDraw.activate();
|
|
1200
1397
|
this._points.push(ev.point.clone());
|
|
1201
1398
|
const vp = ev.viewport;
|
|
@@ -1210,11 +1407,11 @@ class DefineACSByPointsImplementation extends AccuDrawShortcutTool_1.AccuDrawSho
|
|
|
1210
1407
|
return false;
|
|
1211
1408
|
}
|
|
1212
1409
|
doDecorate(context) {
|
|
1410
|
+
if (undefined === this._lastPoint)
|
|
1411
|
+
return;
|
|
1213
1412
|
const tmpPoints = [];
|
|
1214
1413
|
this._points.forEach((pt) => tmpPoints.push(pt));
|
|
1215
|
-
|
|
1216
|
-
IModelApp_1.IModelApp.toolAdmin.fillEventFromCursorLocation(ev);
|
|
1217
|
-
tmpPoints.push(ev.point);
|
|
1414
|
+
tmpPoints.push(this._lastPoint);
|
|
1218
1415
|
const vp = context.viewport;
|
|
1219
1416
|
if (!this._acs)
|
|
1220
1417
|
this._acs = vp.view.auxiliaryCoordinateSystem.clone();
|
|
@@ -1222,7 +1419,10 @@ class DefineACSByPointsImplementation extends AccuDrawShortcutTool_1.AccuDrawSho
|
|
|
1222
1419
|
this._acs.display(context, AuxCoordSys_1.ACSDisplayOptions.Active | AuxCoordSys_1.ACSDisplayOptions.Dynamics);
|
|
1223
1420
|
}
|
|
1224
1421
|
}
|
|
1225
|
-
/**
|
|
1422
|
+
/**
|
|
1423
|
+
* Interactive tool to set the view's ACS rotation by 3 points: x axis origin, x axis direction, and y axis direction.
|
|
1424
|
+
* @beta
|
|
1425
|
+
*/
|
|
1226
1426
|
class DefineACSByPointsTool extends AccuDrawShortcutTool_1.AccuDrawShortcutTool {
|
|
1227
1427
|
static toolId = "AccuDraw.DefineACSByPoints";
|
|
1228
1428
|
/** @internal */
|