@mlightcad/cad-simple-viewer 1.2.2 → 1.2.4
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/dist/index.js +33647 -0
- package/dist/index.umd.cjs +295 -0
- package/dist/libredwg-parser-worker.js +15458 -0
- package/dist/mtext-renderer-worker.js +29930 -0
- package/lib/app/AcApContext.d.ts +57 -0
- package/lib/app/AcApContext.d.ts.map +1 -0
- package/lib/app/AcApContext.js +106 -0
- package/lib/app/AcApContext.js.map +1 -0
- package/lib/app/AcApDocManager.d.ts +291 -0
- package/lib/app/AcApDocManager.d.ts.map +1 -0
- package/lib/app/AcApDocManager.js +498 -0
- package/lib/app/AcApDocManager.js.map +1 -0
- package/lib/app/AcApDocument.d.ts +101 -0
- package/lib/app/AcApDocument.d.ts.map +1 -0
- package/lib/app/AcApDocument.js +237 -0
- package/lib/app/AcApDocument.js.map +1 -0
- package/lib/app/AcApFontLoader.d.ts +54 -0
- package/lib/app/AcApFontLoader.d.ts.map +1 -0
- package/lib/app/AcApFontLoader.js +151 -0
- package/lib/app/AcApFontLoader.js.map +1 -0
- package/lib/app/AcApGlobalFunc.d.ts +26 -0
- package/lib/app/AcApGlobalFunc.d.ts.map +1 -0
- package/lib/app/AcApGlobalFunc.js +66 -0
- package/lib/app/AcApGlobalFunc.js.map +1 -0
- package/lib/app/AcApSettingManager.d.ts +232 -0
- package/lib/app/AcApSettingManager.d.ts.map +1 -0
- package/lib/app/AcApSettingManager.js +283 -0
- package/lib/app/AcApSettingManager.js.map +1 -0
- package/lib/app/index.d.ts +6 -0
- package/lib/app/index.d.ts.map +1 -0
- package/lib/app/index.js +6 -0
- package/lib/app/index.js.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts +32 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.js +56 -0
- package/lib/command/AcApConvertToSvgCmd.js.map +1 -0
- package/lib/command/AcApOpenCmd.d.ts +37 -0
- package/lib/command/AcApOpenCmd.d.ts.map +1 -0
- package/lib/command/AcApOpenCmd.js +60 -0
- package/lib/command/AcApOpenCmd.js.map +1 -0
- package/lib/command/AcApPanCmd.d.ts +31 -0
- package/lib/command/AcApPanCmd.d.ts.map +1 -0
- package/lib/command/AcApPanCmd.js +55 -0
- package/lib/command/AcApPanCmd.js.map +1 -0
- package/lib/command/AcApQNewCmd.d.ts +32 -0
- package/lib/command/AcApQNewCmd.d.ts.map +1 -0
- package/lib/command/AcApQNewCmd.js +56 -0
- package/lib/command/AcApQNewCmd.js.map +1 -0
- package/lib/command/AcApRegenCmd.d.ts +21 -0
- package/lib/command/AcApRegenCmd.d.ts.map +1 -0
- package/lib/command/AcApRegenCmd.js +45 -0
- package/lib/command/AcApRegenCmd.js.map +1 -0
- package/lib/command/AcApSelectCmd.d.ts +32 -0
- package/lib/command/AcApSelectCmd.d.ts.map +1 -0
- package/lib/command/AcApSelectCmd.js +56 -0
- package/lib/command/AcApSelectCmd.js.map +1 -0
- package/lib/command/AcApSvgConvertor.d.ts +53 -0
- package/lib/command/AcApSvgConvertor.d.ts.map +1 -0
- package/lib/command/AcApSvgConvertor.js +103 -0
- package/lib/command/AcApSvgConvertor.js.map +1 -0
- package/lib/command/AcApZoomCmd.d.ts +35 -0
- package/lib/command/AcApZoomCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomCmd.js +57 -0
- package/lib/command/AcApZoomCmd.js.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts +68 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.js +158 -0
- package/lib/command/AcApZoomToBoxCmd.js.map +1 -0
- package/lib/command/index.d.ts +11 -0
- package/lib/command/index.d.ts.map +1 -0
- package/lib/command/index.js +11 -0
- package/lib/command/index.js.map +1 -0
- package/lib/editor/command/AcEdCommand.d.ts +151 -0
- package/lib/editor/command/AcEdCommand.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommand.js +164 -0
- package/lib/editor/command/AcEdCommand.js.map +1 -0
- package/lib/editor/command/AcEdCommandIterator.d.ts +36 -0
- package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommandIterator.js +65 -0
- package/lib/editor/command/AcEdCommandIterator.js.map +1 -0
- package/lib/editor/command/AcEdCommandStack.d.ts +120 -0
- package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommandStack.js +235 -0
- package/lib/editor/command/AcEdCommandStack.js.map +1 -0
- package/lib/editor/command/index.d.ts +3 -0
- package/lib/editor/command/index.d.ts.map +1 -0
- package/lib/editor/command/index.js +3 -0
- package/lib/editor/command/index.js.map +1 -0
- package/lib/editor/global/AcEdConditionWaiter.d.ts +51 -0
- package/lib/editor/global/AcEdConditionWaiter.d.ts.map +1 -0
- package/lib/editor/global/AcEdConditionWaiter.js +87 -0
- package/lib/editor/global/AcEdConditionWaiter.js.map +1 -0
- package/lib/editor/global/AcEdGlobalFunc.d.ts +8 -0
- package/lib/editor/global/AcEdGlobalFunc.d.ts.map +1 -0
- package/lib/editor/global/AcEdGlobalFunc.js +14 -0
- package/lib/editor/global/AcEdGlobalFunc.js.map +1 -0
- package/lib/editor/global/AcEdMessage.d.ts +5 -0
- package/lib/editor/global/AcEdMessage.d.ts.map +1 -0
- package/lib/editor/global/AcEdMessage.js +6 -0
- package/lib/editor/global/AcEdMessage.js.map +1 -0
- package/lib/editor/global/eventBus.d.ts +103 -0
- package/lib/editor/global/eventBus.d.ts.map +1 -0
- package/lib/editor/global/eventBus.js +41 -0
- package/lib/editor/global/eventBus.js.map +1 -0
- package/lib/editor/global/index.d.ts +4 -0
- package/lib/editor/global/index.d.ts.map +1 -0
- package/lib/editor/global/index.js +4 -0
- package/lib/editor/global/index.js.map +1 -0
- package/lib/editor/index.d.ts +5 -0
- package/lib/editor/index.d.ts.map +1 -0
- package/lib/editor/index.js +5 -0
- package/lib/editor/index.js.map +1 -0
- package/lib/editor/input/AcEdBaseInput.d.ts +89 -0
- package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -0
- package/lib/editor/input/AcEdBaseInput.js +166 -0
- package/lib/editor/input/AcEdBaseInput.js.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts +108 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.js +220 -0
- package/lib/editor/input/AcEdBoxSelector.js.map +1 -0
- package/lib/editor/input/AcEdCursorManager.d.ts +130 -0
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -0
- package/lib/editor/input/AcEdCursorManager.js +155 -0
- package/lib/editor/input/AcEdCursorManager.js.map +1 -0
- package/lib/editor/input/AcEdInputPoint.d.ts +51 -0
- package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -0
- package/lib/editor/input/AcEdInputPoint.js +78 -0
- package/lib/editor/input/AcEdInputPoint.js.map +1 -0
- package/lib/editor/input/AcEdJig.d.ts +180 -0
- package/lib/editor/input/AcEdJig.d.ts.map +1 -0
- package/lib/editor/input/AcEdJig.js +256 -0
- package/lib/editor/input/AcEdJig.js.map +1 -0
- package/lib/editor/input/AcEdJigLoop.d.ts +63 -0
- package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -0
- package/lib/editor/input/AcEdJigLoop.js +91 -0
- package/lib/editor/input/AcEdJigLoop.js.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts +146 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.js +179 -0
- package/lib/editor/input/AcEdSelectionSet.js.map +1 -0
- package/lib/editor/input/AcEditor.d.ts +111 -0
- package/lib/editor/input/AcEditor.d.ts.map +1 -0
- package/lib/editor/input/AcEditor.js +183 -0
- package/lib/editor/input/AcEditor.js.map +1 -0
- package/lib/editor/input/index.d.ts +5 -0
- package/lib/editor/input/index.d.ts.map +1 -0
- package/lib/editor/input/index.js +5 -0
- package/lib/editor/input/index.js.map +1 -0
- package/lib/editor/view/AcEdBaseView.d.ts +457 -0
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -0
- package/lib/editor/view/AcEdBaseView.js +349 -0
- package/lib/editor/view/AcEdBaseView.js.map +1 -0
- package/lib/editor/view/AcEdLayerInfo.d.ts +21 -0
- package/lib/editor/view/AcEdLayerInfo.d.ts.map +1 -0
- package/lib/editor/view/AcEdLayerInfo.js +2 -0
- package/lib/editor/view/AcEdLayerInfo.js.map +1 -0
- package/lib/editor/view/index.d.ts +3 -0
- package/lib/editor/view/index.d.ts.map +1 -0
- package/lib/editor/view/index.js +3 -0
- package/lib/editor/view/index.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/lib/util/AcTrGeometryUtil.d.ts +92 -0
- package/lib/util/AcTrGeometryUtil.d.ts.map +1 -0
- package/lib/util/AcTrGeometryUtil.js +109 -0
- package/lib/util/AcTrGeometryUtil.js.map +1 -0
- package/lib/util/index.d.ts +2 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +2 -0
- package/lib/util/index.js.map +1 -0
- package/lib/view/AcTrLayer.d.ts +132 -0
- package/lib/view/AcTrLayer.d.ts.map +1 -0
- package/lib/view/AcTrLayer.js +199 -0
- package/lib/view/AcTrLayer.js.map +1 -0
- package/lib/view/AcTrLayout.d.ts +218 -0
- package/lib/view/AcTrLayout.d.ts.map +1 -0
- package/lib/view/AcTrLayout.js +437 -0
- package/lib/view/AcTrLayout.js.map +1 -0
- package/lib/view/AcTrLayoutView.d.ts +115 -0
- package/lib/view/AcTrLayoutView.d.ts.map +1 -0
- package/lib/view/AcTrLayoutView.js +200 -0
- package/lib/view/AcTrLayoutView.js.map +1 -0
- package/lib/view/AcTrLayoutViewManager.d.ts +89 -0
- package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -0
- package/lib/view/AcTrLayoutViewManager.js +118 -0
- package/lib/view/AcTrLayoutViewManager.js.map +1 -0
- package/lib/view/AcTrScene.d.ts +162 -0
- package/lib/view/AcTrScene.d.ts.map +1 -0
- package/lib/view/AcTrScene.js +370 -0
- package/lib/view/AcTrScene.js.map +1 -0
- package/lib/view/AcTrView2d.d.ts +262 -0
- package/lib/view/AcTrView2d.d.ts.map +1 -0
- package/lib/view/AcTrView2d.js +772 -0
- package/lib/view/AcTrView2d.js.map +1 -0
- package/lib/view/index.d.ts +2 -0
- package/lib/view/index.d.ts.map +1 -0
- package/lib/view/index.js +2 -0
- package/lib/view/index.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import { AcEdCommand } from '../command';
|
|
17
|
+
/**
|
|
18
|
+
* Command to zoom the view to fit all visible entities.
|
|
19
|
+
*
|
|
20
|
+
* This command adjusts the view's zoom level and position to show all
|
|
21
|
+
* visible entities in the current drawing within the viewport. It's
|
|
22
|
+
* equivalent to the "Zoom Extents" or "Fit to Window" functionality
|
|
23
|
+
* found in most CAD applications.
|
|
24
|
+
*
|
|
25
|
+
* The command calculates the bounding box of all visible entities and
|
|
26
|
+
* adjusts the camera to show them all with appropriate padding.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const zoomCommand = new AcApZoomCmd();
|
|
31
|
+
* zoomCommand.globalName = 'ZOOM';
|
|
32
|
+
* zoomCommand.localName = 'Zoom to Fit';
|
|
33
|
+
*
|
|
34
|
+
* // Execute the command to fit all entities in view
|
|
35
|
+
* zoomCommand.trigger(docManager.context);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
var AcApZoomCmd = /** @class */ (function (_super) {
|
|
39
|
+
__extends(AcApZoomCmd, _super);
|
|
40
|
+
function AcApZoomCmd() {
|
|
41
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Executes the zoom to fit command.
|
|
45
|
+
*
|
|
46
|
+
* Calls the view's `zoomToFit()` method to adjust the camera position
|
|
47
|
+
* and zoom level to display all visible entities within the viewport.
|
|
48
|
+
*
|
|
49
|
+
* @param context - The current application context containing the view to zoom
|
|
50
|
+
*/
|
|
51
|
+
AcApZoomCmd.prototype.execute = function (context) {
|
|
52
|
+
context.view.zoomToFit();
|
|
53
|
+
};
|
|
54
|
+
return AcApZoomCmd;
|
|
55
|
+
}(AcEdCommand));
|
|
56
|
+
export { AcApZoomCmd };
|
|
57
|
+
//# sourceMappingURL=AcApZoomCmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApZoomCmd.js","sourceRoot":"","sources":["../../src/command/AcApZoomCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IAAiC,+BAAW;IAA5C;;IAYA,CAAC;IAXC;;;;;;;OAOG;IACH,6BAAO,GAAP,UAAQ,OAAoB;QAC1B,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAA;IAC1B,CAAC;IACH,kBAAC;AAAD,CAAC,AAZD,CAAiC,WAAW,GAY3C"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { AcApContext } from '../app';
|
|
2
|
+
import { AcEdCommand } from '../command';
|
|
3
|
+
import { AcEdBaseView, AcEdJig } from '../editor';
|
|
4
|
+
/**
|
|
5
|
+
* Jig for handling zoom-to-box selection interaction.
|
|
6
|
+
*
|
|
7
|
+
* This jig handles the user interaction for selecting a rectangular
|
|
8
|
+
* area to zoom to. It extends {@link AcEdJig} to provide interactive
|
|
9
|
+
* selection capabilities.
|
|
10
|
+
*
|
|
11
|
+
* The jig allows users to:
|
|
12
|
+
* - Select a rectangular area on the drawing
|
|
13
|
+
* - Zoom the view to fit the selected area
|
|
14
|
+
* - Provide visual feedback during selection
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const jig = new AcApZoomToBoxJig(view);
|
|
19
|
+
* await jig.drag(); // User selects area to zoom to
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class AcApZoomToBoxJig extends AcEdJig<boolean> {
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new zoom-to-box jig.
|
|
25
|
+
*
|
|
26
|
+
* @param view - The view that will be zoomed
|
|
27
|
+
*/
|
|
28
|
+
constructor(view: AcEdBaseView);
|
|
29
|
+
/**
|
|
30
|
+
* Handles the selection sampling and zooming operation.
|
|
31
|
+
*
|
|
32
|
+
* This method gets the user's selection box and applies
|
|
33
|
+
* the zoom operation to fit that area in the view.
|
|
34
|
+
*
|
|
35
|
+
* @returns Promise that resolves when the zoom operation completes
|
|
36
|
+
*/
|
|
37
|
+
sampler(): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Command for zooming to a user-selected rectangular area.
|
|
41
|
+
*
|
|
42
|
+
* This command initiates an interactive zoom-to-box operation where:
|
|
43
|
+
* - User selects a rectangular area by dragging
|
|
44
|
+
* - The view zooms to fit the selected area
|
|
45
|
+
* - The zoom level is adjusted to show the entire selected region
|
|
46
|
+
*
|
|
47
|
+
* This provides precise navigation control, allowing users to quickly
|
|
48
|
+
* focus on specific areas of large drawings.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const zoomToBoxCmd = new AcApZoomToBoxCmd();
|
|
53
|
+
* await zoomToBoxCmd.execute(context); // User selects area to zoom to
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare class AcApZoomToBoxCmd extends AcEdCommand {
|
|
57
|
+
/**
|
|
58
|
+
* Executes the zoom-to-box command.
|
|
59
|
+
*
|
|
60
|
+
* Creates a jig for interactive area selection and initiates
|
|
61
|
+
* the drag operation for the user to select the zoom area.
|
|
62
|
+
*
|
|
63
|
+
* @param context - The application context containing the view
|
|
64
|
+
* @returns Promise that resolves when the zoom operation completes
|
|
65
|
+
*/
|
|
66
|
+
execute(context: AcApContext): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=AcApZoomToBoxCmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApZoomToBoxCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApZoomToBoxCmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,gBAAiB,SAAQ,OAAO,CAAC,OAAO,CAAC;IACpD;;;;OAIG;gBACS,IAAI,EAAE,YAAY;IAI9B;;;;;;;OAOG;IACG,OAAO;CAKd;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C;;;;;;;;OAQG;IACG,OAAO,CAAC,OAAO,EAAE,WAAW;CAInC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
27
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
import { AcApDocManager } from '../app';
|
|
53
|
+
import { AcEdCommand } from '../command';
|
|
54
|
+
import { AcEdJig } from '../editor';
|
|
55
|
+
/**
|
|
56
|
+
* Jig for handling zoom-to-box selection interaction.
|
|
57
|
+
*
|
|
58
|
+
* This jig handles the user interaction for selecting a rectangular
|
|
59
|
+
* area to zoom to. It extends {@link AcEdJig} to provide interactive
|
|
60
|
+
* selection capabilities.
|
|
61
|
+
*
|
|
62
|
+
* The jig allows users to:
|
|
63
|
+
* - Select a rectangular area on the drawing
|
|
64
|
+
* - Zoom the view to fit the selected area
|
|
65
|
+
* - Provide visual feedback during selection
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const jig = new AcApZoomToBoxJig(view);
|
|
70
|
+
* await jig.drag(); // User selects area to zoom to
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
var AcApZoomToBoxJig = /** @class */ (function (_super) {
|
|
74
|
+
__extends(AcApZoomToBoxJig, _super);
|
|
75
|
+
/**
|
|
76
|
+
* Creates a new zoom-to-box jig.
|
|
77
|
+
*
|
|
78
|
+
* @param view - The view that will be zoomed
|
|
79
|
+
*/
|
|
80
|
+
function AcApZoomToBoxJig(view) {
|
|
81
|
+
return _super.call(this, view) || this;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Handles the selection sampling and zooming operation.
|
|
85
|
+
*
|
|
86
|
+
* This method gets the user's selection box and applies
|
|
87
|
+
* the zoom operation to fit that area in the view.
|
|
88
|
+
*
|
|
89
|
+
* @returns Promise that resolves when the zoom operation completes
|
|
90
|
+
*/
|
|
91
|
+
AcApZoomToBoxJig.prototype.sampler = function () {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
+
var _this = this;
|
|
94
|
+
return __generator(this, function (_a) {
|
|
95
|
+
switch (_a.label) {
|
|
96
|
+
case 0: return [4 /*yield*/, AcApDocManager.instance.editor.getSelection().then(function (box) {
|
|
97
|
+
return _this.view.zoomTo(box, 1);
|
|
98
|
+
})];
|
|
99
|
+
case 1:
|
|
100
|
+
_a.sent();
|
|
101
|
+
return [2 /*return*/];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
return AcApZoomToBoxJig;
|
|
107
|
+
}(AcEdJig));
|
|
108
|
+
export { AcApZoomToBoxJig };
|
|
109
|
+
/**
|
|
110
|
+
* Command for zooming to a user-selected rectangular area.
|
|
111
|
+
*
|
|
112
|
+
* This command initiates an interactive zoom-to-box operation where:
|
|
113
|
+
* - User selects a rectangular area by dragging
|
|
114
|
+
* - The view zooms to fit the selected area
|
|
115
|
+
* - The zoom level is adjusted to show the entire selected region
|
|
116
|
+
*
|
|
117
|
+
* This provides precise navigation control, allowing users to quickly
|
|
118
|
+
* focus on specific areas of large drawings.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* const zoomToBoxCmd = new AcApZoomToBoxCmd();
|
|
123
|
+
* await zoomToBoxCmd.execute(context); // User selects area to zoom to
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
var AcApZoomToBoxCmd = /** @class */ (function (_super) {
|
|
127
|
+
__extends(AcApZoomToBoxCmd, _super);
|
|
128
|
+
function AcApZoomToBoxCmd() {
|
|
129
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Executes the zoom-to-box command.
|
|
133
|
+
*
|
|
134
|
+
* Creates a jig for interactive area selection and initiates
|
|
135
|
+
* the drag operation for the user to select the zoom area.
|
|
136
|
+
*
|
|
137
|
+
* @param context - The application context containing the view
|
|
138
|
+
* @returns Promise that resolves when the zoom operation completes
|
|
139
|
+
*/
|
|
140
|
+
AcApZoomToBoxCmd.prototype.execute = function (context) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
142
|
+
var jig;
|
|
143
|
+
return __generator(this, function (_a) {
|
|
144
|
+
switch (_a.label) {
|
|
145
|
+
case 0:
|
|
146
|
+
jig = new AcApZoomToBoxJig(context.view);
|
|
147
|
+
return [4 /*yield*/, jig.drag()];
|
|
148
|
+
case 1:
|
|
149
|
+
_a.sent();
|
|
150
|
+
return [2 /*return*/];
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
return AcApZoomToBoxCmd;
|
|
156
|
+
}(AcEdCommand));
|
|
157
|
+
export { AcApZoomToBoxCmd };
|
|
158
|
+
//# sourceMappingURL=AcApZoomToBoxCmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApZoomToBoxCmd.js","sourceRoot":"","sources":["../../src/command/AcApZoomToBoxCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAgB,OAAO,EAAE,MAAM,WAAW,CAAA;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH;IAAsC,oCAAgB;IACpD;;;;OAIG;IACH,0BAAY,IAAkB;QAC5B,OAAA,MAAK,YAAC,IAAI,CAAC,SAAA;IACb,CAAC;IAED;;;;;;;OAOG;IACG,kCAAO,GAAb;;;;;4BACE,qBAAM,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,UAAA,GAAG;4BAC1D,OAAO,KAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;wBACjC,CAAC,CAAC,EAAA;;wBAFF,SAEE,CAAA;;;;;KACH;IACH,uBAAC;AAAD,CAAC,AAvBD,CAAsC,OAAO,GAuB5C;;AAED;;;;;;;;;;;;;;;;GAgBG;AACH;IAAsC,oCAAW;IAAjD;;IAcA,CAAC;IAbC;;;;;;;;OAQG;IACG,kCAAO,GAAb,UAAc,OAAoB;;;;;;wBAC1B,GAAG,GAAG,IAAI,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;wBAC9C,qBAAM,GAAG,CAAC,IAAI,EAAE,EAAA;;wBAAhB,SAAgB,CAAA;;;;;KACjB;IACH,uBAAC;AAAD,CAAC,AAdD,CAAsC,WAAW,GAchD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from '../editor/command/AcEdCommand';
|
|
2
|
+
export * from '../editor/command/AcEdCommandStack';
|
|
3
|
+
export * from './AcApConvertToSvgCmd';
|
|
4
|
+
export * from './AcApOpenCmd';
|
|
5
|
+
export * from './AcApQNewCmd';
|
|
6
|
+
export * from './AcApRegenCmd';
|
|
7
|
+
export * from './AcApSelectCmd';
|
|
8
|
+
export * from './AcApZoomCmd';
|
|
9
|
+
export * from './AcApZoomToBoxCmd';
|
|
10
|
+
export * from './AcApPanCmd';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oCAAoC,CAAA;AAClD,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from '../editor/command/AcEdCommand';
|
|
2
|
+
export * from '../editor/command/AcEdCommandStack';
|
|
3
|
+
export * from './AcApConvertToSvgCmd';
|
|
4
|
+
export * from './AcApOpenCmd';
|
|
5
|
+
export * from './AcApQNewCmd';
|
|
6
|
+
export * from './AcApRegenCmd';
|
|
7
|
+
export * from './AcApSelectCmd';
|
|
8
|
+
export * from './AcApZoomCmd';
|
|
9
|
+
export * from './AcApZoomToBoxCmd';
|
|
10
|
+
export * from './AcApPanCmd';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oCAAoC,CAAA;AAClD,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { AcCmEventManager } from '@mlightcad/data-model';
|
|
2
|
+
import { AcApContext } from '../../app';
|
|
3
|
+
/**
|
|
4
|
+
* Event arguments for command lifecycle events.
|
|
5
|
+
*
|
|
6
|
+
* Contains the command instance that triggered the event.
|
|
7
|
+
*/
|
|
8
|
+
export interface AcEdCommandEventArgs {
|
|
9
|
+
/** The command instance involved in the event */
|
|
10
|
+
command: AcEdCommand;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Abstract base class for all CAD commands.
|
|
14
|
+
*
|
|
15
|
+
* This class provides the foundation for implementing CAD commands with:
|
|
16
|
+
* - Command name management (global and localized names)
|
|
17
|
+
* - Lifecycle event handling (command start/end)
|
|
18
|
+
* - Execution framework with context access
|
|
19
|
+
* - Event notification system
|
|
20
|
+
*
|
|
21
|
+
* Commands are the primary way users interact with the CAD system. Each command
|
|
22
|
+
* represents a specific operation like drawing lines, selecting objects, zooming, etc.
|
|
23
|
+
*
|
|
24
|
+
* ## Command Lifecycle
|
|
25
|
+
* 1. Command is triggered via `trigger()` method
|
|
26
|
+
* 2. `commandWillStart` event is fired
|
|
27
|
+
* 3. `execute()` method is called with current context
|
|
28
|
+
* 4. `commandEnded` event is fired
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* class MyDrawCommand extends AcEdCommand {
|
|
33
|
+
* constructor() {
|
|
34
|
+
* super();
|
|
35
|
+
* this.globalName = 'DRAW';
|
|
36
|
+
* this.localName = 'Draw Line';
|
|
37
|
+
* }
|
|
38
|
+
*
|
|
39
|
+
* execute(context: AcApContext) {
|
|
40
|
+
* // Implement command logic here
|
|
41
|
+
* const view = context.view;
|
|
42
|
+
* const document = context.doc;
|
|
43
|
+
* // ... drawing logic
|
|
44
|
+
* }
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* // Usage
|
|
48
|
+
* const command = new MyDrawCommand();
|
|
49
|
+
* command.events.commandWillStart.addEventListener(args => {
|
|
50
|
+
* console.log('Command starting:', args.command.globalName);
|
|
51
|
+
* });
|
|
52
|
+
* command.trigger(context);
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare abstract class AcEdCommand {
|
|
56
|
+
/** The global (untranslated) name of the command */
|
|
57
|
+
private _globalName;
|
|
58
|
+
/** The local (translated) name of the command */
|
|
59
|
+
private _localName;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a new command instance.
|
|
62
|
+
*
|
|
63
|
+
* Initializes the command with empty names. Subclasses should set
|
|
64
|
+
* appropriate global and local names in their constructors.
|
|
65
|
+
*/
|
|
66
|
+
constructor();
|
|
67
|
+
/** Events fired during command execution lifecycle */
|
|
68
|
+
readonly events: {
|
|
69
|
+
/** Fired just before the command starts executing */
|
|
70
|
+
commandWillStart: AcCmEventManager<AcEdCommandEventArgs>;
|
|
71
|
+
/** Fired after the command finishes executing */
|
|
72
|
+
commandEnded: AcCmEventManager<AcEdCommandEventArgs>;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Gets the global (untranslated) name of the command.
|
|
76
|
+
*
|
|
77
|
+
* The global name is typically used for programmatic access and
|
|
78
|
+
* should remain consistent across different language localizations.
|
|
79
|
+
*
|
|
80
|
+
* @returns The global command name
|
|
81
|
+
*/
|
|
82
|
+
get globalName(): string;
|
|
83
|
+
/**
|
|
84
|
+
* Sets the global (untranslated) name of the command.
|
|
85
|
+
*
|
|
86
|
+
* @param value - The global command name (e.g., 'LINE', 'CIRCLE', 'ZOOM')
|
|
87
|
+
*/
|
|
88
|
+
set globalName(value: string);
|
|
89
|
+
/**
|
|
90
|
+
* Gets the local (translated) name of the command.
|
|
91
|
+
*
|
|
92
|
+
* The local name is displayed to users and should be localized
|
|
93
|
+
* to the current language/region.
|
|
94
|
+
*
|
|
95
|
+
* @returns The localized command name
|
|
96
|
+
*/
|
|
97
|
+
get localName(): string;
|
|
98
|
+
/**
|
|
99
|
+
* Sets the local (translated) name of the command.
|
|
100
|
+
*
|
|
101
|
+
* @param value - The localized command name (e.g., 'Draw Line', 'Zoom In')
|
|
102
|
+
*/
|
|
103
|
+
set localName(value: string);
|
|
104
|
+
/**
|
|
105
|
+
* Triggers the command execution with proper event handling.
|
|
106
|
+
*
|
|
107
|
+
* This method should not be overridden by subclasses as it handles
|
|
108
|
+
* the event notification workflow. Subclasses should implement the
|
|
109
|
+
* `execute()` method instead.
|
|
110
|
+
*
|
|
111
|
+
* The execution flow:
|
|
112
|
+
* 1. Fires `commandWillStart` event
|
|
113
|
+
* 2. Calls the `execute()` method
|
|
114
|
+
* 3. Fires `commandEnded` event
|
|
115
|
+
*
|
|
116
|
+
* @param context - The current application context containing view and document
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* const command = new MyCommand();
|
|
121
|
+
* command.trigger(docManager.context);
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
tirgger(context: AcApContext): void;
|
|
125
|
+
/**
|
|
126
|
+
* Executes the command logic.
|
|
127
|
+
*
|
|
128
|
+
* This abstract method must be implemented by subclasses to define
|
|
129
|
+
* the specific behavior of the command. The method receives the current
|
|
130
|
+
* application context providing access to the view and document.
|
|
131
|
+
*
|
|
132
|
+
* @param _context - The current application context
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* execute(context: AcApContext) {
|
|
137
|
+
* const view = context.view;
|
|
138
|
+
* const doc = context.doc;
|
|
139
|
+
*
|
|
140
|
+
* // Get user input
|
|
141
|
+
* const point = await view.editor.getPoint();
|
|
142
|
+
*
|
|
143
|
+
* // Create entity in document
|
|
144
|
+
* const entity = new SomeEntity(point);
|
|
145
|
+
* doc.database.addEntity(entity);
|
|
146
|
+
* }
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
execute(_context: AcApContext): void;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=AcEdCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdCommand.d.ts","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,iDAAiD;IACjD,OAAO,EAAE,WAAW,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,8BAAsB,WAAW;IAC/B,oDAAoD;IACpD,OAAO,CAAC,WAAW,CAAQ;IAC3B,iDAAiD;IACjD,OAAO,CAAC,UAAU,CAAQ;IAE1B;;;;;OAKG;;IAMH,sDAAsD;IACtD,SAAgB,MAAM;QACpB,qDAAqD;;QAErD,iDAAiD;;MAElD;IAED;;;;;;;OAOG;IACH,IAAI,UAAU,IASQ,MAAM,CAP3B;IAED;;;;OAIG;IACH,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,EAE3B;IAED;;;;;;;OAOG;IACH,IAAI,SAAS,IASQ,MAAM,CAP1B;IAED;;;;OAIG;IACH,IAAI,SAAS,CAAC,KAAK,EAAE,MAAM,EAE1B;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,OAAO,EAAE,WAAW;IAM5B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,QAAQ,EAAE,WAAW;CAG9B"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { AcCmEventManager } from '@mlightcad/data-model';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for all CAD commands.
|
|
4
|
+
*
|
|
5
|
+
* This class provides the foundation for implementing CAD commands with:
|
|
6
|
+
* - Command name management (global and localized names)
|
|
7
|
+
* - Lifecycle event handling (command start/end)
|
|
8
|
+
* - Execution framework with context access
|
|
9
|
+
* - Event notification system
|
|
10
|
+
*
|
|
11
|
+
* Commands are the primary way users interact with the CAD system. Each command
|
|
12
|
+
* represents a specific operation like drawing lines, selecting objects, zooming, etc.
|
|
13
|
+
*
|
|
14
|
+
* ## Command Lifecycle
|
|
15
|
+
* 1. Command is triggered via `trigger()` method
|
|
16
|
+
* 2. `commandWillStart` event is fired
|
|
17
|
+
* 3. `execute()` method is called with current context
|
|
18
|
+
* 4. `commandEnded` event is fired
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* class MyDrawCommand extends AcEdCommand {
|
|
23
|
+
* constructor() {
|
|
24
|
+
* super();
|
|
25
|
+
* this.globalName = 'DRAW';
|
|
26
|
+
* this.localName = 'Draw Line';
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* execute(context: AcApContext) {
|
|
30
|
+
* // Implement command logic here
|
|
31
|
+
* const view = context.view;
|
|
32
|
+
* const document = context.doc;
|
|
33
|
+
* // ... drawing logic
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* // Usage
|
|
38
|
+
* const command = new MyDrawCommand();
|
|
39
|
+
* command.events.commandWillStart.addEventListener(args => {
|
|
40
|
+
* console.log('Command starting:', args.command.globalName);
|
|
41
|
+
* });
|
|
42
|
+
* command.trigger(context);
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
var AcEdCommand = /** @class */ (function () {
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new command instance.
|
|
48
|
+
*
|
|
49
|
+
* Initializes the command with empty names. Subclasses should set
|
|
50
|
+
* appropriate global and local names in their constructors.
|
|
51
|
+
*/
|
|
52
|
+
function AcEdCommand() {
|
|
53
|
+
/** Events fired during command execution lifecycle */
|
|
54
|
+
this.events = {
|
|
55
|
+
/** Fired just before the command starts executing */
|
|
56
|
+
commandWillStart: new AcCmEventManager(),
|
|
57
|
+
/** Fired after the command finishes executing */
|
|
58
|
+
commandEnded: new AcCmEventManager()
|
|
59
|
+
};
|
|
60
|
+
this._globalName = '';
|
|
61
|
+
this._localName = '';
|
|
62
|
+
}
|
|
63
|
+
Object.defineProperty(AcEdCommand.prototype, "globalName", {
|
|
64
|
+
/**
|
|
65
|
+
* Gets the global (untranslated) name of the command.
|
|
66
|
+
*
|
|
67
|
+
* The global name is typically used for programmatic access and
|
|
68
|
+
* should remain consistent across different language localizations.
|
|
69
|
+
*
|
|
70
|
+
* @returns The global command name
|
|
71
|
+
*/
|
|
72
|
+
get: function () {
|
|
73
|
+
return this._globalName;
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* Sets the global (untranslated) name of the command.
|
|
77
|
+
*
|
|
78
|
+
* @param value - The global command name (e.g., 'LINE', 'CIRCLE', 'ZOOM')
|
|
79
|
+
*/
|
|
80
|
+
set: function (value) {
|
|
81
|
+
this._globalName = value;
|
|
82
|
+
},
|
|
83
|
+
enumerable: false,
|
|
84
|
+
configurable: true
|
|
85
|
+
});
|
|
86
|
+
Object.defineProperty(AcEdCommand.prototype, "localName", {
|
|
87
|
+
/**
|
|
88
|
+
* Gets the local (translated) name of the command.
|
|
89
|
+
*
|
|
90
|
+
* The local name is displayed to users and should be localized
|
|
91
|
+
* to the current language/region.
|
|
92
|
+
*
|
|
93
|
+
* @returns The localized command name
|
|
94
|
+
*/
|
|
95
|
+
get: function () {
|
|
96
|
+
return this._localName;
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* Sets the local (translated) name of the command.
|
|
100
|
+
*
|
|
101
|
+
* @param value - The localized command name (e.g., 'Draw Line', 'Zoom In')
|
|
102
|
+
*/
|
|
103
|
+
set: function (value) {
|
|
104
|
+
this._localName = value;
|
|
105
|
+
},
|
|
106
|
+
enumerable: false,
|
|
107
|
+
configurable: true
|
|
108
|
+
});
|
|
109
|
+
/**
|
|
110
|
+
* Triggers the command execution with proper event handling.
|
|
111
|
+
*
|
|
112
|
+
* This method should not be overridden by subclasses as it handles
|
|
113
|
+
* the event notification workflow. Subclasses should implement the
|
|
114
|
+
* `execute()` method instead.
|
|
115
|
+
*
|
|
116
|
+
* The execution flow:
|
|
117
|
+
* 1. Fires `commandWillStart` event
|
|
118
|
+
* 2. Calls the `execute()` method
|
|
119
|
+
* 3. Fires `commandEnded` event
|
|
120
|
+
*
|
|
121
|
+
* @param context - The current application context containing view and document
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* const command = new MyCommand();
|
|
126
|
+
* command.trigger(docManager.context);
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
AcEdCommand.prototype.tirgger = function (context) {
|
|
130
|
+
this.events.commandWillStart.dispatch({ command: this });
|
|
131
|
+
this.execute(context);
|
|
132
|
+
this.events.commandEnded.dispatch({ command: this });
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Executes the command logic.
|
|
136
|
+
*
|
|
137
|
+
* This abstract method must be implemented by subclasses to define
|
|
138
|
+
* the specific behavior of the command. The method receives the current
|
|
139
|
+
* application context providing access to the view and document.
|
|
140
|
+
*
|
|
141
|
+
* @param _context - The current application context
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* execute(context: AcApContext) {
|
|
146
|
+
* const view = context.view;
|
|
147
|
+
* const doc = context.doc;
|
|
148
|
+
*
|
|
149
|
+
* // Get user input
|
|
150
|
+
* const point = await view.editor.getPoint();
|
|
151
|
+
*
|
|
152
|
+
* // Create entity in document
|
|
153
|
+
* const entity = new SomeEntity(point);
|
|
154
|
+
* doc.database.addEntity(entity);
|
|
155
|
+
* }
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
AcEdCommand.prototype.execute = function (_context) {
|
|
159
|
+
// Do nothing - subclasses should override this method
|
|
160
|
+
};
|
|
161
|
+
return AcEdCommand;
|
|
162
|
+
}());
|
|
163
|
+
export { AcEdCommand };
|
|
164
|
+
//# sourceMappingURL=AcEdCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdCommand.js","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAcxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH;IAME;;;;;OAKG;IACH;QAKA,sDAAsD;QACtC,WAAM,GAAG;YACvB,qDAAqD;YACrD,gBAAgB,EAAE,IAAI,gBAAgB,EAAwB;YAC9D,iDAAiD;YACjD,YAAY,EAAE,IAAI,gBAAgB,EAAwB;SAC3D,CAAA;QAVC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAA;QACrB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAA;IACtB,CAAC;IAkBD,sBAAI,mCAAU;QARd;;;;;;;WAOG;aACH;YACE,OAAO,IAAI,CAAC,WAAW,CAAA;QACzB,CAAC;QAED;;;;WAIG;aACH,UAAe,KAAa;YAC1B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA;QAC1B,CAAC;;;OATA;IAmBD,sBAAI,kCAAS;QARb;;;;;;;WAOG;aACH;YACE,OAAO,IAAI,CAAC,UAAU,CAAA;QACxB,CAAC;QAED;;;;WAIG;aACH,UAAc,KAAa;YACzB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAA;QACzB,CAAC;;;OATA;IAWD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,6BAAO,GAAP,UAAQ,OAAoB;QAC1B,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;QACxD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACrB,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;IACtD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,6BAAO,GAAP,UAAQ,QAAqB;QAC3B,sDAAsD;IACxD,CAAC;IACH,kBAAC;AAAD,CAAC,AAxHD,IAwHC"}
|