@mlightcad/cad-simple-viewer 1.0.0 → 1.0.2
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/README.md +296 -2
- package/dist/index.js +1348 -122
- package/dist/index.umd.cjs +2 -2
- package/lib/app/AcApContext.d.ts +45 -3
- package/lib/app/AcApContext.d.ts.map +1 -1
- package/lib/app/AcApContext.js +43 -3
- package/lib/app/AcApContext.js.map +1 -1
- package/lib/app/AcApDocCreator.d.ts +68 -2
- package/lib/app/AcApDocCreator.d.ts.map +1 -1
- package/lib/app/AcApDocCreator.js +67 -2
- package/lib/app/AcApDocCreator.js.map +1 -1
- package/lib/app/AcApDocManager.d.ts +227 -12
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +229 -17
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/app/AcApDocument.d.ts +77 -3
- package/lib/app/AcApDocument.d.ts.map +1 -1
- package/lib/app/AcApDocument.js +75 -3
- package/lib/app/AcApDocument.js.map +1 -1
- package/lib/app/AcApFontLoader.d.ts +32 -0
- package/lib/app/AcApFontLoader.d.ts.map +1 -1
- package/lib/app/AcApFontLoader.js +30 -0
- package/lib/app/AcApFontLoader.js.map +1 -1
- package/lib/app/AcApSettingManager.d.ts +191 -3
- package/lib/app/AcApSettingManager.d.ts.map +1 -1
- package/lib/app/AcApSettingManager.js +161 -0
- package/lib/app/AcApSettingManager.js.map +1 -1
- package/lib/command/AcApConvertToSvgCmd.d.ts +26 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -1
- package/lib/command/AcApConvertToSvgCmd.js +26 -0
- package/lib/command/AcApConvertToSvgCmd.js.map +1 -1
- package/lib/command/AcApOpenCmd.d.ts +31 -0
- package/lib/command/AcApOpenCmd.d.ts.map +1 -1
- package/lib/command/AcApOpenCmd.js +31 -0
- package/lib/command/AcApOpenCmd.js.map +1 -1
- package/lib/command/AcApPanCmd.d.ts +25 -0
- package/lib/command/AcApPanCmd.d.ts.map +1 -1
- package/lib/command/AcApPanCmd.js +25 -0
- package/lib/command/AcApPanCmd.js.map +1 -1
- package/lib/command/AcApQNewCmd.d.ts +26 -0
- package/lib/command/AcApQNewCmd.d.ts.map +1 -1
- package/lib/command/AcApQNewCmd.js +26 -0
- package/lib/command/AcApQNewCmd.js.map +1 -1
- package/lib/command/AcApSelectCmd.d.ts +26 -0
- package/lib/command/AcApSelectCmd.d.ts.map +1 -1
- package/lib/command/AcApSelectCmd.js +26 -0
- package/lib/command/AcApSelectCmd.js.map +1 -1
- package/lib/command/AcApSvgConvertor.d.ts +48 -0
- package/lib/command/AcApSvgConvertor.d.ts.map +1 -1
- package/lib/command/AcApSvgConvertor.js +48 -0
- package/lib/command/AcApSvgConvertor.js.map +1 -1
- package/lib/command/AcApZoomCmd.d.ts +29 -0
- package/lib/command/AcApZoomCmd.d.ts.map +1 -1
- package/lib/command/AcApZoomCmd.js +29 -0
- package/lib/command/AcApZoomCmd.js.map +1 -1
- package/lib/command/AcApZoomToBoxCmd.d.ts +57 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -1
- package/lib/command/AcApZoomToBoxCmd.js +57 -0
- package/lib/command/AcApZoomToBoxCmd.js.map +1 -1
- package/lib/editor/command/AcEdCommand.d.ts +118 -9
- package/lib/editor/command/AcEdCommand.d.ts.map +1 -1
- package/lib/editor/command/AcEdCommand.js +113 -9
- package/lib/editor/command/AcEdCommand.js.map +1 -1
- package/lib/editor/command/AcEdCommandStack.d.ts +59 -5
- package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -1
- package/lib/editor/command/AcEdCommandStack.js +48 -5
- package/lib/editor/command/AcEdCommandStack.js.map +1 -1
- package/lib/editor/global/eventBus.d.ts +76 -7
- package/lib/editor/global/eventBus.d.ts.map +1 -1
- package/lib/editor/global/eventBus.js +38 -0
- package/lib/editor/global/eventBus.js.map +1 -1
- package/lib/editor/input/AcEdBaseInput.d.ts +65 -1
- package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -1
- package/lib/editor/input/AcEdBaseInput.js +62 -1
- package/lib/editor/input/AcEdBaseInput.js.map +1 -1
- package/lib/editor/input/AcEdBoxSelector.d.ts +81 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -1
- package/lib/editor/input/AcEdBoxSelector.js +80 -0
- package/lib/editor/input/AcEdBoxSelector.js.map +1 -1
- package/lib/editor/input/AcEdCursorManager.d.ts +95 -8
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
- package/lib/editor/input/AcEdCursorManager.js +95 -11
- package/lib/editor/input/AcEdCursorManager.js.map +1 -1
- package/lib/editor/input/AcEdInputPoint.d.ts +38 -1
- package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -1
- package/lib/editor/input/AcEdInputPoint.js +38 -1
- package/lib/editor/input/AcEdInputPoint.js.map +1 -1
- package/lib/editor/input/AcEdJig.d.ts +166 -0
- package/lib/editor/input/AcEdJig.d.ts.map +1 -1
- package/lib/editor/input/AcEdJig.js +164 -0
- package/lib/editor/input/AcEdJig.js.map +1 -1
- package/lib/editor/input/AcEdJigLoop.d.ts +49 -0
- package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -1
- package/lib/editor/input/AcEdJigLoop.js +48 -0
- package/lib/editor/input/AcEdJigLoop.js.map +1 -1
- package/lib/editor/input/AcEdSelectionSet.d.ts +122 -2
- package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -1
- package/lib/editor/input/AcEdSelectionSet.js +117 -1
- package/lib/editor/input/AcEdSelectionSet.js.map +1 -1
- package/lib/editor/input/AcEditor.d.ts +90 -6
- package/lib/editor/input/AcEditor.d.ts.map +1 -1
- package/lib/editor/input/AcEditor.js +86 -6
- package/lib/editor/input/AcEditor.js.map +1 -1
- package/lib/editor/view/AcEdBaseView.d.ts +163 -16
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
- package/lib/editor/view/AcEdBaseView.js +94 -5
- package/lib/editor/view/AcEdBaseView.js.map +1 -1
- package/lib/util/AcTrGeometryUtil.d.ts +65 -0
- package/lib/util/AcTrGeometryUtil.d.ts.map +1 -1
- package/lib/util/AcTrGeometryUtil.js +65 -0
- package/lib/util/AcTrGeometryUtil.js.map +1 -1
- package/lib/view/AcTrLayer.d.ts +40 -5
- package/lib/view/AcTrLayer.d.ts.map +1 -1
- package/lib/view/AcTrLayer.js +34 -5
- package/lib/view/AcTrLayer.js.map +1 -1
- package/lib/view/AcTrLayout.d.ts +122 -23
- package/lib/view/AcTrLayout.d.ts.map +1 -1
- package/lib/view/AcTrLayout.js +103 -23
- package/lib/view/AcTrLayout.js.map +1 -1
- package/lib/view/AcTrLayoutView.d.ts +74 -16
- package/lib/view/AcTrLayoutView.d.ts.map +1 -1
- package/lib/view/AcTrLayoutView.js +65 -16
- package/lib/view/AcTrLayoutView.js.map +1 -1
- package/lib/view/AcTrLayoutViewManager.d.ts +58 -12
- package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -1
- package/lib/view/AcTrLayoutViewManager.js +56 -12
- package/lib/view/AcTrLayoutViewManager.js.map +1 -1
- package/lib/view/AcTrScene.d.ts +48 -4
- package/lib/view/AcTrScene.d.ts.map +1 -1
- package/lib/view/AcTrScene.js +44 -4
- package/lib/view/AcTrScene.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +71 -0
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +65 -0
- package/lib/view/AcTrView2d.js.map +1 -1
- package/package.json +8 -4
|
@@ -12,8 +12,23 @@ var __values = (this && this.__values) || function(o) {
|
|
|
12
12
|
import { AcEdCommandIterator } from './AcEdCommandIterator';
|
|
13
13
|
/**
|
|
14
14
|
* The class to create, define, and register command objects.
|
|
15
|
+
*
|
|
16
|
+
* This is a singleton class that manages all command registration and lookup functionality.
|
|
17
|
+
* Commands are organized into groups, with system commands (ACAD) and user commands (USER)
|
|
18
|
+
* being the default groups.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const commandStack = AcEdCommandStack.instance;
|
|
23
|
+
* commandStack.addCommand('USER', 'MYCOMMAND', 'MYCOMMAND', myCommandInstance);
|
|
24
|
+
* const command = commandStack.lookupGlobalCmd('MYCOMMAND');
|
|
25
|
+
* ```
|
|
15
26
|
*/
|
|
16
27
|
var AcEdCommandStack = /** @class */ (function () {
|
|
28
|
+
/**
|
|
29
|
+
* Private constructor to enforce singleton pattern.
|
|
30
|
+
* Initializes the command stack with system and default command groups.
|
|
31
|
+
*/
|
|
17
32
|
function AcEdCommandStack() {
|
|
18
33
|
this._commandsByGroup = [];
|
|
19
34
|
this._systemCommandGroup = {
|
|
@@ -30,6 +45,12 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
30
45
|
this._commandsByGroup.push(this._defaultCommandGroup);
|
|
31
46
|
}
|
|
32
47
|
Object.defineProperty(AcEdCommandStack, "instance", {
|
|
48
|
+
/**
|
|
49
|
+
* Gets the singleton instance of the command stack.
|
|
50
|
+
* Creates a new instance if one doesn't exist.
|
|
51
|
+
*
|
|
52
|
+
* @returns The singleton instance of AcEdCommandStack
|
|
53
|
+
*/
|
|
33
54
|
get: function () {
|
|
34
55
|
if (!AcEdCommandStack._instance) {
|
|
35
56
|
AcEdCommandStack._instance = new AcEdCommandStack();
|
|
@@ -39,6 +60,21 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
39
60
|
enumerable: false,
|
|
40
61
|
configurable: true
|
|
41
62
|
});
|
|
63
|
+
/**
|
|
64
|
+
* Adds a command to the specified command group.
|
|
65
|
+
*
|
|
66
|
+
* @param cmdGroupName - The name of the command group. If empty, uses the default group.
|
|
67
|
+
* @param cmdGlobalName - The global (untranslated) name of the command. Must be unique within the group.
|
|
68
|
+
* @param cmdLocalName - The local (translated) name of the command. Defaults to global name if empty.
|
|
69
|
+
* @param cmd - The command object to add to the stack.
|
|
70
|
+
*
|
|
71
|
+
* @throws {Error} When the global name is empty or when a command with the same name already exists
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* commandStack.addCommand('USER', 'LINE', 'ligne', new LineCommand());
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
42
78
|
AcEdCommandStack.prototype.addCommand = function (cmdGroupName, cmdGlobalName, cmdLocalName, cmd) {
|
|
43
79
|
if (!cmdGlobalName) {
|
|
44
80
|
throw new Error('[AcEdCommandStack] The global name of the command is required!');
|
|
@@ -74,6 +110,7 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
74
110
|
/**
|
|
75
111
|
* Return an iterator that can be used to traverse all of command objects in this command stack
|
|
76
112
|
* (that is, the iterator iterates through all commands in all groups).
|
|
113
|
+
*
|
|
77
114
|
* @returns Return an iterator that can be used to traverse all of command objects in this command
|
|
78
115
|
* stack.
|
|
79
116
|
*/
|
|
@@ -86,7 +123,8 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
86
123
|
* matched AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command
|
|
87
124
|
* could not be found. If more than one command of the same name is present in the command stack (that
|
|
88
125
|
* is, in separate command groups), then the first one found is used.
|
|
89
|
-
*
|
|
126
|
+
*
|
|
127
|
+
* @param cmdName - Input the command name to search for
|
|
90
128
|
* @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
|
|
91
129
|
*/
|
|
92
130
|
AcEdCommandStack.prototype.lookupGlobalCmd = function (cmdName) {
|
|
@@ -115,7 +153,8 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
115
153
|
* AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command could not
|
|
116
154
|
* be found. If more than one command of the same name is present in the command stack (that is, in
|
|
117
155
|
* separate command groups), then the first one found is used.
|
|
118
|
-
*
|
|
156
|
+
*
|
|
157
|
+
* @param cmdName - Input the command name to search for
|
|
119
158
|
* @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
|
|
120
159
|
*/
|
|
121
160
|
AcEdCommandStack.prototype.lookupLocalCmd = function (cmdName) {
|
|
@@ -142,8 +181,9 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
142
181
|
* Remove the command with the global and untranslated name `cmdGlobalName` from the `cmdGroupName`
|
|
143
182
|
* command group. Return true if successful. Return false if no command with the global and untranslated
|
|
144
183
|
* name `cmdGlobalName` is found in the `cmdGroupName` command group.
|
|
145
|
-
*
|
|
146
|
-
* @param
|
|
184
|
+
*
|
|
185
|
+
* @param cmdGroupName - Input the name of the command group containing the command to be removed
|
|
186
|
+
* @param cmdGlobalName - Input the command name which is to be removed from cmdGroupName
|
|
147
187
|
* @returns Return true if successful. Return false if no command with the global and untranslated
|
|
148
188
|
* name `cmdGlobalName` is found in the `cmdGroupName` command group.
|
|
149
189
|
*/
|
|
@@ -169,7 +209,8 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
169
209
|
/**
|
|
170
210
|
* Remove the command group with the name `GroupName` from the command stack and delete the command group
|
|
171
211
|
* dictionary object and all the AcEdCommand objects stored within it.
|
|
172
|
-
*
|
|
212
|
+
*
|
|
213
|
+
* @param groupName - Input the name of the command group to be removed from the command stack.
|
|
173
214
|
* @returns Return true if successful. Return false if no command group is found with the name `GroupName`.
|
|
174
215
|
*/
|
|
175
216
|
AcEdCommandStack.prototype.removeGroup = function (groupName) {
|
|
@@ -184,7 +225,9 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
184
225
|
}
|
|
185
226
|
return false;
|
|
186
227
|
};
|
|
228
|
+
/** The name of the system command group */
|
|
187
229
|
AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME = 'ACAD';
|
|
230
|
+
/** The name of the default user command group */
|
|
188
231
|
AcEdCommandStack.DEFAUT_COMMAND_GROUP_NAME = 'USER';
|
|
189
232
|
return AcEdCommandStack;
|
|
190
233
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdCommandStack.js","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommandStack.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"AcEdCommandStack.js","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommandStack.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAe3D;;;;;;;;;;;;;GAaG;AACH;IAeE;;;OAGG;IACH;QACE,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAA;QAC1B,IAAI,CAAC,mBAAmB,GAAG;YACzB,SAAS,EAAE,gBAAgB,CAAC,0BAA0B;YACtD,oBAAoB,EAAE,IAAI,GAAG,EAAE;YAC/B,mBAAmB,EAAE,IAAI,GAAG,EAAE;SAC/B,CAAA;QACD,IAAI,CAAC,oBAAoB,GAAG;YAC1B,SAAS,EAAE,gBAAgB,CAAC,yBAAyB;YACrD,oBAAoB,EAAE,IAAI,GAAG,EAAE;YAC/B,mBAAmB,EAAE,IAAI,GAAG,EAAE;SAC/B,CAAA;QACD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;QACpD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;IACvD,CAAC;IAQD,sBAAW,4BAAQ;QANnB;;;;;WAKG;aACH;YACE,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC;gBAChC,gBAAgB,CAAC,SAAS,GAAG,IAAI,gBAAgB,EAAE,CAAA;YACrD,CAAC;YACD,OAAO,gBAAgB,CAAC,SAAS,CAAA;QACnC,CAAC;;;OAAA;IAED;;;;;;;;;;;;;;OAcG;IACH,qCAAU,GAAV,UACE,YAAoB,EACpB,aAAqB,EACrB,YAAoB,EACpB,GAAgB;QAEhB,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAA;QACH,CAAC;QACD,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,YAAY,GAAG,aAAa,CAAA;QAC9B,CAAC;QAED,IAAI,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAAA;QAC5C,IAAI,YAAY,EAAE,CAAC;YACjB,IAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CACpC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,SAAS,IAAI,YAAY,EAA/B,CAA+B,CACzC,CAAA;YACD,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,YAAY,GAAG;oBACb,SAAS,EAAE,YAAY;oBACvB,oBAAoB,EAAE,IAAI,GAAG,EAAE;oBAC/B,mBAAmB,EAAE,IAAI,GAAG,EAAE;iBAC/B,CAAA;YACH,CAAC;iBAAM,CAAC;gBACN,YAAY,GAAG,GAAG,CAAA;YACpB,CAAC;QACH,CAAC;QACD,IAAI,YAAY,CAAC,oBAAoB,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;YACzD,MAAM,IAAI,KAAK,CACb,2DAAoD,aAAa,sBAAmB,CACrF,CAAA;QACH,CAAC;QACD,IAAI,YAAY,CAAC,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CACb,0DAAmD,YAAY,sBAAmB,CACnF,CAAA;QACH,CAAC;QAED,YAAY,CAAC,oBAAoB,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,CAAA;QACzD,YAAY,CAAC,mBAAmB,CAAC,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,CAAA;QACvD,GAAG,CAAC,UAAU,GAAG,aAAa,CAAA;QAC9B,GAAG,CAAC,SAAS,GAAG,YAAY,CAAA;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,mCAAQ,GAAR;QACE,OAAO,IAAI,mBAAmB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;IACvD,CAAC;IAED;;;;;;;;;OASG;IACH,0CAAe,GAAf,UAAgB,OAAe;;QAC7B,IAAI,MAAM,GAA4B,SAAS,CAAA;;YAC/C,KAAoB,IAAA,KAAA,SAAA,IAAI,CAAC,gBAAgB,CAAA,gBAAA,4BAAE,CAAC;gBAAvC,IAAM,KAAK,WAAA;gBACd,MAAM,GAAG,KAAK,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;gBAChD,IAAI,MAAM;oBAAE,MAAK;YACnB,CAAC;;;;;;;;;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED;;;;;;;;;OASG;IACH,yCAAc,GAAd,UAAe,OAAe;;QAC5B,IAAI,MAAM,GAA4B,SAAS,CAAA;;YAC/C,KAAoB,IAAA,KAAA,SAAA,IAAI,CAAC,gBAAgB,CAAA,gBAAA,4BAAE,CAAC;gBAAvC,IAAM,KAAK,WAAA;gBACd,MAAM,GAAG,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;gBAC/C,IAAI,MAAM;oBAAE,MAAK;YACnB,CAAC;;;;;;;;;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED;;;;;;;;;OASG;IACH,oCAAS,GAAT,UAAU,YAAoB,EAAE,aAAqB;;;YACnD,KAAoB,IAAA,KAAA,SAAA,IAAI,CAAC,gBAAgB,CAAA,gBAAA,4BAAE,CAAC;gBAAvC,IAAM,KAAK,WAAA;gBACd,IAAI,KAAK,CAAC,SAAS,IAAI,YAAY,EAAE,CAAC;oBACpC,OAAO,KAAK,CAAC,oBAAoB,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;gBACzD,CAAC;YACH,CAAC;;;;;;;;;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;;;;;OAMG;IACH,sCAAW,GAAX,UAAY,SAAiB;QAC3B,IAAI,GAAG,GAAG,CAAC,CAAC,CAAA;QACZ,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAC,KAAK,EAAE,KAAK;YACtC,GAAG,GAAG,KAAK,CAAA;YACX,OAAO,KAAK,CAAC,SAAS,IAAI,SAAS,CAAA;QACrC,CAAC,CAAC,CAAA;QACF,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;YACb,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;YACpC,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAnMD,2CAA2C;IACpC,2CAA0B,GAAG,MAAM,CAAA;IAC1C,iDAAiD;IAC1C,0CAAyB,GAAG,MAAM,CAAA;IAiM3C,uBAAC;CAAA,AArMD,IAqMC;SArMY,gBAAgB"}
|
|
@@ -1,34 +1,103 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AcDbProgressdEventArgs } from '@mlightcad/data-model';
|
|
2
2
|
import { type Emitter } from 'mitt';
|
|
3
3
|
/**
|
|
4
|
-
* Message type
|
|
4
|
+
* Message severity type for user notifications.
|
|
5
|
+
*
|
|
6
|
+
* Used to categorize messages shown to users with appropriate visual styling.
|
|
5
7
|
*/
|
|
6
8
|
export type AcEdMessageType = 'success' | 'warning' | 'info' | 'error';
|
|
9
|
+
/**
|
|
10
|
+
* Progress event arguments for database operations.
|
|
11
|
+
*
|
|
12
|
+
* This type represents the progress information for database operations
|
|
13
|
+
* like opening files, excluding the database reference.
|
|
14
|
+
*/
|
|
15
|
+
export type AcEdOpenFileProgressEventArgs = Omit<AcDbProgressdEventArgs, 'database'>;
|
|
16
|
+
/**
|
|
17
|
+
* Type definition for all events that can be emitted through the global event bus.
|
|
18
|
+
*
|
|
19
|
+
* This type maps event names to their corresponding payload types, providing
|
|
20
|
+
* type safety for event emission and listening throughout the application.
|
|
21
|
+
*
|
|
22
|
+
* ## Event Categories
|
|
23
|
+
* - **File Operations**: `open-file`, `open-file-progress`, `failed-to-open-file`
|
|
24
|
+
* - **Font Management**: `font-not-loaded`, `failed-to-get-avaiable-fonts`, `font-not-found`
|
|
25
|
+
* - **User Messages**: `message`
|
|
26
|
+
*/
|
|
7
27
|
export type AcEdEvents = {
|
|
28
|
+
/** Emitted to request opening a file dialog */
|
|
8
29
|
'open-file': {};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
stageStatus: AcDbConversionStageStatus;
|
|
13
|
-
};
|
|
30
|
+
/** Emitted during file opening to report progress */
|
|
31
|
+
'open-file-progress': AcEdOpenFileProgressEventArgs;
|
|
32
|
+
/** Emitted to display a message to the user */
|
|
14
33
|
message: {
|
|
34
|
+
/** The message text to display */
|
|
15
35
|
message: string;
|
|
36
|
+
/** The severity/type of the message */
|
|
16
37
|
type: AcEdMessageType;
|
|
17
38
|
};
|
|
39
|
+
/** Emitted when a font fails to load */
|
|
18
40
|
'font-not-loaded': {
|
|
41
|
+
/** Name of the font that failed to load */
|
|
19
42
|
fontName: string;
|
|
43
|
+
/** URL where the font was attempted to be loaded from */
|
|
20
44
|
url: string;
|
|
21
45
|
};
|
|
46
|
+
/** Emitted when the available fonts list cannot be retrieved */
|
|
22
47
|
'failed-to-get-avaiable-fonts': {
|
|
48
|
+
/** URL where the fonts list was attempted to be retrieved from */
|
|
23
49
|
url: string;
|
|
24
50
|
};
|
|
51
|
+
/** Emitted when a file fails to open */
|
|
25
52
|
'failed-to-open-file': {
|
|
53
|
+
/** Name/path of the file that failed to open */
|
|
26
54
|
fileName: string;
|
|
27
55
|
};
|
|
56
|
+
/** Emitted when a required font is not found */
|
|
28
57
|
'font-not-found': {
|
|
58
|
+
/** Name of the missing font */
|
|
29
59
|
fontName: string;
|
|
60
|
+
/** Number of entities that require this font */
|
|
30
61
|
count: number;
|
|
31
62
|
};
|
|
32
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* Global event bus for application-wide communication.
|
|
66
|
+
*
|
|
67
|
+
* This event bus enables decoupled communication between different parts of the
|
|
68
|
+
* CAD viewer application. Components can emit events to notify about state changes
|
|
69
|
+
* or request actions, while other components can listen for these events to respond
|
|
70
|
+
* appropriately.
|
|
71
|
+
*
|
|
72
|
+
* The event bus is particularly useful for:
|
|
73
|
+
* - File operation status updates
|
|
74
|
+
* - Error and warning notifications
|
|
75
|
+
* - Font loading status
|
|
76
|
+
* - Cross-component communication
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* import { eventBus } from './eventBus';
|
|
81
|
+
*
|
|
82
|
+
* // Listen for file opening events
|
|
83
|
+
* eventBus.on('open-file', () => {
|
|
84
|
+
* console.log('File open requested');
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* // Emit a progress update
|
|
88
|
+
* eventBus.emit('open-file-progress', {
|
|
89
|
+
* percentage: 50,
|
|
90
|
+
* stage: 'CONVERSION'
|
|
91
|
+
* subStage: AcDbConversionStage.Parsing,
|
|
92
|
+
* stageStatus: AcDbConversionStageStatus.InProgress
|
|
93
|
+
* });
|
|
94
|
+
*
|
|
95
|
+
* // Display a message to the user
|
|
96
|
+
* eventBus.emit('message', {
|
|
97
|
+
* message: 'File opened successfully',
|
|
98
|
+
* type: 'success'
|
|
99
|
+
* });
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
33
102
|
export declare const eventBus: Emitter<AcEdEvents>;
|
|
34
103
|
//# sourceMappingURL=eventBus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventBus.d.ts","sourceRoot":"","sources":["../../../src/editor/global/eventBus.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"eventBus.d.ts","sourceRoot":"","sources":["../../../src/editor/global/eventBus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAa,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAA;AAEzC;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;AAEtE;;;;;GAKG;AACH,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAA;AAEpF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,+CAA+C;IAC/C,WAAW,EAAE,EAAE,CAAA;IACf,qDAAqD;IACrD,oBAAoB,EAAE,6BAA6B,CAAA;IACnD,+CAA+C;IAC/C,OAAO,EAAE;QACP,kCAAkC;QAClC,OAAO,EAAE,MAAM,CAAA;QACf,uCAAuC;QACvC,IAAI,EAAE,eAAe,CAAA;KACtB,CAAA;IACD,wCAAwC;IACxC,iBAAiB,EAAE;QACjB,2CAA2C;QAC3C,QAAQ,EAAE,MAAM,CAAA;QAChB,yDAAyD;QACzD,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD,gEAAgE;IAChE,8BAA8B,EAAE;QAC9B,kEAAkE;QAClE,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD,wCAAwC;IACxC,qBAAqB,EAAE;QACrB,gDAAgD;QAChD,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,gDAAgD;IAChD,gBAAgB,EAAE;QAChB,+BAA+B;QAC/B,QAAQ,EAAE,MAAM,CAAA;QAChB,gDAAgD;QAChD,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAsB,CAAA"}
|
|
@@ -1,3 +1,41 @@
|
|
|
1
1
|
import mitt from 'mitt';
|
|
2
|
+
/**
|
|
3
|
+
* Global event bus for application-wide communication.
|
|
4
|
+
*
|
|
5
|
+
* This event bus enables decoupled communication between different parts of the
|
|
6
|
+
* CAD viewer application. Components can emit events to notify about state changes
|
|
7
|
+
* or request actions, while other components can listen for these events to respond
|
|
8
|
+
* appropriately.
|
|
9
|
+
*
|
|
10
|
+
* The event bus is particularly useful for:
|
|
11
|
+
* - File operation status updates
|
|
12
|
+
* - Error and warning notifications
|
|
13
|
+
* - Font loading status
|
|
14
|
+
* - Cross-component communication
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { eventBus } from './eventBus';
|
|
19
|
+
*
|
|
20
|
+
* // Listen for file opening events
|
|
21
|
+
* eventBus.on('open-file', () => {
|
|
22
|
+
* console.log('File open requested');
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Emit a progress update
|
|
26
|
+
* eventBus.emit('open-file-progress', {
|
|
27
|
+
* percentage: 50,
|
|
28
|
+
* stage: 'CONVERSION'
|
|
29
|
+
* subStage: AcDbConversionStage.Parsing,
|
|
30
|
+
* stageStatus: AcDbConversionStageStatus.InProgress
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Display a message to the user
|
|
34
|
+
* eventBus.emit('message', {
|
|
35
|
+
* message: 'File opened successfully',
|
|
36
|
+
* type: 'success'
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
2
40
|
export var eventBus = mitt();
|
|
3
41
|
//# sourceMappingURL=eventBus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventBus.js","sourceRoot":"","sources":["../../../src/editor/global/eventBus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"eventBus.js","sourceRoot":"","sources":["../../../src/editor/global/eventBus.ts"],"names":[],"mappings":"AACA,OAAO,IAAsB,MAAM,MAAM,CAAA;AAkEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,IAAM,QAAQ,GAAwB,IAAI,EAAc,CAAA"}
|
|
@@ -2,23 +2,87 @@ import { AcEdBaseView } from '../view/AcEdBaseView';
|
|
|
2
2
|
/**
|
|
3
3
|
* The base class for all of classes to get user inputs such as string, angle, number, point, selection,
|
|
4
4
|
* and so on.
|
|
5
|
+
*
|
|
6
|
+
* This abstract class provides a common framework for handling user input operations in the CAD editor.
|
|
7
|
+
* It manages the input lifecycle including activation, deactivation, and promise-based resolution.
|
|
8
|
+
* Subclasses must implement specific input behaviors while this base class handles common functionality
|
|
9
|
+
* like keyboard event handling and promise management.
|
|
10
|
+
*
|
|
11
|
+
* @template TResult - The type of result that this input operation will return
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* class MyInput extends AcEdBaseInput<string> {
|
|
16
|
+
* // Implement specific input behavior
|
|
17
|
+
* }
|
|
18
|
+
* const input = new MyInput(view);
|
|
19
|
+
* const result = await input.start();
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
5
22
|
* @internal
|
|
6
23
|
*/
|
|
7
24
|
export declare abstract class AcEdBaseInput<TResult> {
|
|
25
|
+
/** The view associated with this input operation */
|
|
8
26
|
protected view: AcEdBaseView;
|
|
27
|
+
/** Whether this input is currently active */
|
|
9
28
|
protected active: boolean;
|
|
29
|
+
/** Flag to prevent multiple resolutions of the same promise */
|
|
10
30
|
protected isResolvedOrRejected: boolean;
|
|
31
|
+
/** Promise resolve function for completing the input operation */
|
|
11
32
|
private _resolve?;
|
|
33
|
+
/** Promise reject function for canceling the input operation */
|
|
12
34
|
private _reject?;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new base input instance.
|
|
37
|
+
*
|
|
38
|
+
* @param view - The view that will handle this input operation
|
|
39
|
+
*/
|
|
13
40
|
constructor(view: AcEdBaseView);
|
|
41
|
+
/**
|
|
42
|
+
* Gets whether this input is currently active.
|
|
43
|
+
*
|
|
44
|
+
* @returns True if the input is active, false otherwise
|
|
45
|
+
*/
|
|
14
46
|
get isActive(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Activates this input operation.
|
|
49
|
+
* Sets up event listeners and marks the input as active.
|
|
50
|
+
* Subclasses should call super.activate() when overriding.
|
|
51
|
+
*/
|
|
15
52
|
activate(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Deactivates this input operation.
|
|
55
|
+
* Removes event listeners and marks the input as inactive.
|
|
56
|
+
* Subclasses should call super.deactivate() when overriding.
|
|
57
|
+
*/
|
|
16
58
|
deactivate(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Resolves the input operation with the specified result.
|
|
61
|
+
* Automatically deactivates the input and prevents multiple resolutions.
|
|
62
|
+
*
|
|
63
|
+
* @param result - The result to resolve the promise with
|
|
64
|
+
*/
|
|
17
65
|
resolve(result: TResult): void;
|
|
66
|
+
/**
|
|
67
|
+
* Rejects the input operation with the specified reason.
|
|
68
|
+
* Automatically deactivates the input and prevents multiple rejections.
|
|
69
|
+
*
|
|
70
|
+
* @param reason - The reason for rejecting the input operation
|
|
71
|
+
*/
|
|
18
72
|
reject(reason: string): void;
|
|
73
|
+
/**
|
|
74
|
+
* Handles keyboard events for the input operation.
|
|
75
|
+
* By default, cancels the operation when Escape is pressed.
|
|
76
|
+
*
|
|
77
|
+
* @param e - The keyboard event
|
|
78
|
+
*/
|
|
19
79
|
private onKeyDown;
|
|
20
80
|
/**
|
|
21
|
-
*
|
|
81
|
+
* Starts the input operation and returns a promise that resolves with the result.
|
|
82
|
+
* This method activates the input and returns a promise that will be resolved
|
|
83
|
+
* when the user completes the input operation.
|
|
84
|
+
*
|
|
85
|
+
* @returns A promise that resolves with the input result
|
|
22
86
|
*/
|
|
23
87
|
start(): Promise<TResult>;
|
|
24
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdBaseInput.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdBaseInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD
|
|
1
|
+
{"version":3,"file":"AcEdBaseInput.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdBaseInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,8BAAsB,aAAa,CAAC,OAAO;IACzC,oDAAoD;IACpD,SAAS,CAAC,IAAI,EAAE,YAAY,CAAA;IAC5B,6CAA6C;IAC7C,SAAS,CAAC,MAAM,UAAQ;IACxB,+DAA+D;IAC/D,SAAS,CAAC,oBAAoB,UAAQ;IAEtC,kEAAkE;IAClE,OAAO,CAAC,QAAQ,CAAC,CAA0B;IAC3C,gEAAgE;IAChE,OAAO,CAAC,OAAO,CAAC,CAA0B;IAE1C;;;;OAIG;gBACS,IAAI,EAAE,YAAY;IAI9B;;;;OAIG;IACH,IAAI,QAAQ,YAEX;IAED;;;;OAIG;IACH,QAAQ;IAQR;;;;OAIG;IACH,UAAU;IAKV;;;;;OAKG;IACH,OAAO,CAAC,MAAM,EAAE,OAAO;IAQvB;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM;IAQrB;;;;;OAKG;IACH,OAAO,CAAC,SAAS,CAIhB;IAED;;;;;;OAMG;IACG,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC;CAQhC"}
|
|
@@ -37,13 +37,43 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
/**
|
|
38
38
|
* The base class for all of classes to get user inputs such as string, angle, number, point, selection,
|
|
39
39
|
* and so on.
|
|
40
|
+
*
|
|
41
|
+
* This abstract class provides a common framework for handling user input operations in the CAD editor.
|
|
42
|
+
* It manages the input lifecycle including activation, deactivation, and promise-based resolution.
|
|
43
|
+
* Subclasses must implement specific input behaviors while this base class handles common functionality
|
|
44
|
+
* like keyboard event handling and promise management.
|
|
45
|
+
*
|
|
46
|
+
* @template TResult - The type of result that this input operation will return
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* class MyInput extends AcEdBaseInput<string> {
|
|
51
|
+
* // Implement specific input behavior
|
|
52
|
+
* }
|
|
53
|
+
* const input = new MyInput(view);
|
|
54
|
+
* const result = await input.start();
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
40
57
|
* @internal
|
|
41
58
|
*/
|
|
42
59
|
var AcEdBaseInput = /** @class */ (function () {
|
|
60
|
+
/**
|
|
61
|
+
* Creates a new base input instance.
|
|
62
|
+
*
|
|
63
|
+
* @param view - The view that will handle this input operation
|
|
64
|
+
*/
|
|
43
65
|
function AcEdBaseInput(view) {
|
|
44
66
|
var _this = this;
|
|
67
|
+
/** Whether this input is currently active */
|
|
45
68
|
this.active = false;
|
|
69
|
+
/** Flag to prevent multiple resolutions of the same promise */
|
|
46
70
|
this.isResolvedOrRejected = false;
|
|
71
|
+
/**
|
|
72
|
+
* Handles keyboard events for the input operation.
|
|
73
|
+
* By default, cancels the operation when Escape is pressed.
|
|
74
|
+
*
|
|
75
|
+
* @param e - The keyboard event
|
|
76
|
+
*/
|
|
47
77
|
this.onKeyDown = function (e) {
|
|
48
78
|
if (e.code === 'Escape') {
|
|
49
79
|
_this.reject('Canceled by user!');
|
|
@@ -52,12 +82,22 @@ var AcEdBaseInput = /** @class */ (function () {
|
|
|
52
82
|
this.view = view;
|
|
53
83
|
}
|
|
54
84
|
Object.defineProperty(AcEdBaseInput.prototype, "isActive", {
|
|
85
|
+
/**
|
|
86
|
+
* Gets whether this input is currently active.
|
|
87
|
+
*
|
|
88
|
+
* @returns True if the input is active, false otherwise
|
|
89
|
+
*/
|
|
55
90
|
get: function () {
|
|
56
91
|
return this.active;
|
|
57
92
|
},
|
|
58
93
|
enumerable: false,
|
|
59
94
|
configurable: true
|
|
60
95
|
});
|
|
96
|
+
/**
|
|
97
|
+
* Activates this input operation.
|
|
98
|
+
* Sets up event listeners and marks the input as active.
|
|
99
|
+
* Subclasses should call super.activate() when overriding.
|
|
100
|
+
*/
|
|
61
101
|
AcEdBaseInput.prototype.activate = function () {
|
|
62
102
|
if (this.isActive) {
|
|
63
103
|
console.warn('Something wrong here!');
|
|
@@ -65,10 +105,21 @@ var AcEdBaseInput = /** @class */ (function () {
|
|
|
65
105
|
this.active = true;
|
|
66
106
|
this.view.canvas.addEventListener('keydown', this.onKeyDown);
|
|
67
107
|
};
|
|
108
|
+
/**
|
|
109
|
+
* Deactivates this input operation.
|
|
110
|
+
* Removes event listeners and marks the input as inactive.
|
|
111
|
+
* Subclasses should call super.deactivate() when overriding.
|
|
112
|
+
*/
|
|
68
113
|
AcEdBaseInput.prototype.deactivate = function () {
|
|
69
114
|
this.active = false;
|
|
70
115
|
this.view.canvas.removeEventListener('keydown', this.onKeyDown);
|
|
71
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* Resolves the input operation with the specified result.
|
|
119
|
+
* Automatically deactivates the input and prevents multiple resolutions.
|
|
120
|
+
*
|
|
121
|
+
* @param result - The result to resolve the promise with
|
|
122
|
+
*/
|
|
72
123
|
AcEdBaseInput.prototype.resolve = function (result) {
|
|
73
124
|
this.deactivate();
|
|
74
125
|
if (this._resolve && !this.isResolvedOrRejected) {
|
|
@@ -76,6 +127,12 @@ var AcEdBaseInput = /** @class */ (function () {
|
|
|
76
127
|
this.isResolvedOrRejected = true;
|
|
77
128
|
}
|
|
78
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* Rejects the input operation with the specified reason.
|
|
132
|
+
* Automatically deactivates the input and prevents multiple rejections.
|
|
133
|
+
*
|
|
134
|
+
* @param reason - The reason for rejecting the input operation
|
|
135
|
+
*/
|
|
79
136
|
AcEdBaseInput.prototype.reject = function (reason) {
|
|
80
137
|
this.deactivate();
|
|
81
138
|
if (this._reject && !this.isResolvedOrRejected) {
|
|
@@ -84,7 +141,11 @@ var AcEdBaseInput = /** @class */ (function () {
|
|
|
84
141
|
}
|
|
85
142
|
};
|
|
86
143
|
/**
|
|
87
|
-
*
|
|
144
|
+
* Starts the input operation and returns a promise that resolves with the result.
|
|
145
|
+
* This method activates the input and returns a promise that will be resolved
|
|
146
|
+
* when the user completes the input operation.
|
|
147
|
+
*
|
|
148
|
+
* @returns A promise that resolves with the input result
|
|
88
149
|
*/
|
|
89
150
|
AcEdBaseInput.prototype.start = function () {
|
|
90
151
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdBaseInput.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdBaseInput.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA
|
|
1
|
+
{"version":3,"file":"AcEdBaseInput.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdBaseInput.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAaE;;;;OAIG;IACH,uBAAY,IAAkB;QAA9B,iBAEC;QAjBD,6CAA6C;QACnC,WAAM,GAAG,KAAK,CAAA;QACxB,+DAA+D;QACrD,yBAAoB,GAAG,KAAK,CAAA;QA4EtC;;;;;WAKG;QACK,cAAS,GAAG,UAAC,CAAgB;YACnC,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACxB,KAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAA;YAClC,CAAC;QACH,CAAC,CAAA;QAzEC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAOD,sBAAI,mCAAQ;QALZ;;;;WAIG;aACH;YACE,OAAO,IAAI,CAAC,MAAM,CAAA;QACpB,CAAC;;;OAAA;IAED;;;;OAIG;IACH,gCAAQ,GAAR;QACE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA;QACvC,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IAC9D,CAAC;IAED;;;;OAIG;IACH,kCAAU,GAAV;QACE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;QACnB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IACjE,CAAC;IAED;;;;;OAKG;IACH,+BAAO,GAAP,UAAQ,MAAe;QACrB,IAAI,CAAC,UAAU,EAAE,CAAA;QACjB,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAChD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;YACrB,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAA;QAClC,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,8BAAM,GAAN,UAAO,MAAc;QACnB,IAAI,CAAC,UAAU,EAAE,CAAA;QACjB,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC/C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACpB,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAA;QAClC,CAAC;IACH,CAAC;IAcD;;;;;;OAMG;IACG,6BAAK,GAAX;;;;gBACE,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAA;gBACjC,sBAAO,IAAI,OAAO,CAAU,UAAC,OAAO,EAAE,MAAM;wBAC1C,KAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;wBACvB,KAAI,CAAC,OAAO,GAAG,MAAM,CAAA;wBACrB,KAAI,CAAC,QAAQ,EAAE,CAAA;oBACjB,CAAC,CAAC,EAAA;;;KACH;IACH,oBAAC;AAAD,CAAC,AA7GD,IA6GC"}
|
|
@@ -3,25 +3,106 @@ import { AcEdBaseView } from '../view';
|
|
|
3
3
|
import { AcEdBaseInput } from './AcEdBaseInput';
|
|
4
4
|
/**
|
|
5
5
|
* Selector used to select entities by a box.
|
|
6
|
+
*
|
|
7
|
+
* This class provides interactive box selection functionality for the CAD editor.
|
|
8
|
+
* Users can click and drag to create a selection rectangle, which is then converted
|
|
9
|
+
* to world coordinates for entity selection operations.
|
|
10
|
+
*
|
|
11
|
+
* The selector handles mouse events to track the selection area and provides visual
|
|
12
|
+
* feedback through a DOM overlay showing the selection bounds.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const boxSelector = new AcEdBoxSelector(view);
|
|
17
|
+
* const selectionBox = await boxSelector.start();
|
|
18
|
+
* // Use selectionBox to select entities
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
6
21
|
* @internal
|
|
7
22
|
*/
|
|
8
23
|
export declare class AcEdBoxSelector extends AcEdBaseInput<AcGeBox2d> {
|
|
24
|
+
/** Whether the mouse button is currently pressed */
|
|
9
25
|
private mouseDown;
|
|
26
|
+
/** Whether the mouse has moved since being pressed */
|
|
10
27
|
private mouseMove;
|
|
28
|
+
/** X coordinate where mouse was initially pressed (-1 indicates invalid) */
|
|
11
29
|
private mouseDownPositionX;
|
|
30
|
+
/** Y coordinate where mouse was initially pressed (-1 indicates invalid) */
|
|
12
31
|
private mouseDownPositionY;
|
|
32
|
+
/** DOM element used to draw the selection box */
|
|
13
33
|
private boxDom?;
|
|
34
|
+
/** Selection box border color */
|
|
14
35
|
color: number;
|
|
36
|
+
/** The container element for the selection box */
|
|
15
37
|
private container;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new box selector instance.
|
|
40
|
+
*
|
|
41
|
+
* @param view - The view that will handle this box selection operation
|
|
42
|
+
*/
|
|
16
43
|
constructor(view: AcEdBaseView);
|
|
44
|
+
/**
|
|
45
|
+
* Activates the box selector.
|
|
46
|
+
* Sets up mouse event listeners for tracking selection area.
|
|
47
|
+
* Overrides the base class to add mouse event handling.
|
|
48
|
+
*/
|
|
17
49
|
activate(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Deactivates the box selector.
|
|
52
|
+
* Removes mouse event listeners and hides the selection box.
|
|
53
|
+
* Overrides the base class to clean up mouse event handling.
|
|
54
|
+
*/
|
|
18
55
|
deactivate(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Rejects the box selection operation.
|
|
58
|
+
* Cleans up the selection box DOM element.
|
|
59
|
+
*
|
|
60
|
+
* @param reason - The reason for rejecting the selection operation
|
|
61
|
+
*/
|
|
19
62
|
reject(reason: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Handles mouse down events to start box selection.
|
|
65
|
+
* Records the initial mouse position for the selection area.
|
|
66
|
+
*
|
|
67
|
+
* @param e - The mouse event
|
|
68
|
+
*/
|
|
20
69
|
private mousedown;
|
|
70
|
+
/**
|
|
71
|
+
* Handles mouse move events to update the selection box.
|
|
72
|
+
* Creates and updates the visual selection rectangle as the user drags.
|
|
73
|
+
*
|
|
74
|
+
* @param e - The mouse event
|
|
75
|
+
*/
|
|
21
76
|
private mousemove;
|
|
77
|
+
/**
|
|
78
|
+
* Handles mouse up events to complete box selection.
|
|
79
|
+
* Calculates the final selection area and resolves the promise with the result.
|
|
80
|
+
*
|
|
81
|
+
* @param e - The mouse event
|
|
82
|
+
*/
|
|
22
83
|
private mouseup;
|
|
84
|
+
/**
|
|
85
|
+
* Draws the selection rectangle on screen.
|
|
86
|
+
* Creates or updates the DOM element representing the selection box.
|
|
87
|
+
*
|
|
88
|
+
* @param leftTop - The top-left corner of the selection rectangle
|
|
89
|
+
* @param rightBottom - The bottom-right corner of the selection rectangle
|
|
90
|
+
*/
|
|
23
91
|
private drawRect;
|
|
92
|
+
/**
|
|
93
|
+
* Sets the visibility of the selection rectangle DOM element.
|
|
94
|
+
*
|
|
95
|
+
* @param visible - Whether the selection rectangle should be visible
|
|
96
|
+
*/
|
|
24
97
|
private setRectDomVisible;
|
|
98
|
+
/**
|
|
99
|
+
* Converts a screen coordinate box to world coordinate system.
|
|
100
|
+
* Transforms the selection box from screen coordinates to world coordinates
|
|
101
|
+
* for use in entity selection operations.
|
|
102
|
+
*
|
|
103
|
+
* @param box - The selection box in screen coordinates
|
|
104
|
+
* @returns The selection box in world coordinates
|
|
105
|
+
*/
|
|
25
106
|
private toWcs;
|
|
26
107
|
}
|
|
27
108
|
//# sourceMappingURL=AcEdBoxSelector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdBoxSelector.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdBoxSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAe,MAAM,uBAAuB,CAAA;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"AcEdBoxSelector.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdBoxSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAe,MAAM,uBAAuB,CAAA;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAO/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,eAAgB,SAAQ,aAAa,CAAC,SAAS,CAAC;IAC3D,oDAAoD;IACpD,OAAO,CAAC,SAAS,CAAQ;IACzB,sDAAsD;IACtD,OAAO,CAAC,SAAS,CAAQ;IACzB,4EAA4E;IAC5E,OAAO,CAAC,kBAAkB,CAAK;IAC/B,4EAA4E;IAC5E,OAAO,CAAC,kBAAkB,CAAK;IAE/B,iDAAiD;IACjD,OAAO,CAAC,MAAM,CAAC,CAAgB;IAC/B,iCAAiC;IAC1B,KAAK,EAAE,MAAM,CAAA;IACpB,kDAAkD;IAClD,OAAO,CAAC,SAAS,CAAa;IAE9B;;;;OAIG;gBACS,IAAI,EAAE,YAAY;IAM9B;;;;OAIG;IACH,QAAQ;IAQR;;;;OAIG;IACH,UAAU;IAQV;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM;IAMrB;;;;;OAKG;IACH,OAAO,CAAC,SAAS,CAOhB;IAED;;;;;OAKG;IACH,OAAO,CAAC,SAAS,CAuBhB;IAED;;;;;OAKG;IACH,OAAO,CAAC,OAAO,CAmBd;IAED;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ;IAiChB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK;CAQd"}
|