@itwin/editor-frontend 4.0.0-dev.4 → 4.0.0-dev.41

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +15 -2
  2. package/lib/cjs/CreateElementTool.js +3 -5
  3. package/lib/cjs/CreateElementTool.js.map +1 -1
  4. package/lib/cjs/EditTool.js +1 -2
  5. package/lib/cjs/EditTool.js.map +1 -1
  6. package/lib/cjs/ElementGeometryTool.js +9 -14
  7. package/lib/cjs/ElementGeometryTool.js.map +1 -1
  8. package/lib/cjs/ModifyCurveTools.js +23 -31
  9. package/lib/cjs/ModifyCurveTools.js.map +1 -1
  10. package/lib/cjs/ModifyElementTool.js +1 -1
  11. package/lib/cjs/ModifyElementTool.js.map +1 -1
  12. package/lib/cjs/SketchTools.js +2 -3
  13. package/lib/cjs/SketchTools.js.map +1 -1
  14. package/lib/cjs/SolidModelingTools.js +21 -31
  15. package/lib/cjs/SolidModelingTools.js.map +1 -1
  16. package/lib/cjs/SolidPrimitiveTools.js +13 -19
  17. package/lib/cjs/SolidPrimitiveTools.js.map +1 -1
  18. package/lib/cjs/TransformElementsTool.js +4 -4
  19. package/lib/cjs/TransformElementsTool.js.map +1 -1
  20. package/lib/cjs/UndoRedoTool.js +1 -2
  21. package/lib/cjs/UndoRedoTool.js.map +1 -1
  22. package/lib/esm/CreateElementTool.js +3 -5
  23. package/lib/esm/CreateElementTool.js.map +1 -1
  24. package/lib/esm/EditTool.js +1 -2
  25. package/lib/esm/EditTool.js.map +1 -1
  26. package/lib/esm/ElementGeometryTool.js +9 -14
  27. package/lib/esm/ElementGeometryTool.js.map +1 -1
  28. package/lib/esm/ModifyCurveTools.js +23 -31
  29. package/lib/esm/ModifyCurveTools.js.map +1 -1
  30. package/lib/esm/ModifyElementTool.js +1 -1
  31. package/lib/esm/ModifyElementTool.js.map +1 -1
  32. package/lib/esm/SketchTools.js +2 -3
  33. package/lib/esm/SketchTools.js.map +1 -1
  34. package/lib/esm/SolidModelingTools.js +21 -31
  35. package/lib/esm/SolidModelingTools.js.map +1 -1
  36. package/lib/esm/SolidPrimitiveTools.js +13 -19
  37. package/lib/esm/SolidPrimitiveTools.js.map +1 -1
  38. package/lib/esm/TransformElementsTool.js +4 -4
  39. package/lib/esm/TransformElementsTool.js.map +1 -1
  40. package/lib/esm/UndoRedoTool.js +1 -2
  41. package/lib/esm/UndoRedoTool.js.map +1 -1
  42. package/package.json +15 -15
@@ -26,10 +26,9 @@ export class SolidPrimitiveTool extends CreateElementWithDynamicsTool {
26
26
  return EditTools.startCommand({ commandId: editorBuiltInCmdIds.cmdBasicManipulation, iModelKey: this.iModel.key });
27
27
  }
28
28
  getPlacementProps() {
29
- var _a;
30
29
  if (undefined === this.current)
31
30
  return undefined;
32
- const localToWorld = ("solid" === this.current.geometryCategory ? this.current.getConstructiveFrame() : FrameBuilder.createRightHandedFrame((_a = this.baseRotation) === null || _a === void 0 ? void 0 : _a.getColumn(2), this.current));
31
+ const localToWorld = ("solid" === this.current.geometryCategory ? this.current.getConstructiveFrame() : FrameBuilder.createRightHandedFrame(this.baseRotation?.getColumn(2), this.current));
33
32
  if (undefined === localToWorld)
34
33
  return undefined;
35
34
  const origin = localToWorld.getOrigin();
@@ -469,7 +468,6 @@ export class CreateConeTool extends SolidPrimitiveTool {
469
468
  return (CreateConePhase.AcceptResult === this.createPhase);
470
469
  }
471
470
  async updateElementData(ev, isDynamics) {
472
- var _a;
473
471
  const vp = this.targetView;
474
472
  if (undefined === vp)
475
473
  return;
@@ -540,7 +538,7 @@ export class CreateConeTool extends SolidPrimitiveTool {
540
538
  break;
541
539
  }
542
540
  case CreateConePhase.AcceptTopRadius: {
543
- const cone = ("solid" === ((_a = this.current) === null || _a === void 0 ? void 0 : _a.geometryCategory) ? this.current : undefined);
541
+ const cone = ("solid" === this.current?.geometryCategory ? this.current : undefined);
544
542
  if (undefined === cone)
545
543
  break;
546
544
  const vector0 = Vector3d.createStartEnd(cone.getCenterB(), pt2);
@@ -1152,14 +1150,13 @@ export class ExtrudeCurveTool extends ModifyCurveTool {
1152
1150
  }
1153
1151
  }
1154
1152
  modifyCurve(ev, isAccept) {
1155
- var _a;
1156
1153
  if (undefined === ev.viewport || undefined === this.anchorPoint)
1157
1154
  return undefined;
1158
- const geom = (_a = this.curveData) === null || _a === void 0 ? void 0 : _a.geom;
1155
+ const geom = this.curveData?.geom;
1159
1156
  if (undefined === geom)
1160
1157
  return undefined;
1161
1158
  const matrix = AccuDrawHintBuilder.getCurrentRotation(ev.viewport, true, true);
1162
- const localToWorld = FrameBuilder.createRightHandedFrame(matrix === null || matrix === void 0 ? void 0 : matrix.getColumn(2), geom);
1159
+ const localToWorld = FrameBuilder.createRightHandedFrame(matrix?.getColumn(2), geom);
1163
1160
  if (undefined === localToWorld)
1164
1161
  return undefined;
1165
1162
  const spacePoint = this.orthogonal ? AccuDrawHintBuilder.projectPointToLineInView(ev.point, this.anchorPoint, localToWorld.matrix.getColumn(2), ev.viewport, true) : ev.point;
@@ -1183,15 +1180,14 @@ export class ExtrudeCurveTool extends ModifyCurveTool {
1183
1180
  return !this.keepProfile;
1184
1181
  }
1185
1182
  setupAccuDraw() {
1186
- var _a;
1187
1183
  const hints = new AccuDrawHintBuilder();
1188
1184
  if (this.agenda.isEmpty) {
1189
1185
  hints.enableSmartRotation = true;
1190
1186
  }
1191
1187
  else if (undefined !== this.anchorPoint && undefined !== this.targetView) {
1192
- const geom = (_a = this.curveData) === null || _a === void 0 ? void 0 : _a.geom;
1188
+ const geom = this.curveData?.geom;
1193
1189
  const matrix = AccuDrawHintBuilder.getCurrentRotation(this.targetView, true, true);
1194
- const localToWorld = FrameBuilder.createRightHandedFrame(matrix === null || matrix === void 0 ? void 0 : matrix.getColumn(2), geom);
1190
+ const localToWorld = FrameBuilder.createRightHandedFrame(matrix?.getColumn(2), geom);
1195
1191
  hints.setModeRectangular();
1196
1192
  hints.setOrigin(this.anchorPoint);
1197
1193
  hints.setOriginFixed = true;
@@ -1271,10 +1267,9 @@ export class RevolveCurveTool extends ModifyCurveTool {
1271
1267
  }
1272
1268
  }
1273
1269
  modifyCurve(ev, isAccept) {
1274
- var _a;
1275
1270
  if (undefined === ev.viewport || this.points.length < (isAccept ? 2 : 1))
1276
1271
  return undefined;
1277
- const geom = (_a = this.curveData) === null || _a === void 0 ? void 0 : _a.geom;
1272
+ const geom = this.curveData?.geom;
1278
1273
  if (undefined === geom)
1279
1274
  return undefined;
1280
1275
  const direction = Vector3d.createStartEnd(this.points[0], isAccept ? this.points[1] : ev.point);
@@ -1285,13 +1280,13 @@ export class RevolveCurveTool extends ModifyCurveTool {
1285
1280
  const contour = (geom instanceof CurvePrimitive) ? Path.create(geom) : geom;
1286
1281
  const sweep = RotationalSweep.create(contour, axis, angle, this.capped && contour.isAnyRegionType);
1287
1282
  // Detect a self-intersection...contour should not intersect axis of revolution...
1288
- const localToWorld = sweep === null || sweep === void 0 ? void 0 : sweep.getConstructiveFrame();
1283
+ const localToWorld = sweep?.getConstructiveFrame();
1289
1284
  if (undefined === localToWorld)
1290
1285
  return undefined;
1291
1286
  const xVec = localToWorld.matrix.columnX(); // NOTE: Not always towards contour...
1292
1287
  const xAxis = Ray3d.create(localToWorld.getOrigin(), xVec);
1293
1288
  // Check parameter range of radial axis ray, if low is negative and high is positive reject result...
1294
- const paramRange = sweep === null || sweep === void 0 ? void 0 : sweep.getCurves().projectedParameterRange(xAxis);
1289
+ const paramRange = sweep?.getCurves().projectedParameterRange(xAxis);
1295
1290
  if (undefined === paramRange || (paramRange.low < -Geometry.smallMetricDistanceSquared && paramRange.high > Geometry.smallMetricDistanceSquared))
1296
1291
  return undefined;
1297
1292
  return sweep;
@@ -1319,7 +1314,6 @@ export class RevolveCurveTool extends ModifyCurveTool {
1319
1314
  return super.gatherInput(ev);
1320
1315
  }
1321
1316
  setupAccuDraw() {
1322
- var _a;
1323
1317
  const hints = new AccuDrawHintBuilder();
1324
1318
  if (this.agenda.isEmpty) {
1325
1319
  hints.enableSmartRotation = true;
@@ -1330,15 +1324,15 @@ export class RevolveCurveTool extends ModifyCurveTool {
1330
1324
  hints.setLockZ = true;
1331
1325
  }
1332
1326
  else if (undefined !== this.anchorPoint && undefined !== this.targetView) {
1333
- const geom = (_a = this.curveData) === null || _a === void 0 ? void 0 : _a.geom;
1334
- const closeDetail = (geom instanceof CurvePrimitive) ? geom.closestPoint(this.anchorPoint, false) : geom === null || geom === void 0 ? void 0 : geom.closestPoint(this.anchorPoint);
1335
- if (undefined === (closeDetail === null || closeDetail === void 0 ? void 0 : closeDetail.curve))
1327
+ const geom = this.curveData?.geom;
1328
+ const closeDetail = (geom instanceof CurvePrimitive) ? geom.closestPoint(this.anchorPoint, false) : geom?.closestPoint(this.anchorPoint);
1329
+ if (undefined === closeDetail?.curve)
1336
1330
  return;
1337
1331
  const unitX = closeDetail.curve.fractionToPointAndUnitTangent(closeDetail.fraction).direction;
1338
1332
  if (undefined === unitX)
1339
1333
  return;
1340
1334
  const matrix = AccuDrawHintBuilder.getCurrentRotation(this.targetView, true, true);
1341
- const localToWorld = FrameBuilder.createRightHandedFrame(matrix === null || matrix === void 0 ? void 0 : matrix.getColumn(2), geom);
1335
+ const localToWorld = FrameBuilder.createRightHandedFrame(matrix?.getColumn(2), geom);
1342
1336
  if (undefined === localToWorld)
1343
1337
  return;
1344
1338
  const unitZ = localToWorld.matrix.getColumn(2);