@itwin/editor-frontend 3.0.0-dev.160 → 3.0.0-dev.167

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.
@@ -157,26 +157,10 @@ export class ThickenSheetElementsTool extends ElementGeometryCacheTool {
157
157
  await this.saveChanges();
158
158
  }
159
159
  async applyToolSettingPropertyChange(updatedValue) {
160
- if (updatedValue.propertyName === this.frontDistanceProperty.name) {
161
- this.frontDistance = updatedValue.value.value;
162
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.frontDistanceProperty.item);
163
- return true;
164
- }
165
- else if (updatedValue.propertyName === this.backDistanceProperty.name) {
166
- this.backDistance = updatedValue.value.value;
167
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.backDistanceProperty.item);
168
- return true;
169
- }
170
- return false;
160
+ return this.changeToolSettingPropertyValue(updatedValue);
171
161
  }
172
162
  supplyToolSettingsProperties() {
173
- var _a;
174
- (_a = IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.frontDistanceProperty.name, this.backDistanceProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
175
- if (value.propertyName === this.frontDistanceProperty.name)
176
- this.frontDistanceProperty.dialogItemValue = value.value;
177
- else if (value.propertyName === this.backDistanceProperty.name)
178
- this.backDistanceProperty.dialogItemValue = value.value;
179
- });
163
+ this.initializeToolSettingPropertyValues([this.frontDistanceProperty, this.backDistanceProperty]);
180
164
  const toolSettings = new Array();
181
165
  toolSettings.push(this.frontDistanceProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
182
166
  toolSettings.push(this.backDistanceProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
@@ -273,51 +257,14 @@ export class CutSolidElementsTool extends ElementGeometryCacheTool {
273
257
  this.targetPoint = hit.hitPoint;
274
258
  return super.buildLocateAgenda(hit);
275
259
  }
276
- syncDepthState() {
277
- this.depthProperty.displayValue = this.depthProperty.description.format(this.depth);
278
- this.depthProperty.isDisabled = !this.useDepth;
279
- this.syncToolSettingsProperties([this.depthProperty.syncItem]);
260
+ getToolSettingPropertyLocked(property) {
261
+ return (property === this.useDepthProperty ? this.depthProperty : undefined);
280
262
  }
281
263
  async applyToolSettingPropertyChange(updatedValue) {
282
- if (updatedValue.propertyName === this.bothDirectionsProperty.name) {
283
- this.bothDirections = updatedValue.value.value;
284
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.bothDirectionsProperty.item);
285
- return true;
286
- }
287
- else if (updatedValue.propertyName === this.outsideProperty.name) {
288
- this.outside = updatedValue.value.value;
289
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.outsideProperty.item);
290
- return true;
291
- }
292
- else if (updatedValue.propertyName === this.useDepthProperty.name) {
293
- this.useDepth = updatedValue.value.value;
294
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.useDepthProperty.item);
295
- this.syncDepthState();
296
- return true;
297
- }
298
- else if (updatedValue.propertyName === this.depthProperty.name) {
299
- if (!updatedValue.value.value) {
300
- this.syncDepthState(); // force UI to redisplay last valid value
301
- return false;
302
- }
303
- this.depth = updatedValue.value.value;
304
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.depthProperty.item);
305
- return true;
306
- }
307
- return false;
264
+ return this.changeToolSettingPropertyValue(updatedValue);
308
265
  }
309
266
  supplyToolSettingsProperties() {
310
- var _a;
311
- (_a = IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.bothDirectionsProperty.name, this.outsideProperty.name, this.useDepthProperty.name, this.depthProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
312
- if (value.propertyName === this.bothDirectionsProperty.name)
313
- this.bothDirectionsProperty.dialogItemValue = value.value;
314
- else if (value.propertyName === this.outsideProperty.name)
315
- this.outsideProperty.dialogItemValue = value.value;
316
- else if (value.propertyName === this.useDepthProperty.name)
317
- this.useDepthProperty.dialogItemValue = value.value;
318
- else if (value.propertyName === this.depthProperty.name)
319
- this.depthProperty.dialogItemValue = value.value;
320
- });
267
+ this.initializeToolSettingPropertyValues([this.bothDirectionsProperty, this.outsideProperty, this.useDepthProperty, this.depthProperty]);
321
268
  const toolSettings = new Array();
322
269
  toolSettings.push(this.bothDirectionsProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
323
270
  toolSettings.push(this.outsideProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
@@ -580,44 +527,14 @@ export class OffsetFacesTool extends LocateSubEntityTool {
580
527
  hints.setXAxis2(faceData.normal);
581
528
  hints.sendHints(false);
582
529
  }
583
- syncDistanceState() {
584
- this.distanceProperty.displayValue = this.distanceProperty.description.format(this.distance);
585
- this.distanceProperty.isDisabled = !this.useDistance;
586
- this.syncToolSettingsProperties([this.distanceProperty.syncItem]);
530
+ getToolSettingPropertyLocked(property) {
531
+ return (property === this.useDistanceProperty ? this.distanceProperty : undefined);
587
532
  }
588
533
  async applyToolSettingPropertyChange(updatedValue) {
589
- if (updatedValue.propertyName === this.addSmoothProperty.name) {
590
- this.addSmooth = updatedValue.value.value;
591
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.addSmoothProperty.item);
592
- return true;
593
- }
594
- else if (updatedValue.propertyName === this.useDistanceProperty.name) {
595
- this.useDistance = updatedValue.value.value;
596
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.useDistanceProperty.item);
597
- this.syncDistanceState();
598
- return true;
599
- }
600
- else if (updatedValue.propertyName === this.distanceProperty.name) {
601
- if (!updatedValue.value.value) {
602
- this.syncDistanceState(); // force UI to redisplay last valid value
603
- return false;
604
- }
605
- this.distance = updatedValue.value.value;
606
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.distanceProperty.item);
607
- return true;
608
- }
609
- return false;
534
+ return this.changeToolSettingPropertyValue(updatedValue);
610
535
  }
611
536
  supplyToolSettingsProperties() {
612
- var _a;
613
- (_a = IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.addSmoothProperty.name, this.useDistanceProperty.name, this.distanceProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
614
- if (value.propertyName === this.addSmoothProperty.name)
615
- this.addSmoothProperty.dialogItemValue = value.value;
616
- else if (value.propertyName === this.useDistanceProperty.name)
617
- this.useDistanceProperty.dialogItemValue = value.value;
618
- else if (value.propertyName === this.distanceProperty.name)
619
- this.distanceProperty.dialogItemValue = value.value;
620
- });
537
+ this.initializeToolSettingPropertyValues([this.addSmoothProperty, this.useDistanceProperty, this.distanceProperty]);
621
538
  const toolSettings = new Array();
622
539
  // ensure controls are enabled/disabled based on current lock property state
623
540
  this.distanceProperty.isDisabled = !this.useDistance;
@@ -672,26 +589,10 @@ export class HollowFacesTool extends LocateSubEntityTool {
672
589
  }
673
590
  }
674
591
  async applyToolSettingPropertyChange(updatedValue) {
675
- if (updatedValue.propertyName === this.shellThicknessProperty.name) {
676
- this.shellThickness = updatedValue.value.value;
677
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.shellThicknessProperty.item);
678
- return true;
679
- }
680
- else if (updatedValue.propertyName === this.faceThicknessProperty.name) {
681
- this.faceThickness = updatedValue.value.value;
682
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.faceThicknessProperty.item);
683
- return true;
684
- }
685
- return false;
592
+ return this.changeToolSettingPropertyValue(updatedValue);
686
593
  }
687
594
  supplyToolSettingsProperties() {
688
- var _a;
689
- (_a = IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.shellThicknessProperty.name, this.faceThicknessProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
690
- if (value.propertyName === this.shellThicknessProperty.name)
691
- this.shellThicknessProperty.dialogItemValue = value.value;
692
- else if (value.propertyName === this.faceThicknessProperty.name)
693
- this.faceThicknessProperty.dialogItemValue = value.value;
694
- });
595
+ this.initializeToolSettingPropertyValues([this.shellThicknessProperty, this.faceThicknessProperty]);
695
596
  const toolSettings = new Array();
696
597
  toolSettings.push(this.shellThicknessProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
697
598
  toolSettings.push(this.faceThicknessProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
@@ -933,34 +834,14 @@ export class ImprintSolidElementsTool extends LocateSubEntityTool {
933
834
  hints.sendHints(false);
934
835
  }
935
836
  async applyToolSettingPropertyChange(updatedValue) {
936
- if (updatedValue.propertyName === this.methodProperty.name) {
937
- this.method = updatedValue.value.value;
938
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.methodProperty.item);
837
+ if (!this.changeToolSettingPropertyValue(updatedValue))
838
+ return false;
839
+ if (updatedValue.propertyName === this.methodProperty.name)
939
840
  await this.onReinitialize();
940
- return true;
941
- }
942
- else if (updatedValue.propertyName === this.extendProperty.name) {
943
- this.extend = updatedValue.value.value;
944
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.extendProperty.item);
945
- return true;
946
- }
947
- else if (updatedValue.propertyName === this.distanceProperty.name) {
948
- this.distance = updatedValue.value.value;
949
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.distanceProperty.item);
950
- return true;
951
- }
952
- return false;
841
+ return true;
953
842
  }
954
843
  supplyToolSettingsProperties() {
955
- var _a;
956
- (_a = IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.methodProperty.name, this.extendProperty.name, this.distanceProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
957
- if (value.propertyName === this.methodProperty.name)
958
- this.methodProperty.dialogItemValue = value.value;
959
- else if (value.propertyName === this.extendProperty.name)
960
- this.extendProperty.dialogItemValue = value.value;
961
- else if (value.propertyName === this.distanceProperty.name)
962
- this.distanceProperty.dialogItemValue = value.value;
963
- });
844
+ this.initializeToolSettingPropertyValues([this.methodProperty, this.extendProperty, this.distanceProperty]);
964
845
  const toolSettings = new Array();
965
846
  toolSettings.push(this.methodProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
966
847
  switch (this.method) {
@@ -1111,27 +992,14 @@ export class RoundEdgesTool extends BlendEdgesTool {
1111
992
  }
1112
993
  }
1113
994
  async applyToolSettingPropertyChange(updatedValue) {
1114
- if (updatedValue.propertyName === this.radiusProperty.name) {
1115
- this.radius = updatedValue.value.value;
1116
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.radiusProperty.item);
1117
- return true;
1118
- }
1119
- else if (updatedValue.propertyName === this.addSmoothProperty.name) {
1120
- this.addSmooth = updatedValue.value.value;
1121
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.addSmoothProperty.item);
995
+ if (!this.changeToolSettingPropertyValue(updatedValue))
996
+ return false;
997
+ if (updatedValue.propertyName === this.addSmoothProperty.name)
1122
998
  await this.syncTangentEdges();
1123
- return true;
1124
- }
1125
- return false;
999
+ return true;
1126
1000
  }
1127
1001
  supplyToolSettingsProperties() {
1128
- var _a;
1129
- (_a = IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.radiusProperty.name, this.addSmoothProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
1130
- if (value.propertyName === this.radiusProperty.name)
1131
- this.radiusProperty.dialogItemValue = value.value;
1132
- else if (value.propertyName === this.addSmoothProperty.name)
1133
- this.addSmoothProperty.dialogItemValue = value.value;
1134
- });
1002
+ this.initializeToolSettingPropertyValues([this.radiusProperty, this.addSmoothProperty]);
1135
1003
  const toolSettings = new Array();
1136
1004
  toolSettings.push(this.radiusProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
1137
1005
  toolSettings.push(this.addSmoothProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
@@ -1223,55 +1091,14 @@ export class ChamferEdgesTool extends BlendEdgesTool {
1223
1091
  }
1224
1092
  }
1225
1093
  async applyToolSettingPropertyChange(updatedValue) {
1226
- if (updatedValue.propertyName === this.methodProperty.name) {
1227
- this.method = updatedValue.value.value;
1228
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.methodProperty.item);
1094
+ if (!this.changeToolSettingPropertyValue(updatedValue))
1095
+ return false;
1096
+ if (updatedValue.propertyName === this.methodProperty.name)
1229
1097
  await this.onReinitialize();
1230
- return true;
1231
- }
1232
- else if (updatedValue.propertyName === this.addSmoothProperty.name) {
1233
- this.addSmooth = updatedValue.value.value;
1234
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.addSmoothProperty.item);
1235
- return true;
1236
- }
1237
- else if (updatedValue.propertyName === this.lengthProperty.name) {
1238
- this.length = updatedValue.value.value;
1239
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.lengthProperty.item);
1240
- return true;
1241
- }
1242
- else if (updatedValue.propertyName === this.distanceLeftProperty.name) {
1243
- this.distanceLeft = updatedValue.value.value;
1244
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.distanceLeftProperty.item);
1245
- return true;
1246
- }
1247
- else if (updatedValue.propertyName === this.distanceRightProperty.name) {
1248
- this.distanceRight = updatedValue.value.value;
1249
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.distanceRightProperty.item);
1250
- return true;
1251
- }
1252
- else if (updatedValue.propertyName === this.angleProperty.name) {
1253
- this.angle = updatedValue.value.value;
1254
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.angleProperty.item);
1255
- return true;
1256
- }
1257
- return false;
1098
+ return true;
1258
1099
  }
1259
1100
  supplyToolSettingsProperties() {
1260
- var _a;
1261
- (_a = IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.methodProperty.name, this.addSmoothProperty.name, this.lengthProperty.name, this.distanceLeftProperty.name, this.distanceRightProperty.name, this.angleProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
1262
- if (value.propertyName === this.methodProperty.name)
1263
- this.methodProperty.dialogItemValue = value.value;
1264
- else if (value.propertyName === this.addSmoothProperty.name)
1265
- this.addSmoothProperty.dialogItemValue = value.value;
1266
- else if (value.propertyName === this.lengthProperty.name)
1267
- this.lengthProperty.dialogItemValue = value.value;
1268
- else if (value.propertyName === this.distanceLeftProperty.name)
1269
- this.distanceLeftProperty.dialogItemValue = value.value;
1270
- else if (value.propertyName === this.distanceRightProperty.name)
1271
- this.distanceRightProperty.dialogItemValue = value.value;
1272
- else if (value.propertyName === this.angleProperty.name)
1273
- this.angleProperty.dialogItemValue = value.value;
1274
- });
1101
+ this.initializeToolSettingPropertyValues([this.methodProperty, this.addSmoothProperty, this.lengthProperty, this.distanceLeftProperty, this.distanceRightProperty, this.angleProperty]);
1275
1102
  const toolSettings = new Array();
1276
1103
  toolSettings.push(this.methodProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
1277
1104
  toolSettings.push(this.addSmoothProperty.toDialogItem({ rowPriority: ChamferMode.Length === this.method ? 3 : 4, columnIndex: 0 }));
@@ -1469,44 +1296,11 @@ export class SweepFacesTool extends LocateFaceOrProfileTool {
1469
1296
  hints.setXAxis2(profileData.orientation instanceof Matrix3d ? profileData.orientation.getColumn(2) : profileData.orientation);
1470
1297
  hints.sendHints(false);
1471
1298
  }
1472
- syncDistanceState() {
1473
- this.distanceProperty.displayValue = this.distanceProperty.description.format(this.distance);
1474
- this.distanceProperty.isDisabled = !this.useDistance;
1475
- this.syncToolSettingsProperties([this.distanceProperty.syncItem]);
1476
- }
1477
1299
  async applyToolSettingPropertyChange(updatedValue) {
1478
- if (updatedValue.propertyName === this.addSmoothProperty.name) {
1479
- this.addSmooth = updatedValue.value.value;
1480
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.addSmoothProperty.item);
1481
- return true;
1482
- }
1483
- else if (updatedValue.propertyName === this.useDistanceProperty.name) {
1484
- this.useDistance = updatedValue.value.value;
1485
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.useDistanceProperty.item);
1486
- this.syncDistanceState();
1487
- return true;
1488
- }
1489
- else if (updatedValue.propertyName === this.distanceProperty.name) {
1490
- if (!updatedValue.value.value) {
1491
- this.syncDistanceState(); // force UI to redisplay last valid value
1492
- return false;
1493
- }
1494
- this.distance = updatedValue.value.value;
1495
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.distanceProperty.item);
1496
- return true;
1497
- }
1498
- return false;
1300
+ return this.changeToolSettingPropertyValue(updatedValue);
1499
1301
  }
1500
1302
  supplyToolSettingsProperties() {
1501
- var _a;
1502
- (_a = IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.addSmoothProperty.name, this.useDistanceProperty.name, this.distanceProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
1503
- if (value.propertyName === this.addSmoothProperty.name)
1504
- this.addSmoothProperty.dialogItemValue = value.value;
1505
- else if (value.propertyName === this.useDistanceProperty.name)
1506
- this.useDistanceProperty.dialogItemValue = value.value;
1507
- else if (value.propertyName === this.distanceProperty.name)
1508
- this.distanceProperty.dialogItemValue = value.value;
1509
- });
1303
+ this.initializeToolSettingPropertyValues([this.addSmoothProperty, this.useDistanceProperty, this.distanceProperty]);
1510
1304
  const toolSettings = new Array();
1511
1305
  // ensure controls are enabled/disabled based on current lock property state
1512
1306
  this.distanceProperty.isDisabled = !this.useDistance;
@@ -1610,19 +1404,10 @@ export class SpinFacesTool extends LocateFaceOrProfileTool {
1610
1404
  hints.sendHints(false);
1611
1405
  }
1612
1406
  async applyToolSettingPropertyChange(updatedValue) {
1613
- if (updatedValue.propertyName === this.angleProperty.name) {
1614
- this.angle = updatedValue.value.value;
1615
- IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.angleProperty.item);
1616
- return true;
1617
- }
1618
- return false;
1407
+ return this.changeToolSettingPropertyValue(updatedValue);
1619
1408
  }
1620
1409
  supplyToolSettingsProperties() {
1621
- var _a;
1622
- (_a = IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.angleProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
1623
- if (value.propertyName === this.angleProperty.name)
1624
- this.angleProperty.dialogItemValue = value.value;
1625
- });
1410
+ this.initializeToolSettingPropertyValues([this.angleProperty]);
1626
1411
  const toolSettings = new Array();
1627
1412
  toolSettings.push(this.angleProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
1628
1413
  return toolSettings;