@itwin/editor-frontend 3.3.0-dev.30 → 3.3.0-dev.33
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/CreateElementTool.d.ts +25 -1
- package/lib/cjs/CreateElementTool.d.ts.map +1 -1
- package/lib/cjs/CreateElementTool.js +89 -2
- package/lib/cjs/CreateElementTool.js.map +1 -1
- package/lib/cjs/EditTool.d.ts.map +1 -1
- package/lib/cjs/EditTool.js +4 -0
- package/lib/cjs/EditTool.js.map +1 -1
- package/lib/cjs/SketchTools.d.ts +14 -23
- package/lib/cjs/SketchTools.d.ts.map +1 -1
- package/lib/cjs/SketchTools.js +59 -104
- package/lib/cjs/SketchTools.js.map +1 -1
- package/lib/cjs/SolidPrimitiveTools.d.ts +155 -0
- package/lib/cjs/SolidPrimitiveTools.d.ts.map +1 -0
- package/lib/cjs/SolidPrimitiveTools.js +605 -0
- package/lib/cjs/SolidPrimitiveTools.js.map +1 -0
- package/lib/cjs/editor-frontend.d.ts +1 -0
- package/lib/cjs/editor-frontend.d.ts.map +1 -1
- package/lib/cjs/editor-frontend.js +1 -0
- package/lib/cjs/editor-frontend.js.map +1 -1
- package/lib/esm/CreateElementTool.d.ts +25 -1
- package/lib/esm/CreateElementTool.d.ts.map +1 -1
- package/lib/esm/CreateElementTool.js +88 -2
- package/lib/esm/CreateElementTool.js.map +1 -1
- package/lib/esm/EditTool.d.ts.map +1 -1
- package/lib/esm/EditTool.js +4 -0
- package/lib/esm/EditTool.js.map +1 -1
- package/lib/esm/SketchTools.d.ts +14 -23
- package/lib/esm/SketchTools.d.ts.map +1 -1
- package/lib/esm/SketchTools.js +60 -105
- package/lib/esm/SketchTools.js.map +1 -1
- package/lib/esm/SolidPrimitiveTools.d.ts +155 -0
- package/lib/esm/SolidPrimitiveTools.d.ts.map +1 -0
- package/lib/esm/SolidPrimitiveTools.js +598 -0
- package/lib/esm/SolidPrimitiveTools.js.map +1 -0
- package/lib/esm/editor-frontend.d.ts +1 -0
- package/lib/esm/editor-frontend.d.ts.map +1 -1
- package/lib/esm/editor-frontend.js +1 -0
- package/lib/esm/editor-frontend.js.map +1 -1
- package/lib/public/locales/en/Editor.json +44 -0
- package/package.json +12 -12
package/lib/cjs/SketchTools.js
CHANGED
|
@@ -30,9 +30,10 @@ var CreateCurvePhase;
|
|
|
30
30
|
CreateCurvePhase[CreateCurvePhase["DefineOther"] = 2] = "DefineOther";
|
|
31
31
|
})(CreateCurvePhase = exports.CreateCurvePhase || (exports.CreateCurvePhase = {}));
|
|
32
32
|
/** @alpha Base class for creating open and closed paths. */
|
|
33
|
-
class CreateOrContinuePathTool extends CreateElementTool_1.
|
|
33
|
+
class CreateOrContinuePathTool extends CreateElementTool_1.CreateElementWithDynamicsTool {
|
|
34
34
|
constructor() {
|
|
35
35
|
super(...arguments);
|
|
36
|
+
this._createCurvePhase = CreateCurvePhase.DefineOther;
|
|
36
37
|
this.accepted = [];
|
|
37
38
|
this.isClosed = false;
|
|
38
39
|
this.isConstruction = false; // Sub-classes can set in createNewCurvePrimitive to bypass creating element graphics...
|
|
@@ -45,8 +46,6 @@ class CreateOrContinuePathTool extends CreateElementTool_1.CreateElementTool {
|
|
|
45
46
|
static callCommand(method, ...args) {
|
|
46
47
|
return EditTool_1.EditTools.callCommand(method, ...args);
|
|
47
48
|
}
|
|
48
|
-
get wantAccuSnap() { return true; }
|
|
49
|
-
get wantDynamics() { return true; }
|
|
50
49
|
get allowJoin() { return this.isControlDown; }
|
|
51
50
|
get allowClosure() { return this.isControlDown; }
|
|
52
51
|
get allowSimplify() { return true; }
|
|
@@ -58,10 +57,9 @@ class CreateOrContinuePathTool extends CreateElementTool_1.CreateElementTool {
|
|
|
58
57
|
get showCurveConstructions() { return false; }
|
|
59
58
|
get showJoin() { return this.isContinueExistingPath && CreateCurvePhase.DefineStart === this.createCurvePhase; }
|
|
60
59
|
get showClosure() { return this.isClosed && CreateCurvePhase.DefineEnd === this.createCurvePhase; }
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
60
|
+
get createCurvePhase() { return this._createCurvePhase; }
|
|
61
|
+
/** Sub-classes should override unless they don't support join or closure. */
|
|
62
|
+
updateCurvePhase() { }
|
|
65
63
|
getCurrentRotation(ev) {
|
|
66
64
|
const matrix = (undefined !== ev.viewport ? core_frontend_1.AccuDrawHintBuilder.getCurrentRotation(ev.viewport, true, true) : undefined);
|
|
67
65
|
return (undefined !== matrix ? matrix : core_geometry_1.Matrix3d.createIdentity());
|
|
@@ -69,14 +67,27 @@ class CreateOrContinuePathTool extends CreateElementTool_1.CreateElementTool {
|
|
|
69
67
|
getUpVector(ev) {
|
|
70
68
|
return this.getCurrentRotation(ev).getColumn(2);
|
|
71
69
|
}
|
|
72
|
-
async updateCurveAndContinuationData(ev, isDynamics
|
|
70
|
+
async updateCurveAndContinuationData(ev, isDynamics) {
|
|
73
71
|
this.isConstruction = false;
|
|
74
72
|
this.current = this.createNewCurvePrimitive(ev, isDynamics);
|
|
75
|
-
if (CreateCurvePhase.DefineStart ===
|
|
73
|
+
if (CreateCurvePhase.DefineStart === this.createCurvePhase)
|
|
76
74
|
await this.isValidForJoin(); // Updates this.continuationData...
|
|
77
|
-
else if (CreateCurvePhase.DefineEnd ===
|
|
75
|
+
else if (CreateCurvePhase.DefineEnd === this.createCurvePhase)
|
|
78
76
|
await this.isValidForClosure(); // Updates this.isClosed...
|
|
79
77
|
}
|
|
78
|
+
async updateElementData(ev, isDynamics) {
|
|
79
|
+
if (!isDynamics)
|
|
80
|
+
this.accepted.push(ev.point.clone());
|
|
81
|
+
await this.updateCurveAndContinuationData(ev, isDynamics);
|
|
82
|
+
if (!isDynamics)
|
|
83
|
+
this.updateCurvePhase();
|
|
84
|
+
}
|
|
85
|
+
async updateDynamicData(ev) {
|
|
86
|
+
// Need to update continuation data for first data point before dynamics has started...
|
|
87
|
+
await this.updateCurveAndContinuationData(ev, true);
|
|
88
|
+
// Don't need to create graphic if dynamics aren't yet active or showing construction geometry...
|
|
89
|
+
return (core_frontend_1.IModelApp.viewManager.inDynamicsMode && !this.isConstruction);
|
|
90
|
+
}
|
|
80
91
|
get isContinueExistingPath() { return undefined !== this.continuationData; }
|
|
81
92
|
async isValidForContinue(snap) {
|
|
82
93
|
if (!snap.isElementHit)
|
|
@@ -208,29 +219,6 @@ class CreateOrContinuePathTool extends CreateElementTool_1.CreateElementTool {
|
|
|
208
219
|
}
|
|
209
220
|
return true;
|
|
210
221
|
}
|
|
211
|
-
clearGraphics() {
|
|
212
|
-
if (undefined === this._graphicsProvider)
|
|
213
|
-
return;
|
|
214
|
-
this._graphicsProvider.cleanupGraphic();
|
|
215
|
-
this._graphicsProvider = undefined;
|
|
216
|
-
}
|
|
217
|
-
async createGraphics(ev) {
|
|
218
|
-
await this.updateCurveAndContinuationData(ev, true, this.createCurvePhase);
|
|
219
|
-
if (!core_frontend_1.IModelApp.viewManager.inDynamicsMode || this.isConstruction)
|
|
220
|
-
return; // Don't need to create graphic if dynamics aren't yet active...
|
|
221
|
-
const placement = this.getPlacementProps();
|
|
222
|
-
if (undefined === placement)
|
|
223
|
-
return;
|
|
224
|
-
const geometry = this.getGeometryProps(placement);
|
|
225
|
-
if (undefined === geometry)
|
|
226
|
-
return;
|
|
227
|
-
if (undefined === this._graphicsProvider)
|
|
228
|
-
this._graphicsProvider = new CreateElementTool_1.DynamicGraphicsProvider(this.iModel, this.toolId);
|
|
229
|
-
// Set chord tolerance for non-linear curve primitives...
|
|
230
|
-
if (ev.viewport)
|
|
231
|
-
this._graphicsProvider.chordTolerance = (0, CreateElementTool_1.computeChordToleranceFromPoint)(ev.viewport, ev.point);
|
|
232
|
-
await this._graphicsProvider.createGraphic(this.targetCategory, placement, geometry);
|
|
233
|
-
}
|
|
234
222
|
addConstructionGraphics(curve, showCurve, context) {
|
|
235
223
|
if (!showCurve) {
|
|
236
224
|
switch (curve.curvePrimitiveType) {
|
|
@@ -296,11 +284,7 @@ class CreateOrContinuePathTool extends CreateElementTool_1.CreateElementTool {
|
|
|
296
284
|
onDynamicFrame(ev, context) {
|
|
297
285
|
if (this.showConstructionGraphics(ev, context))
|
|
298
286
|
return; // Don't display element graphics...
|
|
299
|
-
|
|
300
|
-
this._graphicsProvider.addGraphic(context);
|
|
301
|
-
}
|
|
302
|
-
async onMouseMotion(ev) {
|
|
303
|
-
return this.createGraphics(ev);
|
|
287
|
+
super.onDynamicFrame(ev, context);
|
|
304
288
|
}
|
|
305
289
|
showJoinIndicator(context, pt) {
|
|
306
290
|
const lengthX = Math.floor(context.viewport.pixelsFromInches(0.08)) + 0.5;
|
|
@@ -511,30 +495,13 @@ class CreateOrContinuePathTool extends CreateElementTool_1.CreateElementTool {
|
|
|
511
495
|
return { classFullName: "Generic:PhysicalObject", model, category, code: core_common_1.Code.createEmpty(), placement };
|
|
512
496
|
return { classFullName: "BisCore:DrawingGraphic", model, category, code: core_common_1.Code.createEmpty(), placement };
|
|
513
497
|
}
|
|
514
|
-
async
|
|
515
|
-
const placement = this.getPlacementProps();
|
|
516
|
-
if (undefined === placement)
|
|
517
|
-
return;
|
|
518
|
-
const geometry = this.getGeometryProps(placement);
|
|
519
|
-
if (undefined === geometry)
|
|
520
|
-
return;
|
|
521
|
-
const elemProps = this.getElementProps(placement);
|
|
522
|
-
if (undefined === elemProps)
|
|
523
|
-
return;
|
|
524
|
-
let data;
|
|
525
|
-
if ("flatbuffer" === geometry.format) {
|
|
526
|
-
data = { entryArray: geometry.data };
|
|
527
|
-
delete elemProps.geom; // Leave unchanged until replaced by flatbuffer geometry...
|
|
528
|
-
}
|
|
529
|
-
else {
|
|
530
|
-
elemProps.geom = geometry.data;
|
|
531
|
-
}
|
|
498
|
+
async doCreateElement(props, data) {
|
|
532
499
|
try {
|
|
533
500
|
this._startedCmd = await this.startCommand();
|
|
534
|
-
if (undefined ===
|
|
535
|
-
await CreateOrContinuePathTool.callCommand("insertGeometricElement",
|
|
501
|
+
if (undefined === props.id)
|
|
502
|
+
await CreateOrContinuePathTool.callCommand("insertGeometricElement", props, data);
|
|
536
503
|
else
|
|
537
|
-
await CreateOrContinuePathTool.callCommand("updateGeometricElement",
|
|
504
|
+
await CreateOrContinuePathTool.callCommand("updateGeometricElement", props, data);
|
|
538
505
|
await this.saveChanges();
|
|
539
506
|
}
|
|
540
507
|
catch (err) {
|
|
@@ -554,40 +521,22 @@ class CreateOrContinuePathTool extends CreateElementTool_1.CreateElementTool {
|
|
|
554
521
|
hints.setOrigin(this.accepted[nPts - 1]);
|
|
555
522
|
hints.sendHints();
|
|
556
523
|
}
|
|
557
|
-
setupAndPromptForNextAction() {
|
|
558
|
-
this.setupAccuDraw();
|
|
559
|
-
super.setupAndPromptForNextAction();
|
|
560
|
-
}
|
|
561
|
-
async acceptPoint(ev) {
|
|
562
|
-
const phase = this.createCurvePhase;
|
|
563
|
-
this.accepted.push(ev.point.clone());
|
|
564
|
-
await this.updateCurveAndContinuationData(ev, false, phase);
|
|
565
|
-
return true;
|
|
566
|
-
}
|
|
567
|
-
async cancelPoint(_ev) { return true; }
|
|
568
|
-
async onDataButtonDown(ev) {
|
|
569
|
-
if (!await this.acceptPoint(ev))
|
|
570
|
-
return core_frontend_1.EventHandled.Yes;
|
|
571
|
-
return super.onDataButtonDown(ev);
|
|
572
|
-
}
|
|
573
|
-
async onResetButtonUp(ev) {
|
|
574
|
-
if (!await this.cancelPoint(ev))
|
|
575
|
-
return core_frontend_1.EventHandled.Yes;
|
|
576
|
-
return super.onResetButtonUp(ev);
|
|
577
|
-
}
|
|
578
524
|
async onUndoPreviousStep() {
|
|
579
525
|
if (0 === this.accepted.length)
|
|
580
526
|
return false;
|
|
581
527
|
this.accepted.pop();
|
|
582
|
-
if (0 === this.accepted.length)
|
|
528
|
+
if (0 === this.accepted.length) {
|
|
583
529
|
await this.onReinitialize();
|
|
584
|
-
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
this.updateCurvePhase();
|
|
585
533
|
this.setupAndPromptForNextAction();
|
|
534
|
+
}
|
|
586
535
|
return true;
|
|
587
536
|
}
|
|
588
|
-
async
|
|
589
|
-
|
|
590
|
-
|
|
537
|
+
async onPostInstall() {
|
|
538
|
+
await super.onPostInstall();
|
|
539
|
+
this.updateCurvePhase();
|
|
591
540
|
}
|
|
592
541
|
}
|
|
593
542
|
exports.CreateOrContinuePathTool = CreateOrContinuePathTool;
|
|
@@ -617,6 +566,10 @@ class CreateLineStringTool extends CreateOrContinuePathTool {
|
|
|
617
566
|
// A linestring can support physical closure when creating a new path...
|
|
618
567
|
return this.allowClosure;
|
|
619
568
|
}
|
|
569
|
+
updateCurvePhase() {
|
|
570
|
+
// The first point changes startPoint and last point changes endPoint.
|
|
571
|
+
this._createCurvePhase = (0 === this.accepted.length ? CreateCurvePhase.DefineStart : CreateCurvePhase.DefineEnd);
|
|
572
|
+
}
|
|
620
573
|
isComplete(ev) {
|
|
621
574
|
// Accept on reset with at least 2 points...
|
|
622
575
|
if (core_frontend_1.BeButton.Reset === ev.button)
|
|
@@ -637,7 +590,8 @@ class CreateLineStringTool extends CreateOrContinuePathTool {
|
|
|
637
590
|
async cancelPoint(ev) {
|
|
638
591
|
// NOTE: Starting another tool will not create element...require reset or closure...
|
|
639
592
|
if (this.isComplete(ev)) {
|
|
640
|
-
|
|
593
|
+
this._createCurvePhase = CreateCurvePhase.DefineEnd;
|
|
594
|
+
await this.updateCurveAndContinuationData(ev, false);
|
|
641
595
|
await this.createElement();
|
|
642
596
|
}
|
|
643
597
|
return true;
|
|
@@ -763,19 +717,22 @@ class CreateArcTool extends CreateOrContinuePathTool {
|
|
|
763
717
|
isComplete(_ev) {
|
|
764
718
|
return (3 === this.accepted.length);
|
|
765
719
|
}
|
|
766
|
-
|
|
720
|
+
updateCurvePhase() {
|
|
767
721
|
switch (this.accepted.length) {
|
|
768
722
|
case 0:
|
|
769
|
-
|
|
723
|
+
this._createCurvePhase = ArcMethod.CenterStart === this.method ? CreateCurvePhase.DefineOther : CreateCurvePhase.DefineStart;
|
|
724
|
+
break;
|
|
770
725
|
case 1:
|
|
771
726
|
if (ArcMethod.CenterStart === this.method)
|
|
772
|
-
|
|
727
|
+
this._createCurvePhase = CreateCurvePhase.DefineStart;
|
|
773
728
|
else if (ArcMethod.StartEndMid === this.method)
|
|
774
|
-
|
|
729
|
+
this._createCurvePhase = CreateCurvePhase.DefineEnd;
|
|
775
730
|
else
|
|
776
|
-
|
|
731
|
+
this._createCurvePhase = CreateCurvePhase.DefineOther;
|
|
732
|
+
break;
|
|
777
733
|
default:
|
|
778
|
-
|
|
734
|
+
this._createCurvePhase = ArcMethod.StartEndMid === this.method ? CreateCurvePhase.DefineOther : CreateCurvePhase.DefineEnd;
|
|
735
|
+
break;
|
|
779
736
|
}
|
|
780
737
|
}
|
|
781
738
|
createConstructionCurve(ev, isDynamics) {
|
|
@@ -1068,7 +1025,6 @@ class CreateCircleTool extends CreateOrContinuePathTool {
|
|
|
1068
1025
|
static get minArgs() { return 0; }
|
|
1069
1026
|
static get maxArgs() { return 2; } // method, radius - zero value unlocks associated "use" toggle...
|
|
1070
1027
|
get showCurveConstructions() { return !(CircleMethod.Center === this.method && this.useRadius); }
|
|
1071
|
-
get createCurvePhase() { return CreateCurvePhase.DefineOther; } // No join or closure checks...
|
|
1072
1028
|
provideToolAssistance(mainInstrText, additionalInstr) {
|
|
1073
1029
|
const nPts = this.accepted.length;
|
|
1074
1030
|
switch (this.method) {
|
|
@@ -1146,7 +1102,7 @@ class CreateCircleTool extends CreateOrContinuePathTool {
|
|
|
1146
1102
|
}
|
|
1147
1103
|
else {
|
|
1148
1104
|
this.radius = radius;
|
|
1149
|
-
this.
|
|
1105
|
+
this.syncToolSettingPropertyValue(this.radiusProperty);
|
|
1150
1106
|
}
|
|
1151
1107
|
vector0.scaleToLength(radius, vector0);
|
|
1152
1108
|
vector90.scaleToLength(radius, vector90);
|
|
@@ -1160,11 +1116,6 @@ class CreateCircleTool extends CreateOrContinuePathTool {
|
|
|
1160
1116
|
}
|
|
1161
1117
|
return true;
|
|
1162
1118
|
}
|
|
1163
|
-
syncToolSettingsRadius() {
|
|
1164
|
-
if (this.useRadius)
|
|
1165
|
-
return;
|
|
1166
|
-
this.syncToolSettingsProperties([this.radiusProperty.syncItem]);
|
|
1167
|
-
}
|
|
1168
1119
|
getToolSettingPropertyLocked(property) {
|
|
1169
1120
|
return (property === this.useRadiusProperty ? this.radiusProperty : undefined);
|
|
1170
1121
|
}
|
|
@@ -1276,7 +1227,6 @@ class CreateEllipseTool extends CreateOrContinuePathTool {
|
|
|
1276
1227
|
isComplete(_ev) {
|
|
1277
1228
|
return (3 === this.accepted.length);
|
|
1278
1229
|
}
|
|
1279
|
-
get createCurvePhase() { return CreateCurvePhase.DefineOther; } // No join or closure checks...
|
|
1280
1230
|
provideToolAssistance(mainInstrText, additionalInstr) {
|
|
1281
1231
|
const nPts = this.accepted.length;
|
|
1282
1232
|
switch (nPts) {
|
|
@@ -1378,7 +1328,6 @@ class CreateRectangleTool extends CreateOrContinuePathTool {
|
|
|
1378
1328
|
isComplete(_ev) {
|
|
1379
1329
|
return (2 === this.accepted.length);
|
|
1380
1330
|
}
|
|
1381
|
-
get createCurvePhase() { return CreateCurvePhase.DefineOther; } // No join or closure checks...
|
|
1382
1331
|
createNewCurvePrimitive(ev, isDynamics) {
|
|
1383
1332
|
const numRequired = (isDynamics ? 1 : 2);
|
|
1384
1333
|
if (this.accepted.length < numRequired)
|
|
@@ -1546,6 +1495,10 @@ class CreateBCurveTool extends CreateOrContinuePathTool {
|
|
|
1546
1495
|
return CreateCurvePhase.DefineOther;
|
|
1547
1496
|
return super.createCurvePhase;
|
|
1548
1497
|
}
|
|
1498
|
+
updateCurvePhase() {
|
|
1499
|
+
// The first point changes startPoint and last point changes endPoint.
|
|
1500
|
+
this._createCurvePhase = (0 === this.accepted.length ? CreateCurvePhase.DefineStart : CreateCurvePhase.DefineEnd);
|
|
1501
|
+
}
|
|
1549
1502
|
isComplete(ev) {
|
|
1550
1503
|
// Accept on reset with sufficient points...
|
|
1551
1504
|
if (core_frontend_1.BeButton.Reset === ev.button)
|
|
@@ -1634,7 +1587,7 @@ class CreateBCurveTool extends CreateOrContinuePathTool {
|
|
|
1634
1587
|
this._isPhysicallyClosedOrComplete = true;
|
|
1635
1588
|
break;
|
|
1636
1589
|
}
|
|
1637
|
-
await this.updateCurveAndContinuationData(ev, false
|
|
1590
|
+
await this.updateCurveAndContinuationData(ev, false);
|
|
1638
1591
|
return true;
|
|
1639
1592
|
}
|
|
1640
1593
|
async cancelPoint(ev) {
|
|
@@ -1644,7 +1597,8 @@ class CreateBCurveTool extends CreateOrContinuePathTool {
|
|
|
1644
1597
|
const fitCurve = this.current;
|
|
1645
1598
|
switch (this._tangentPhase) {
|
|
1646
1599
|
case CreateCurvePhase.DefineOther:
|
|
1647
|
-
|
|
1600
|
+
this._createCurvePhase = CreateCurvePhase.DefineEnd;
|
|
1601
|
+
await this.updateCurveAndContinuationData(ev, false);
|
|
1648
1602
|
this._tangentPhase = (undefined === fitCurve.options.startTangent ? CreateCurvePhase.DefineStart : CreateCurvePhase.DefineEnd);
|
|
1649
1603
|
core_frontend_1.IModelApp.toolAdmin.updateDynamics();
|
|
1650
1604
|
this.setupAndPromptForNextAction();
|
|
@@ -1661,7 +1615,8 @@ class CreateBCurveTool extends CreateOrContinuePathTool {
|
|
|
1661
1615
|
return true;
|
|
1662
1616
|
}
|
|
1663
1617
|
}
|
|
1664
|
-
|
|
1618
|
+
this._createCurvePhase = CreateCurvePhase.DefineEnd;
|
|
1619
|
+
await this.updateCurveAndContinuationData(ev, false);
|
|
1665
1620
|
await this.createElement();
|
|
1666
1621
|
}
|
|
1667
1622
|
return true;
|