@itwin/editor-frontend 4.5.0-dev.8 → 4.6.0-dev.0
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 +51 -1
- package/LICENSE.md +1 -1
- package/README.md +0 -29
- package/lib/cjs/CreateElementTool.d.ts +64 -2
- package/lib/cjs/CreateElementTool.d.ts.map +1 -1
- package/lib/cjs/CreateElementTool.js +65 -4
- package/lib/cjs/CreateElementTool.js.map +1 -1
- package/lib/cjs/EditTool.d.ts +5 -0
- package/lib/cjs/EditTool.d.ts.map +1 -1
- package/lib/cjs/EditTool.js +10 -14
- package/lib/cjs/EditTool.js.map +1 -1
- package/lib/cjs/EditToolIpc.d.ts +1 -5
- package/lib/cjs/EditToolIpc.d.ts.map +1 -1
- package/lib/cjs/EditToolIpc.js +1 -5
- package/lib/cjs/EditToolIpc.js.map +1 -1
- package/lib/cjs/TransformElementsTool.d.ts +17 -98
- package/lib/cjs/TransformElementsTool.d.ts.map +1 -1
- package/lib/cjs/TransformElementsTool.js +15 -412
- package/lib/cjs/TransformElementsTool.js.map +1 -1
- package/lib/cjs/editor-frontend.d.ts +0 -6
- package/lib/cjs/editor-frontend.d.ts.map +1 -1
- package/lib/cjs/editor-frontend.js +0 -6
- package/lib/cjs/editor-frontend.js.map +1 -1
- package/lib/esm/CreateElementTool.d.ts +64 -2
- package/lib/esm/CreateElementTool.d.ts.map +1 -1
- package/lib/esm/CreateElementTool.js +65 -4
- package/lib/esm/CreateElementTool.js.map +1 -1
- package/lib/esm/EditTool.d.ts +5 -0
- package/lib/esm/EditTool.d.ts.map +1 -1
- package/lib/esm/EditTool.js +10 -14
- package/lib/esm/EditTool.js.map +1 -1
- package/lib/esm/EditToolIpc.d.ts +1 -5
- package/lib/esm/EditToolIpc.d.ts.map +1 -1
- package/lib/esm/EditToolIpc.js +0 -4
- package/lib/esm/EditToolIpc.js.map +1 -1
- package/lib/esm/TransformElementsTool.d.ts +17 -98
- package/lib/esm/TransformElementsTool.d.ts.map +1 -1
- package/lib/esm/TransformElementsTool.js +16 -413
- package/lib/esm/TransformElementsTool.js.map +1 -1
- package/lib/esm/editor-frontend.d.ts +0 -6
- package/lib/esm/editor-frontend.d.ts.map +1 -1
- package/lib/esm/editor-frontend.js +0 -6
- package/lib/esm/editor-frontend.js.map +1 -1
- package/lib/public/locales/en/Editor.json +0 -411
- package/package.json +14 -14
- package/lib/cjs/DeleteElementsTool.d.ts +0 -14
- package/lib/cjs/DeleteElementsTool.d.ts.map +0 -1
- package/lib/cjs/DeleteElementsTool.js +0 -42
- package/lib/cjs/DeleteElementsTool.js.map +0 -1
- package/lib/cjs/ElementGeometryTool.d.ts +0 -148
- package/lib/cjs/ElementGeometryTool.d.ts.map +0 -1
- package/lib/cjs/ElementGeometryTool.js +0 -705
- package/lib/cjs/ElementGeometryTool.js.map +0 -1
- package/lib/cjs/ModifyCurveTools.d.ts +0 -140
- package/lib/cjs/ModifyCurveTools.d.ts.map +0 -1
- package/lib/cjs/ModifyCurveTools.js +0 -777
- package/lib/cjs/ModifyCurveTools.js.map +0 -1
- package/lib/cjs/SketchTools.d.ts +0 -308
- package/lib/cjs/SketchTools.d.ts.map +0 -1
- package/lib/cjs/SketchTools.js +0 -1708
- package/lib/cjs/SketchTools.js.map +0 -1
- package/lib/cjs/SolidModelingTools.d.ts +0 -381
- package/lib/cjs/SolidModelingTools.d.ts.map +0 -1
- package/lib/cjs/SolidModelingTools.js +0 -1453
- package/lib/cjs/SolidModelingTools.js.map +0 -1
- package/lib/cjs/SolidPrimitiveTools.d.ts +0 -322
- package/lib/cjs/SolidPrimitiveTools.d.ts.map +0 -1
- package/lib/cjs/SolidPrimitiveTools.js +0 -1376
- package/lib/cjs/SolidPrimitiveTools.js.map +0 -1
- package/lib/esm/DeleteElementsTool.d.ts +0 -14
- package/lib/esm/DeleteElementsTool.d.ts.map +0 -1
- package/lib/esm/DeleteElementsTool.js +0 -39
- package/lib/esm/DeleteElementsTool.js.map +0 -1
- package/lib/esm/ElementGeometryTool.d.ts +0 -148
- package/lib/esm/ElementGeometryTool.d.ts.map +0 -1
- package/lib/esm/ElementGeometryTool.js +0 -697
- package/lib/esm/ElementGeometryTool.js.map +0 -1
- package/lib/esm/ModifyCurveTools.d.ts +0 -140
- package/lib/esm/ModifyCurveTools.d.ts.map +0 -1
- package/lib/esm/ModifyCurveTools.js +0 -772
- package/lib/esm/ModifyCurveTools.js.map +0 -1
- package/lib/esm/SketchTools.d.ts +0 -308
- package/lib/esm/SketchTools.d.ts.map +0 -1
- package/lib/esm/SketchTools.js +0 -1704
- package/lib/esm/SketchTools.js.map +0 -1
- package/lib/esm/SolidModelingTools.d.ts +0 -381
- package/lib/esm/SolidModelingTools.d.ts.map +0 -1
- package/lib/esm/SolidModelingTools.js +0 -1445
- package/lib/esm/SolidModelingTools.js.map +0 -1
- package/lib/esm/SolidPrimitiveTools.d.ts +0 -322
- package/lib/esm/SolidPrimitiveTools.d.ts.map +0 -1
- package/lib/esm/SolidPrimitiveTools.js +0 -1372
- package/lib/esm/SolidPrimitiveTools.js.map +0 -1
package/lib/cjs/EditToolIpc.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module Editing
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
10
|
+
exports.basicManipulationIpc = exports.makeEditToolIpc = void 0;
|
|
11
11
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
12
12
|
const editor_common_1 = require("@itwin/editor-common");
|
|
13
13
|
/**
|
|
@@ -22,8 +22,4 @@ exports.makeEditToolIpc = makeEditToolIpc;
|
|
|
22
22
|
* @internal
|
|
23
23
|
*/
|
|
24
24
|
exports.basicManipulationIpc = makeEditToolIpc();
|
|
25
|
-
/** Proxy for calling methods in `SolidModelingCommandIpc`
|
|
26
|
-
* @internal
|
|
27
|
-
*/
|
|
28
|
-
exports.solidModelingIpc = makeEditToolIpc();
|
|
29
25
|
//# sourceMappingURL=EditToolIpc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditToolIpc.js","sourceRoot":"","sources":["../../src/EditToolIpc.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"EditToolIpc.js","sourceRoot":"","sources":["../../src/EditToolIpc.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAA8C;AAC9C,wDAAqG;AAErG;;;GAGG;AACH,SAAgB,eAAe;IAC7B,OAAO,sBAAM,CAAC,oBAAoB,CAAI,gCAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAChF,CAAC;AAFD,0CAEC;AAED;;GAEG;AACU,QAAA,oBAAoB,GAAG,eAAe,EAA+B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { PickAsyncMethods } from \"@itwin/core-bentley\";\nimport { IpcApp } from \"@itwin/core-frontend\";\nimport { BasicManipulationCommandIpc, EditCommandIpc, editorIpcStrings } from \"@itwin/editor-common\";\n\n/**\n * Create a type safe Proxy object to make IPC calls from [[EditTools]] to methods of an `EditCommandIpc` interface of the current `EditCommand`.\n * @beta\n */\nexport function makeEditToolIpc<K extends EditCommandIpc>(): PickAsyncMethods<K> {\n return IpcApp.makeIpcFunctionProxy<K>(editorIpcStrings.channel, \"callMethod\");\n}\n\n/** Proxy for calling methods in `BasicManipulationCommandIpc`\n * @internal\n */\nexport const basicManipulationIpc = makeEditToolIpc<BasicManipulationCommandIpc>();\n\n"]}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Editing
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { Id64Arg, Id64Array, Id64String } from "@itwin/core-bentley";
|
|
4
|
+
import { Id64Arg, Id64String } from "@itwin/core-bentley";
|
|
6
5
|
import { Placement } from "@itwin/core-common";
|
|
7
|
-
import { BeButtonEvent, DynamicsContext, ElementSetTool, IModelConnection, RenderGraphic, RenderGraphicOwner
|
|
8
|
-
import {
|
|
6
|
+
import { BeButtonEvent, DynamicsContext, ElementSetTool, IModelConnection, RenderGraphic, RenderGraphicOwner } from "@itwin/core-frontend";
|
|
7
|
+
import { Transform } from "@itwin/core-geometry";
|
|
9
8
|
/** Geometric element id, placement, and RenderGraphic managed by [[TransformGraphicsProvider]].
|
|
10
9
|
* @beta
|
|
11
10
|
*/
|
|
@@ -48,6 +47,20 @@ export declare class TransformGraphicsProvider {
|
|
|
48
47
|
addGraphics(transform: Transform, context: DynamicsContext): void;
|
|
49
48
|
}
|
|
50
49
|
/** Edit tool base class for applying a transform to element placements.
|
|
50
|
+
* Example of a tool that would translate elements:
|
|
51
|
+
* ```ts
|
|
52
|
+
* class SampleMoveElementsTool extends TransformElementsTool {
|
|
53
|
+
* public static override toolId = "SampleMoveElements";
|
|
54
|
+
* public static override iconSpec = "icon-move";
|
|
55
|
+
* protected calculateTransform(ev: BeButtonEvent): Transform | undefined {
|
|
56
|
+
* return (this.anchorPoint ? Transform.createTranslation(ev.point.minus(this.anchorPoint)) : undefined);
|
|
57
|
+
* }
|
|
58
|
+
* public async onRestartTool(): Promise<void> {
|
|
59
|
+
* const tool = new SampleMoveElementsTool();
|
|
60
|
+
* if (!await tool.run()) return this.exitTool();
|
|
61
|
+
* }
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
51
64
|
* @beta
|
|
52
65
|
*/
|
|
53
66
|
export declare abstract class TransformElementsTool extends ElementSetTool {
|
|
@@ -77,98 +90,4 @@ export declare abstract class TransformElementsTool extends ElementSetTool {
|
|
|
77
90
|
onProcessComplete(): Promise<void>;
|
|
78
91
|
onCleanup(): Promise<void>;
|
|
79
92
|
}
|
|
80
|
-
/** @alpha Move elements by applying translation to placement. */
|
|
81
|
-
export declare class MoveElementsTool extends TransformElementsTool {
|
|
82
|
-
static toolId: string;
|
|
83
|
-
static iconSpec: string;
|
|
84
|
-
protected calculateTransform(ev: BeButtonEvent): Transform | undefined;
|
|
85
|
-
protected provideToolAssistance(_mainInstrText?: string, _additionalInstr?: ToolAssistanceInstruction[]): void;
|
|
86
|
-
onRestartTool(): Promise<void>;
|
|
87
|
-
}
|
|
88
|
-
/** Create new elements with translation applied to placement.
|
|
89
|
-
* This is a brute force implementation strictly for example and testing purposes.
|
|
90
|
-
* The new elements are Generic:PhysicalObject or BisCore:DrawingGraphic using the model and category of original.
|
|
91
|
-
* Does not preserve assemblies and geometric elements without geometry are not copied.
|
|
92
|
-
* Using loadProps to return json format geometry to the frontend for each element in the tool agenda is very inefficient.
|
|
93
|
-
* Applications that wish to support copy are expected to sub-class TransformElementsTool and register their
|
|
94
|
-
* own EditCommand that can correctly copy their application elements.
|
|
95
|
-
* @alpha
|
|
96
|
-
*/
|
|
97
|
-
export declare class CopyElementsTool extends MoveElementsTool {
|
|
98
|
-
static toolId: string;
|
|
99
|
-
static iconSpec: string;
|
|
100
|
-
static get minArgs(): number;
|
|
101
|
-
static get maxArgs(): number;
|
|
102
|
-
private _numCopiesProperty;
|
|
103
|
-
get numCopiesProperty(): DialogProperty<number>;
|
|
104
|
-
get numCopies(): number;
|
|
105
|
-
set numCopies(value: number);
|
|
106
|
-
protected get wantMakeCopy(): boolean;
|
|
107
|
-
protected updateAnchorLocation(transform: Transform): void;
|
|
108
|
-
protected doTransformedCopy(ids: Id64Array, transform: Transform, numCopies: number): Promise<Id64Arg | undefined>;
|
|
109
|
-
protected transformAndCopyAgenda(transform: Transform): Promise<Id64Arg | undefined>;
|
|
110
|
-
applyToolSettingPropertyChange(updatedValue: DialogPropertySyncItem): Promise<boolean>;
|
|
111
|
-
supplyToolSettingsProperties(): DialogItem[] | undefined;
|
|
112
|
-
onRestartTool(): Promise<void>;
|
|
113
|
-
/** The keyin takes the following arguments, all of which are optional:
|
|
114
|
-
* - `numCopies=number` Number of copies of each element to create, default is 1.
|
|
115
|
-
*/
|
|
116
|
-
parseAndRun(...inputArgs: string[]): Promise<boolean>;
|
|
117
|
-
}
|
|
118
|
-
/** @alpha */
|
|
119
|
-
export declare enum RotateMethod {
|
|
120
|
-
By3Points = 0,
|
|
121
|
-
ByAngle = 1
|
|
122
|
-
}
|
|
123
|
-
/** @alpha */
|
|
124
|
-
export declare enum RotateAbout {
|
|
125
|
-
Point = 0,
|
|
126
|
-
Origin = 1,
|
|
127
|
-
Center = 2
|
|
128
|
-
}
|
|
129
|
-
/** @alpha Rotate elements by applying transform to placement. */
|
|
130
|
-
export declare class RotateElementsTool extends TransformElementsTool {
|
|
131
|
-
static toolId: string;
|
|
132
|
-
static iconSpec: string;
|
|
133
|
-
protected xAxisPoint?: Point3d;
|
|
134
|
-
protected havePivotPoint: boolean;
|
|
135
|
-
protected haveFinalPoint: boolean;
|
|
136
|
-
static get minArgs(): number;
|
|
137
|
-
static get maxArgs(): number;
|
|
138
|
-
private static methodMessage;
|
|
139
|
-
private static getMethodChoices;
|
|
140
|
-
private _methodProperty;
|
|
141
|
-
get methodProperty(): DialogProperty<number>;
|
|
142
|
-
get rotateMethod(): RotateMethod;
|
|
143
|
-
set rotateMethod(method: RotateMethod);
|
|
144
|
-
private static aboutMessage;
|
|
145
|
-
private static getAboutChoices;
|
|
146
|
-
private _aboutProperty;
|
|
147
|
-
get aboutProperty(): DialogProperty<number>;
|
|
148
|
-
get rotateAbout(): RotateAbout;
|
|
149
|
-
set rotateAbout(method: RotateAbout);
|
|
150
|
-
private _angleProperty;
|
|
151
|
-
get angleProperty(): DialogProperty<number>;
|
|
152
|
-
get rotateAngle(): number;
|
|
153
|
-
set rotateAngle(value: number);
|
|
154
|
-
protected get requireAcceptForSelectionSetDynamics(): boolean;
|
|
155
|
-
protected calculateTransform(ev: BeButtonEvent): Transform | undefined;
|
|
156
|
-
protected transformAgendaDynamics(transform: Transform, context: DynamicsContext): void;
|
|
157
|
-
protected transformAgenda(transform: Transform): Promise<void>;
|
|
158
|
-
onDynamicFrame(ev: BeButtonEvent, context: DynamicsContext): void;
|
|
159
|
-
protected get wantAdditionalInput(): boolean;
|
|
160
|
-
protected wantProcessAgenda(ev: BeButtonEvent): boolean;
|
|
161
|
-
protected setupAndPromptForNextAction(): void;
|
|
162
|
-
protected provideToolAssistance(_mainInstrText?: string, _additionalInstr?: ToolAssistanceInstruction[]): void;
|
|
163
|
-
applyToolSettingPropertyChange(updatedValue: DialogPropertySyncItem): Promise<boolean>;
|
|
164
|
-
supplyToolSettingsProperties(): DialogItem[] | undefined;
|
|
165
|
-
onRestartTool(): Promise<void>;
|
|
166
|
-
onInstall(): Promise<boolean>;
|
|
167
|
-
/** The keyin takes the following arguments, all of which are optional:
|
|
168
|
-
* - `method=0|1` How rotate angle will be specified. 0 for by 3 points, 1 for by specified angle.
|
|
169
|
-
* - `about=0|1|2` Location to rotate about. 0 for point, 1 for placement origin, and 2 for center of range.
|
|
170
|
-
* - `angle=number` Rotation angle in degrees when not defining angle by points.
|
|
171
|
-
*/
|
|
172
|
-
parseAndRun(...inputArgs: string[]): Promise<boolean>;
|
|
173
|
-
}
|
|
174
93
|
//# sourceMappingURL=TransformElementsTool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransformElementsTool.d.ts","sourceRoot":"","sources":["../../src/TransformElementsTool.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"TransformElementsTool.d.ts","sourceRoot":"","sources":["../../src/TransformElementsTool.ts"],"names":[],"mappings":"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"}
|
|
@@ -4,15 +4,13 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.TransformElementsTool = exports.TransformGraphicsProvider = void 0;
|
|
8
8
|
/** @packageDocumentation
|
|
9
9
|
* @module Editing
|
|
10
10
|
*/
|
|
11
|
-
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
12
11
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
12
|
const core_common_1 = require("@itwin/core-common");
|
|
14
13
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
15
|
-
const core_geometry_1 = require("@itwin/core-geometry");
|
|
16
14
|
const editor_common_1 = require("@itwin/editor-common");
|
|
17
15
|
const EditTool_1 = require("./EditTool");
|
|
18
16
|
const EditToolIpc_1 = require("./EditToolIpc");
|
|
@@ -133,6 +131,20 @@ class TransformGraphicsProvider {
|
|
|
133
131
|
}
|
|
134
132
|
exports.TransformGraphicsProvider = TransformGraphicsProvider;
|
|
135
133
|
/** Edit tool base class for applying a transform to element placements.
|
|
134
|
+
* Example of a tool that would translate elements:
|
|
135
|
+
* ```ts
|
|
136
|
+
* class SampleMoveElementsTool extends TransformElementsTool {
|
|
137
|
+
* public static override toolId = "SampleMoveElements";
|
|
138
|
+
* public static override iconSpec = "icon-move";
|
|
139
|
+
* protected calculateTransform(ev: BeButtonEvent): Transform | undefined {
|
|
140
|
+
* return (this.anchorPoint ? Transform.createTranslation(ev.point.minus(this.anchorPoint)) : undefined);
|
|
141
|
+
* }
|
|
142
|
+
* public async onRestartTool(): Promise<void> {
|
|
143
|
+
* const tool = new SampleMoveElementsTool();
|
|
144
|
+
* if (!await tool.run()) return this.exitTool();
|
|
145
|
+
* }
|
|
146
|
+
* }
|
|
147
|
+
* ```
|
|
136
148
|
* @beta
|
|
137
149
|
*/
|
|
138
150
|
class TransformElementsTool extends core_frontend_1.ElementSetTool {
|
|
@@ -248,413 +260,4 @@ class TransformElementsTool extends core_frontend_1.ElementSetTool {
|
|
|
248
260
|
}
|
|
249
261
|
}
|
|
250
262
|
exports.TransformElementsTool = TransformElementsTool;
|
|
251
|
-
/** @alpha Move elements by applying translation to placement. */
|
|
252
|
-
class MoveElementsTool extends TransformElementsTool {
|
|
253
|
-
calculateTransform(ev) {
|
|
254
|
-
if (undefined === this.anchorPoint)
|
|
255
|
-
return undefined;
|
|
256
|
-
return core_geometry_1.Transform.createTranslation(ev.point.minus(this.anchorPoint));
|
|
257
|
-
}
|
|
258
|
-
provideToolAssistance(_mainInstrText, _additionalInstr) {
|
|
259
|
-
let mainMsg;
|
|
260
|
-
if (!this.isSelectByPoints && !this.wantAdditionalElements)
|
|
261
|
-
mainMsg = core_frontend_1.CoreTools.translate(this.wantAdditionalInput ? "ElementSet.Prompts.StartPoint" : "ElementSet.Prompts.EndPoint");
|
|
262
|
-
super.provideToolAssistance(mainMsg);
|
|
263
|
-
}
|
|
264
|
-
async onRestartTool() {
|
|
265
|
-
const tool = new MoveElementsTool();
|
|
266
|
-
if (!await tool.run())
|
|
267
|
-
return this.exitTool();
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
MoveElementsTool.toolId = "MoveElements";
|
|
271
|
-
MoveElementsTool.iconSpec = "icon-move";
|
|
272
|
-
exports.MoveElementsTool = MoveElementsTool;
|
|
273
|
-
/** Create new elements with translation applied to placement.
|
|
274
|
-
* This is a brute force implementation strictly for example and testing purposes.
|
|
275
|
-
* The new elements are Generic:PhysicalObject or BisCore:DrawingGraphic using the model and category of original.
|
|
276
|
-
* Does not preserve assemblies and geometric elements without geometry are not copied.
|
|
277
|
-
* Using loadProps to return json format geometry to the frontend for each element in the tool agenda is very inefficient.
|
|
278
|
-
* Applications that wish to support copy are expected to sub-class TransformElementsTool and register their
|
|
279
|
-
* own EditCommand that can correctly copy their application elements.
|
|
280
|
-
* @alpha
|
|
281
|
-
*/
|
|
282
|
-
class CopyElementsTool extends MoveElementsTool {
|
|
283
|
-
static get minArgs() { return 0; }
|
|
284
|
-
static get maxArgs() { return 1; }
|
|
285
|
-
get numCopiesProperty() {
|
|
286
|
-
if (!this._numCopiesProperty)
|
|
287
|
-
this._numCopiesProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildNumberEditorDescription("numCopies", EditTool_1.EditTools.translate("CopyElements.Label.NumCopies"), { type: appui_abstract_1.PropertyEditorParamTypes.Range, minimum: 1 }), 1);
|
|
288
|
-
return this._numCopiesProperty;
|
|
289
|
-
}
|
|
290
|
-
get numCopies() { return this.numCopiesProperty.value; }
|
|
291
|
-
set numCopies(value) { this.numCopiesProperty.value = value; }
|
|
292
|
-
get wantMakeCopy() { return this.numCopies > 0; }
|
|
293
|
-
updateAnchorLocation(transform) {
|
|
294
|
-
// Account for additional copies for repeat operation anchor point...
|
|
295
|
-
for (let iCopy = 0; iCopy < this.numCopies; ++iCopy)
|
|
296
|
-
super.updateAnchorLocation(transform);
|
|
297
|
-
}
|
|
298
|
-
async doTransformedCopy(ids, transform, numCopies) {
|
|
299
|
-
if (numCopies < 1 || 0 === ids.length)
|
|
300
|
-
return undefined;
|
|
301
|
-
this._startedCmd = await this.startCommand();
|
|
302
|
-
const newIds = [];
|
|
303
|
-
for (const id of ids) {
|
|
304
|
-
// NOTE: For testing only. Using loadProps to return json format geometry to the frontend for each element in the tool agenda is very inefficient.
|
|
305
|
-
const props = await this.iModel.elements.loadProps(id, { wantGeometry: true, wantBRepData: true });
|
|
306
|
-
if (undefined === props.placement)
|
|
307
|
-
continue;
|
|
308
|
-
const placement = (0, core_common_1.isPlacement2dProps)(props.placement) ? core_common_1.Placement2d.fromJSON(props.placement) : core_common_1.Placement3d.fromJSON(props.placement);
|
|
309
|
-
if (!placement.isValid)
|
|
310
|
-
continue; // Ignore assembly parents w/o geometry, etc...
|
|
311
|
-
const classFullName = (placement.is3d ? "Generic:PhysicalObject" : "BisCore:DrawingGraphic");
|
|
312
|
-
const newProps = { classFullName, model: props.model, category: props.category, code: core_common_1.Code.createEmpty(), placement, geom: props.geom };
|
|
313
|
-
let newId;
|
|
314
|
-
for (let iCopy = 0; iCopy < numCopies; ++iCopy) {
|
|
315
|
-
placement.multiplyTransform(transform);
|
|
316
|
-
newId = await EditToolIpc_1.basicManipulationIpc.insertGeometricElement(newProps);
|
|
317
|
-
}
|
|
318
|
-
if (undefined !== newId)
|
|
319
|
-
newIds.push(newId); // When numCopies > 1 ids are return for just the final copy...
|
|
320
|
-
}
|
|
321
|
-
return (0 === newIds.length ? undefined : newIds);
|
|
322
|
-
}
|
|
323
|
-
async transformAndCopyAgenda(transform) {
|
|
324
|
-
try {
|
|
325
|
-
const newIds = await this.doTransformedCopy(this.agenda.elements, transform, this.numCopies);
|
|
326
|
-
if (undefined !== newIds)
|
|
327
|
-
await this.saveChanges();
|
|
328
|
-
return newIds;
|
|
329
|
-
}
|
|
330
|
-
catch (err) {
|
|
331
|
-
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, core_bentley_1.BentleyError.getErrorMessage(err) || "An unknown error occurred."));
|
|
332
|
-
return undefined;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
async applyToolSettingPropertyChange(updatedValue) {
|
|
336
|
-
// NOTE: Don't call changeToolSettingPropertyValue, value of numCopies should not be saved...
|
|
337
|
-
if (updatedValue.propertyName !== this.numCopiesProperty.name || undefined === updatedValue.value.value)
|
|
338
|
-
return false;
|
|
339
|
-
this.numCopies = updatedValue.value.value;
|
|
340
|
-
return true;
|
|
341
|
-
}
|
|
342
|
-
supplyToolSettingsProperties() {
|
|
343
|
-
// NOTE: Don't call initializeToolSettingPropertyValues, value of numCopies is not saved...
|
|
344
|
-
const toolSettings = new Array();
|
|
345
|
-
toolSettings.push(this.numCopiesProperty.toDialogItem({ rowPriority: 1, columnIndex: 2 }));
|
|
346
|
-
return toolSettings;
|
|
347
|
-
}
|
|
348
|
-
async onRestartTool() {
|
|
349
|
-
const tool = new CopyElementsTool();
|
|
350
|
-
tool.numCopies = this.numCopies; // Preserve numCopies on restart...
|
|
351
|
-
if (!await tool.run())
|
|
352
|
-
return this.exitTool();
|
|
353
|
-
}
|
|
354
|
-
/** The keyin takes the following arguments, all of which are optional:
|
|
355
|
-
* - `numCopies=number` Number of copies of each element to create, default is 1.
|
|
356
|
-
*/
|
|
357
|
-
async parseAndRun(...inputArgs) {
|
|
358
|
-
for (const arg of inputArgs) {
|
|
359
|
-
const parts = arg.split("=");
|
|
360
|
-
if (2 !== parts.length)
|
|
361
|
-
continue;
|
|
362
|
-
if (parts[0].toLowerCase().startsWith("num")) {
|
|
363
|
-
const copies = Number.parseInt(parts[1], 10);
|
|
364
|
-
if (copies >= 1)
|
|
365
|
-
this.numCopies = copies; // NOTE: Don't call saveToolSettingPropertyValue, always default to single copy...
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return this.run();
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
CopyElementsTool.toolId = "CopyElements";
|
|
372
|
-
CopyElementsTool.iconSpec = "icon-move"; // Need better icon...
|
|
373
|
-
exports.CopyElementsTool = CopyElementsTool;
|
|
374
|
-
/** @alpha */
|
|
375
|
-
var RotateMethod;
|
|
376
|
-
(function (RotateMethod) {
|
|
377
|
-
RotateMethod[RotateMethod["By3Points"] = 0] = "By3Points";
|
|
378
|
-
RotateMethod[RotateMethod["ByAngle"] = 1] = "ByAngle";
|
|
379
|
-
})(RotateMethod = exports.RotateMethod || (exports.RotateMethod = {}));
|
|
380
|
-
/** @alpha */
|
|
381
|
-
var RotateAbout;
|
|
382
|
-
(function (RotateAbout) {
|
|
383
|
-
RotateAbout[RotateAbout["Point"] = 0] = "Point";
|
|
384
|
-
RotateAbout[RotateAbout["Origin"] = 1] = "Origin";
|
|
385
|
-
RotateAbout[RotateAbout["Center"] = 2] = "Center";
|
|
386
|
-
})(RotateAbout = exports.RotateAbout || (exports.RotateAbout = {}));
|
|
387
|
-
/** @alpha Rotate elements by applying transform to placement. */
|
|
388
|
-
class RotateElementsTool extends TransformElementsTool {
|
|
389
|
-
constructor() {
|
|
390
|
-
super(...arguments);
|
|
391
|
-
this.havePivotPoint = false;
|
|
392
|
-
this.haveFinalPoint = false;
|
|
393
|
-
}
|
|
394
|
-
static get minArgs() { return 0; }
|
|
395
|
-
static get maxArgs() { return 3; }
|
|
396
|
-
static methodMessage(str) { return EditTool_1.EditTools.translate(`RotateElements.Method.${str}`); }
|
|
397
|
-
get methodProperty() {
|
|
398
|
-
if (!this._methodProperty)
|
|
399
|
-
this._methodProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildEnumPicklistEditorDescription("rotateMethod", EditTool_1.EditTools.translate("RotateElements.Label.Method"), RotateElementsTool.getMethodChoices()), RotateMethod.By3Points);
|
|
400
|
-
return this._methodProperty;
|
|
401
|
-
}
|
|
402
|
-
get rotateMethod() { return this.methodProperty.value; }
|
|
403
|
-
set rotateMethod(method) { this.methodProperty.value = method; }
|
|
404
|
-
static aboutMessage(str) { return EditTool_1.EditTools.translate(`RotateElements.About.${str}`); }
|
|
405
|
-
get aboutProperty() {
|
|
406
|
-
if (!this._aboutProperty)
|
|
407
|
-
this._aboutProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildEnumPicklistEditorDescription("rotateAbout", EditTool_1.EditTools.translate("RotateElements.Label.About"), RotateElementsTool.getAboutChoices()), RotateAbout.Point);
|
|
408
|
-
return this._aboutProperty;
|
|
409
|
-
}
|
|
410
|
-
get rotateAbout() { return this.aboutProperty.value; }
|
|
411
|
-
set rotateAbout(method) { this.aboutProperty.value = method; }
|
|
412
|
-
get angleProperty() {
|
|
413
|
-
if (!this._angleProperty)
|
|
414
|
-
this._angleProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.AngleDescription("rotateAngle", EditTool_1.EditTools.translate("RotateElements.Label.Angle")), 0.0);
|
|
415
|
-
return this._angleProperty;
|
|
416
|
-
}
|
|
417
|
-
get rotateAngle() { return this.angleProperty.value; }
|
|
418
|
-
set rotateAngle(value) { this.angleProperty.value = value; }
|
|
419
|
-
get requireAcceptForSelectionSetDynamics() { return RotateMethod.ByAngle !== this.rotateMethod; }
|
|
420
|
-
calculateTransform(ev) {
|
|
421
|
-
if (undefined === ev.viewport)
|
|
422
|
-
return undefined;
|
|
423
|
-
if (RotateMethod.ByAngle === this.rotateMethod) {
|
|
424
|
-
const rotMatrix = core_frontend_1.AccuDrawHintBuilder.getCurrentRotation(ev.viewport, true, true);
|
|
425
|
-
if (undefined === rotMatrix)
|
|
426
|
-
return undefined;
|
|
427
|
-
const invMatrix = rotMatrix.inverse();
|
|
428
|
-
if (undefined === invMatrix)
|
|
429
|
-
return undefined;
|
|
430
|
-
const angMatrix = core_geometry_1.YawPitchRollAngles.createRadians(this.rotateAngle, 0, 0).toMatrix3d();
|
|
431
|
-
if (undefined === angMatrix)
|
|
432
|
-
return undefined;
|
|
433
|
-
angMatrix.multiplyMatrixMatrix(invMatrix, invMatrix);
|
|
434
|
-
rotMatrix.multiplyMatrixMatrix(invMatrix, rotMatrix);
|
|
435
|
-
return core_geometry_1.Transform.createFixedPointAndMatrix(ev.point, rotMatrix);
|
|
436
|
-
}
|
|
437
|
-
if (undefined === this.anchorPoint || undefined === this.xAxisPoint)
|
|
438
|
-
return undefined;
|
|
439
|
-
const vec1 = core_geometry_1.Vector3d.createStartEnd(this.anchorPoint, this.xAxisPoint);
|
|
440
|
-
const vec2 = core_geometry_1.Vector3d.createStartEnd(this.anchorPoint, ev.point);
|
|
441
|
-
if (!vec1.normalizeInPlace() || !vec2.normalizeInPlace())
|
|
442
|
-
return undefined;
|
|
443
|
-
const dot = vec1.dotProduct(vec2);
|
|
444
|
-
if (dot > (1.0 - core_geometry_1.Geometry.smallAngleRadians))
|
|
445
|
-
return undefined;
|
|
446
|
-
if (dot < (-1.0 + core_geometry_1.Geometry.smallAngleRadians)) {
|
|
447
|
-
const rotMatrix = core_frontend_1.AccuDrawHintBuilder.getCurrentRotation(ev.viewport, true, true);
|
|
448
|
-
if (undefined === rotMatrix)
|
|
449
|
-
return undefined;
|
|
450
|
-
const invMatrix = rotMatrix.inverse();
|
|
451
|
-
if (undefined === invMatrix)
|
|
452
|
-
return undefined;
|
|
453
|
-
const angMatrix = core_geometry_1.YawPitchRollAngles.createRadians(Math.PI, 0, 0).toMatrix3d(); // 180 degree rotation...
|
|
454
|
-
if (undefined === angMatrix)
|
|
455
|
-
return undefined;
|
|
456
|
-
angMatrix.multiplyMatrixMatrix(invMatrix, invMatrix);
|
|
457
|
-
rotMatrix.multiplyMatrixMatrix(invMatrix, rotMatrix);
|
|
458
|
-
return core_geometry_1.Transform.createFixedPointAndMatrix(this.anchorPoint, rotMatrix);
|
|
459
|
-
}
|
|
460
|
-
const zVec = vec1.unitCrossProduct(vec2);
|
|
461
|
-
if (undefined === zVec)
|
|
462
|
-
return undefined;
|
|
463
|
-
const yVec = zVec.unitCrossProduct(vec1);
|
|
464
|
-
if (undefined === yVec)
|
|
465
|
-
return undefined;
|
|
466
|
-
const matrix1 = core_geometry_1.Matrix3d.createRows(vec1, yVec, zVec);
|
|
467
|
-
zVec.unitCrossProduct(vec2, yVec);
|
|
468
|
-
const matrix2 = core_geometry_1.Matrix3d.createColumns(vec2, yVec, zVec);
|
|
469
|
-
const matrix = matrix2.multiplyMatrixMatrix(matrix1);
|
|
470
|
-
if (undefined === matrix)
|
|
471
|
-
return undefined;
|
|
472
|
-
return core_geometry_1.Transform.createFixedPointAndMatrix(this.anchorPoint, matrix);
|
|
473
|
-
}
|
|
474
|
-
transformAgendaDynamics(transform, context) {
|
|
475
|
-
if (RotateAbout.Point === this.rotateAbout)
|
|
476
|
-
return super.transformAgendaDynamics(transform, context);
|
|
477
|
-
if (undefined === this._graphicsProvider)
|
|
478
|
-
return;
|
|
479
|
-
const rotatePoint = core_geometry_1.Point3d.create();
|
|
480
|
-
for (const data of this._graphicsProvider.data) {
|
|
481
|
-
if (RotateAbout.Origin === this.rotateAbout)
|
|
482
|
-
rotatePoint.setFrom(data.placement.origin);
|
|
483
|
-
else
|
|
484
|
-
rotatePoint.setFrom(data.placement.calculateRange().center);
|
|
485
|
-
const rotateTrans = core_geometry_1.Transform.createFixedPointAndMatrix(rotatePoint, transform.matrix);
|
|
486
|
-
this._graphicsProvider.addSingleGraphic(data.graphic, rotateTrans, context);
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
async transformAgenda(transform) {
|
|
490
|
-
if (RotateAbout.Point === this.rotateAbout)
|
|
491
|
-
return super.transformAgenda(transform);
|
|
492
|
-
try {
|
|
493
|
-
this._startedCmd = await this.startCommand();
|
|
494
|
-
if (core_common_1.IModelStatus.Success === await EditToolIpc_1.basicManipulationIpc.rotatePlacement(this.agenda.compressIds(), transform.matrix.toJSON(), RotateAbout.Center === this.rotateAbout))
|
|
495
|
-
await this.saveChanges();
|
|
496
|
-
}
|
|
497
|
-
catch (err) {
|
|
498
|
-
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, core_bentley_1.BentleyError.getErrorMessage(err) || "An unknown error occurred."));
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
onDynamicFrame(ev, context) {
|
|
502
|
-
const transform = this.calculateTransform(ev);
|
|
503
|
-
if (undefined !== transform)
|
|
504
|
-
return this.transformAgendaDynamics(transform, context);
|
|
505
|
-
if (undefined === this.anchorPoint)
|
|
506
|
-
return;
|
|
507
|
-
const builder = context.createGraphic({ type: core_frontend_1.GraphicType.WorldOverlay });
|
|
508
|
-
builder.setSymbology(context.viewport.getContrastToBackgroundColor(), core_common_1.ColorDef.black, 1, core_common_1.LinePixels.Code2);
|
|
509
|
-
builder.addLineString([this.anchorPoint.clone(), ev.point.clone()]);
|
|
510
|
-
context.addGraphic(builder.finish());
|
|
511
|
-
}
|
|
512
|
-
get wantAdditionalInput() {
|
|
513
|
-
if (RotateMethod.ByAngle === this.rotateMethod)
|
|
514
|
-
return super.wantAdditionalInput;
|
|
515
|
-
return !this.haveFinalPoint;
|
|
516
|
-
}
|
|
517
|
-
wantProcessAgenda(ev) {
|
|
518
|
-
if (RotateMethod.ByAngle === this.rotateMethod)
|
|
519
|
-
return super.wantProcessAgenda(ev);
|
|
520
|
-
if (!this.havePivotPoint)
|
|
521
|
-
this.havePivotPoint = true; // Uses anchorPoint...
|
|
522
|
-
else if (undefined === this.xAxisPoint)
|
|
523
|
-
this.xAxisPoint = ev.point.clone();
|
|
524
|
-
else if (!this.haveFinalPoint)
|
|
525
|
-
this.haveFinalPoint = true; // Uses button event...
|
|
526
|
-
return super.wantProcessAgenda(ev);
|
|
527
|
-
}
|
|
528
|
-
setupAndPromptForNextAction() {
|
|
529
|
-
super.setupAndPromptForNextAction();
|
|
530
|
-
if (RotateMethod.ByAngle === this.rotateMethod)
|
|
531
|
-
return;
|
|
532
|
-
if (undefined === this.anchorPoint || undefined === this.xAxisPoint)
|
|
533
|
-
return;
|
|
534
|
-
const hints = new core_frontend_1.AccuDrawHintBuilder();
|
|
535
|
-
hints.setXAxis(core_geometry_1.Vector3d.createStartEnd(this.anchorPoint, this.xAxisPoint));
|
|
536
|
-
hints.setOrigin(this.anchorPoint);
|
|
537
|
-
hints.setModePolar();
|
|
538
|
-
hints.sendHints();
|
|
539
|
-
}
|
|
540
|
-
provideToolAssistance(_mainInstrText, _additionalInstr) {
|
|
541
|
-
let mainMsg;
|
|
542
|
-
if (RotateMethod.ByAngle === this.rotateMethod) {
|
|
543
|
-
if (!this.isSelectByPoints && !this.wantAdditionalElements && this.wantAdditionalInput)
|
|
544
|
-
mainMsg = EditTool_1.EditTools.translate("RotateElements.Prompts.IdentifyPoint");
|
|
545
|
-
}
|
|
546
|
-
else {
|
|
547
|
-
if (!this.isSelectByPoints && !this.wantAdditionalElements) {
|
|
548
|
-
if (!this.havePivotPoint)
|
|
549
|
-
mainMsg = EditTool_1.EditTools.translate("RotateElements.Prompts.IdentifyPoint");
|
|
550
|
-
else if (undefined === this.xAxisPoint)
|
|
551
|
-
mainMsg = EditTool_1.EditTools.translate("RotateElements.Prompts.DefineStart");
|
|
552
|
-
else
|
|
553
|
-
mainMsg = EditTool_1.EditTools.translate("RotateElements.Prompts.DefineAmount");
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
super.provideToolAssistance(mainMsg);
|
|
557
|
-
}
|
|
558
|
-
async applyToolSettingPropertyChange(updatedValue) {
|
|
559
|
-
if (!this.changeToolSettingPropertyValue(updatedValue))
|
|
560
|
-
return false;
|
|
561
|
-
if (this.methodProperty.name === updatedValue.propertyName)
|
|
562
|
-
await this.onRestartTool(); // calling restart, not reinitialize to not exit tool for selection set...
|
|
563
|
-
return true;
|
|
564
|
-
}
|
|
565
|
-
supplyToolSettingsProperties() {
|
|
566
|
-
const toolSettings = new Array();
|
|
567
|
-
toolSettings.push(this.methodProperty.toDialogItem({ rowPriority: 1, columnIndex: 2 }));
|
|
568
|
-
toolSettings.push(this.aboutProperty.toDialogItem({ rowPriority: 2, columnIndex: 2 }));
|
|
569
|
-
if (RotateMethod.ByAngle === this.rotateMethod)
|
|
570
|
-
toolSettings.push(this.angleProperty.toDialogItem({ rowPriority: 3, columnIndex: 2 }));
|
|
571
|
-
return toolSettings;
|
|
572
|
-
}
|
|
573
|
-
async onRestartTool() {
|
|
574
|
-
const tool = new RotateElementsTool();
|
|
575
|
-
if (!await tool.run())
|
|
576
|
-
return this.exitTool();
|
|
577
|
-
}
|
|
578
|
-
async onInstall() {
|
|
579
|
-
if (!await super.onInstall())
|
|
580
|
-
return false;
|
|
581
|
-
// Setup initial values here instead of supplyToolSettingsProperties to support keyin args w/o appui-react...
|
|
582
|
-
this.initializeToolSettingPropertyValues([this.methodProperty, this.aboutProperty, this.angleProperty]);
|
|
583
|
-
return true;
|
|
584
|
-
}
|
|
585
|
-
/** The keyin takes the following arguments, all of which are optional:
|
|
586
|
-
* - `method=0|1` How rotate angle will be specified. 0 for by 3 points, 1 for by specified angle.
|
|
587
|
-
* - `about=0|1|2` Location to rotate about. 0 for point, 1 for placement origin, and 2 for center of range.
|
|
588
|
-
* - `angle=number` Rotation angle in degrees when not defining angle by points.
|
|
589
|
-
*/
|
|
590
|
-
async parseAndRun(...inputArgs) {
|
|
591
|
-
let rotateMethod;
|
|
592
|
-
let rotateAbout;
|
|
593
|
-
let rotateAngle;
|
|
594
|
-
for (const arg of inputArgs) {
|
|
595
|
-
const parts = arg.split("=");
|
|
596
|
-
if (2 !== parts.length)
|
|
597
|
-
continue;
|
|
598
|
-
if (parts[0].toLowerCase().startsWith("me")) {
|
|
599
|
-
const method = Number.parseInt(parts[1], 10);
|
|
600
|
-
if (!Number.isNaN(method)) {
|
|
601
|
-
switch (method) {
|
|
602
|
-
case 0:
|
|
603
|
-
rotateMethod = RotateMethod.By3Points;
|
|
604
|
-
break;
|
|
605
|
-
case 1:
|
|
606
|
-
rotateMethod = RotateMethod.ByAngle;
|
|
607
|
-
break;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
else if (parts[0].toLowerCase().startsWith("ab")) {
|
|
612
|
-
const about = Number.parseInt(parts[1], 10);
|
|
613
|
-
if (!Number.isNaN(about)) {
|
|
614
|
-
switch (about) {
|
|
615
|
-
case 0:
|
|
616
|
-
rotateAbout = RotateAbout.Point;
|
|
617
|
-
break;
|
|
618
|
-
case 1:
|
|
619
|
-
rotateAbout = RotateAbout.Origin;
|
|
620
|
-
break;
|
|
621
|
-
case 2:
|
|
622
|
-
rotateAbout = RotateAbout.Center;
|
|
623
|
-
break;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
else if (parts[0].toLowerCase().startsWith("an")) {
|
|
628
|
-
const angle = Number.parseFloat(parts[1]);
|
|
629
|
-
if (!Number.isNaN(angle)) {
|
|
630
|
-
rotateAngle = core_geometry_1.Angle.createDegrees(angle).radians;
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
// Update current session values so keyin args are picked up for tool settings/restart...
|
|
635
|
-
if (undefined !== rotateMethod)
|
|
636
|
-
this.saveToolSettingPropertyValue(this.methodProperty, { value: rotateMethod });
|
|
637
|
-
if (undefined !== rotateAbout)
|
|
638
|
-
this.saveToolSettingPropertyValue(this.aboutProperty, { value: rotateAbout });
|
|
639
|
-
if (undefined !== rotateAngle)
|
|
640
|
-
this.saveToolSettingPropertyValue(this.angleProperty, { value: rotateAngle });
|
|
641
|
-
return this.run();
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
RotateElementsTool.toolId = "RotateElements";
|
|
645
|
-
RotateElementsTool.iconSpec = "icon-rotate";
|
|
646
|
-
RotateElementsTool.getMethodChoices = () => {
|
|
647
|
-
return [
|
|
648
|
-
{ label: RotateElementsTool.methodMessage("3Points"), value: RotateMethod.By3Points },
|
|
649
|
-
{ label: RotateElementsTool.methodMessage("Angle"), value: RotateMethod.ByAngle },
|
|
650
|
-
];
|
|
651
|
-
};
|
|
652
|
-
RotateElementsTool.getAboutChoices = () => {
|
|
653
|
-
return [
|
|
654
|
-
{ label: RotateElementsTool.aboutMessage("Point"), value: RotateAbout.Point },
|
|
655
|
-
{ label: RotateElementsTool.aboutMessage("Origin"), value: RotateAbout.Origin },
|
|
656
|
-
{ label: RotateElementsTool.aboutMessage("Center"), value: RotateAbout.Center },
|
|
657
|
-
];
|
|
658
|
-
};
|
|
659
|
-
exports.RotateElementsTool = RotateElementsTool;
|
|
660
263
|
//# sourceMappingURL=TransformElementsTool.js.map
|