@mlightcad/cad-simple-viewer 1.2.2 → 1.2.3
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/__vite-browser-external-l0sNRNKZ-l0sNRNKZ.js +1 -0
- package/dist/index.js +40205 -0
- package/dist/index.umd.cjs +333 -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 +3 -3
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { AcCmEventManager } from '@mlightcad/data-model';
|
|
2
|
+
import { AcDbObjectId } from '@mlightcad/data-model';
|
|
3
|
+
/**
|
|
4
|
+
* Event arguments for selection-related events.
|
|
5
|
+
*
|
|
6
|
+
* Contains the entity IDs that were involved in the selection change.
|
|
7
|
+
*/
|
|
8
|
+
export interface AcEdSelectionEventArgs {
|
|
9
|
+
/** Array of entity IDs that were added or removed from selection */
|
|
10
|
+
ids: AcDbObjectId[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Manages a collection of selected CAD entities in the current view.
|
|
14
|
+
*
|
|
15
|
+
* This class maintains a set of selected entity IDs and provides methods to:
|
|
16
|
+
* - Add entities to the selection
|
|
17
|
+
* - Remove entities from the selection
|
|
18
|
+
* - Clear all selections
|
|
19
|
+
* - Query selection state and count
|
|
20
|
+
* - Listen for selection change events
|
|
21
|
+
*
|
|
22
|
+
* The selection set fires events when entities are added or removed, allowing
|
|
23
|
+
* other components (like the view) to respond to selection changes by showing
|
|
24
|
+
* grip points, updating UI, etc.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const selectionSet = new AcEdSelectionSet();
|
|
29
|
+
*
|
|
30
|
+
* // Listen for selection changes
|
|
31
|
+
* selectionSet.events.selectionAdded.addEventListener(args => {
|
|
32
|
+
* console.log('Added entities:', args.ids);
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // Add entities to selection
|
|
36
|
+
* selectionSet.add(['entity1', 'entity2']);
|
|
37
|
+
*
|
|
38
|
+
* // Check selection
|
|
39
|
+
* if (selectionSet.count > 0) {
|
|
40
|
+
* console.log(`${selectionSet.count} entities selected`);
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* // Clear selection
|
|
44
|
+
* selectionSet.clear();
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare class AcEdSelectionSet {
|
|
48
|
+
/** Internal set storing the selected entity IDs */
|
|
49
|
+
private _ids;
|
|
50
|
+
/** Events fired when selection changes */
|
|
51
|
+
readonly events: {
|
|
52
|
+
/** Fired when entities are added to the selection */
|
|
53
|
+
selectionAdded: AcCmEventManager<AcEdSelectionEventArgs>;
|
|
54
|
+
/** Fired when entities are removed from the selection */
|
|
55
|
+
selectionRemoved: AcCmEventManager<AcEdSelectionEventArgs>;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new selection set.
|
|
59
|
+
*
|
|
60
|
+
* @param ids - Optional initial array of entity IDs to include in the selection
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* // Create empty selection set
|
|
65
|
+
* const selectionSet = new AcEdSelectionSet();
|
|
66
|
+
*
|
|
67
|
+
* // Create selection set with initial entities
|
|
68
|
+
* const selectionSet = new AcEdSelectionSet(['entity1', 'entity2']);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
constructor(ids?: AcDbObjectId[]);
|
|
72
|
+
/**
|
|
73
|
+
* Gets an array of all selected entity IDs.
|
|
74
|
+
*
|
|
75
|
+
* @returns Array containing all selected entity IDs
|
|
76
|
+
*/
|
|
77
|
+
get ids(): string[];
|
|
78
|
+
/**
|
|
79
|
+
* Gets the number of selected entities.
|
|
80
|
+
*
|
|
81
|
+
* @returns The count of selected entities
|
|
82
|
+
*/
|
|
83
|
+
get count(): number;
|
|
84
|
+
/**
|
|
85
|
+
* Adds one or more entities to the selection.
|
|
86
|
+
*
|
|
87
|
+
* Fires a `selectionAdded` event with the added entity IDs.
|
|
88
|
+
* Duplicate IDs are automatically handled by the internal Set.
|
|
89
|
+
*
|
|
90
|
+
* @param value - Single entity ID or array of entity IDs to add
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* // Add single entity
|
|
95
|
+
* selectionSet.add('entity1');
|
|
96
|
+
*
|
|
97
|
+
* // Add multiple entities
|
|
98
|
+
* selectionSet.add(['entity2', 'entity3', 'entity4']);
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
add(value: AcDbObjectId | AcDbObjectId[]): void;
|
|
102
|
+
/**
|
|
103
|
+
* Removes one or more entities from the selection.
|
|
104
|
+
*
|
|
105
|
+
* Fires a `selectionRemoved` event with the removed entity IDs.
|
|
106
|
+
* Non-existent IDs are silently ignored.
|
|
107
|
+
*
|
|
108
|
+
* @param value - Single entity ID or array of entity IDs to remove
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* // Remove single entity
|
|
113
|
+
* selectionSet.delete('entity1');
|
|
114
|
+
*
|
|
115
|
+
* // Remove multiple entities
|
|
116
|
+
* selectionSet.delete(['entity2', 'entity3']);
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
delete(value: AcDbObjectId | AcDbObjectId[]): void;
|
|
120
|
+
/**
|
|
121
|
+
* Checks if an entity is currently selected.
|
|
122
|
+
*
|
|
123
|
+
* @param id - The entity ID to check
|
|
124
|
+
* @returns True if the entity is selected, false otherwise
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* if (selectionSet.has('entity1')) {
|
|
129
|
+
* console.log('Entity1 is selected');
|
|
130
|
+
* }
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
has(id: AcDbObjectId): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Removes all entities from the selection.
|
|
136
|
+
*
|
|
137
|
+
* Fires a `selectionRemoved` event with all previously selected entity IDs.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* selectionSet.clear(); // Deselect everything
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
clear(): void;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=AcEdSelectionSet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdSelectionSet.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdSelectionSet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,oEAAoE;IACpE,GAAG,EAAE,YAAY,EAAE,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,gBAAgB;IAC3B,mDAAmD;IACnD,OAAO,CAAC,IAAI,CAAmB;IAE/B,0CAA0C;IAC1C,SAAgB,MAAM;QACpB,qDAAqD;;QAErD,yDAAyD;;MAE1D;IAED;;;;;;;;;;;;;OAaG;gBACS,GAAG,GAAE,YAAY,EAAO;IAIpC;;;;OAIG;IACH,IAAI,GAAG,aAEN;IAED;;;;OAIG;IACH,IAAI,KAAK,WAER;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,EAAE;IAUxC;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,EAAE;IAU3C;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,EAAE,EAAE,YAAY;IAIpB;;;;;;;;;OASG;IACH,KAAK;CAON"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { AcCmEventManager } from '@mlightcad/data-model';
|
|
2
|
+
/**
|
|
3
|
+
* Manages a collection of selected CAD entities in the current view.
|
|
4
|
+
*
|
|
5
|
+
* This class maintains a set of selected entity IDs and provides methods to:
|
|
6
|
+
* - Add entities to the selection
|
|
7
|
+
* - Remove entities from the selection
|
|
8
|
+
* - Clear all selections
|
|
9
|
+
* - Query selection state and count
|
|
10
|
+
* - Listen for selection change events
|
|
11
|
+
*
|
|
12
|
+
* The selection set fires events when entities are added or removed, allowing
|
|
13
|
+
* other components (like the view) to respond to selection changes by showing
|
|
14
|
+
* grip points, updating UI, etc.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const selectionSet = new AcEdSelectionSet();
|
|
19
|
+
*
|
|
20
|
+
* // Listen for selection changes
|
|
21
|
+
* selectionSet.events.selectionAdded.addEventListener(args => {
|
|
22
|
+
* console.log('Added entities:', args.ids);
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Add entities to selection
|
|
26
|
+
* selectionSet.add(['entity1', 'entity2']);
|
|
27
|
+
*
|
|
28
|
+
* // Check selection
|
|
29
|
+
* if (selectionSet.count > 0) {
|
|
30
|
+
* console.log(`${selectionSet.count} entities selected`);
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* // Clear selection
|
|
34
|
+
* selectionSet.clear();
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
var AcEdSelectionSet = /** @class */ (function () {
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new selection set.
|
|
40
|
+
*
|
|
41
|
+
* @param ids - Optional initial array of entity IDs to include in the selection
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* // Create empty selection set
|
|
46
|
+
* const selectionSet = new AcEdSelectionSet();
|
|
47
|
+
*
|
|
48
|
+
* // Create selection set with initial entities
|
|
49
|
+
* const selectionSet = new AcEdSelectionSet(['entity1', 'entity2']);
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
function AcEdSelectionSet(ids) {
|
|
53
|
+
if (ids === void 0) { ids = []; }
|
|
54
|
+
/** Events fired when selection changes */
|
|
55
|
+
this.events = {
|
|
56
|
+
/** Fired when entities are added to the selection */
|
|
57
|
+
selectionAdded: new AcCmEventManager(),
|
|
58
|
+
/** Fired when entities are removed from the selection */
|
|
59
|
+
selectionRemoved: new AcCmEventManager()
|
|
60
|
+
};
|
|
61
|
+
this._ids = new Set(ids);
|
|
62
|
+
}
|
|
63
|
+
Object.defineProperty(AcEdSelectionSet.prototype, "ids", {
|
|
64
|
+
/**
|
|
65
|
+
* Gets an array of all selected entity IDs.
|
|
66
|
+
*
|
|
67
|
+
* @returns Array containing all selected entity IDs
|
|
68
|
+
*/
|
|
69
|
+
get: function () {
|
|
70
|
+
return Array.from(this._ids);
|
|
71
|
+
},
|
|
72
|
+
enumerable: false,
|
|
73
|
+
configurable: true
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(AcEdSelectionSet.prototype, "count", {
|
|
76
|
+
/**
|
|
77
|
+
* Gets the number of selected entities.
|
|
78
|
+
*
|
|
79
|
+
* @returns The count of selected entities
|
|
80
|
+
*/
|
|
81
|
+
get: function () {
|
|
82
|
+
return this._ids.size;
|
|
83
|
+
},
|
|
84
|
+
enumerable: false,
|
|
85
|
+
configurable: true
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* Adds one or more entities to the selection.
|
|
89
|
+
*
|
|
90
|
+
* Fires a `selectionAdded` event with the added entity IDs.
|
|
91
|
+
* Duplicate IDs are automatically handled by the internal Set.
|
|
92
|
+
*
|
|
93
|
+
* @param value - Single entity ID or array of entity IDs to add
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* // Add single entity
|
|
98
|
+
* selectionSet.add('entity1');
|
|
99
|
+
*
|
|
100
|
+
* // Add multiple entities
|
|
101
|
+
* selectionSet.add(['entity2', 'entity3', 'entity4']);
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
AcEdSelectionSet.prototype.add = function (value) {
|
|
105
|
+
var _this = this;
|
|
106
|
+
if (Array.isArray(value)) {
|
|
107
|
+
value.forEach(function (item) { return _this._ids.add(item); });
|
|
108
|
+
this.events.selectionAdded.dispatch({ ids: value });
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this._ids.add(value);
|
|
112
|
+
this.events.selectionAdded.dispatch({ ids: [value] });
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Removes one or more entities from the selection.
|
|
117
|
+
*
|
|
118
|
+
* Fires a `selectionRemoved` event with the removed entity IDs.
|
|
119
|
+
* Non-existent IDs are silently ignored.
|
|
120
|
+
*
|
|
121
|
+
* @param value - Single entity ID or array of entity IDs to remove
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* // Remove single entity
|
|
126
|
+
* selectionSet.delete('entity1');
|
|
127
|
+
*
|
|
128
|
+
* // Remove multiple entities
|
|
129
|
+
* selectionSet.delete(['entity2', 'entity3']);
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
AcEdSelectionSet.prototype.delete = function (value) {
|
|
133
|
+
var _this = this;
|
|
134
|
+
if (Array.isArray(value)) {
|
|
135
|
+
value.forEach(function (item) { return _this._ids.delete(item); });
|
|
136
|
+
this.events.selectionRemoved.dispatch({ ids: value });
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
this._ids.delete(value);
|
|
140
|
+
this.events.selectionRemoved.dispatch({ ids: [value] });
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Checks if an entity is currently selected.
|
|
145
|
+
*
|
|
146
|
+
* @param id - The entity ID to check
|
|
147
|
+
* @returns True if the entity is selected, false otherwise
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* if (selectionSet.has('entity1')) {
|
|
152
|
+
* console.log('Entity1 is selected');
|
|
153
|
+
* }
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
AcEdSelectionSet.prototype.has = function (id) {
|
|
157
|
+
return this._ids.has(id);
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Removes all entities from the selection.
|
|
161
|
+
*
|
|
162
|
+
* Fires a `selectionRemoved` event with all previously selected entity IDs.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* selectionSet.clear(); // Deselect everything
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
AcEdSelectionSet.prototype.clear = function () {
|
|
170
|
+
if (this._ids.size > 0) {
|
|
171
|
+
var ids = Array.from(this._ids);
|
|
172
|
+
this._ids.clear();
|
|
173
|
+
this.events.selectionRemoved.dispatch({ ids: ids });
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
return AcEdSelectionSet;
|
|
177
|
+
}());
|
|
178
|
+
export { AcEdSelectionSet };
|
|
179
|
+
//# sourceMappingURL=AcEdSelectionSet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdSelectionSet.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdSelectionSet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAaxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH;IAYE;;;;;;;;;;;;;OAaG;IACH,0BAAY,GAAwB;QAAxB,oBAAA,EAAA,QAAwB;QAtBpC,0CAA0C;QAC1B,WAAM,GAAG;YACvB,qDAAqD;YACrD,cAAc,EAAE,IAAI,gBAAgB,EAA0B;YAC9D,yDAAyD;YACzD,gBAAgB,EAAE,IAAI,gBAAgB,EAA0B;SACjE,CAAA;QAiBC,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,CAAe,GAAG,CAAC,CAAA;IACxC,CAAC;IAOD,sBAAI,iCAAG;QALP;;;;WAIG;aACH;YACE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC9B,CAAC;;;OAAA;IAOD,sBAAI,mCAAK;QALT;;;;WAIG;aACH;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;QACvB,CAAC;;;OAAA;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,8BAAG,GAAH,UAAI,KAAoC;QAAxC,iBAQC;QAPC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI,IAAI,OAAA,KAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAnB,CAAmB,CAAC,CAAA;YAC1C,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAA;QACrD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;YACpB,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QACvD,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,iCAAM,GAAN,UAAO,KAAoC;QAA3C,iBAQC;QAPC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI,IAAI,OAAA,KAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAtB,CAAsB,CAAC,CAAA;YAC7C,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAA;QACvD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACvB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QACzD,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,8BAAG,GAAH,UAAI,EAAgB;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC;IAED;;;;;;;;;OASG;IACH,gCAAK,GAAL;QACE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACvB,IAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACjC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;YACjB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,GAAG,KAAA,EAAE,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;IACH,uBAAC;AAAD,CAAC,AAxID,IAwIC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { AcEdBaseView } from '../view/AcEdBaseView';
|
|
2
|
+
import { AcEdCorsorType } from './AcEdCursorManager';
|
|
3
|
+
/**
|
|
4
|
+
* Advanced input handler for CAD operations providing high-level user interaction methods.
|
|
5
|
+
*
|
|
6
|
+
* This class serves as a wrapper for all types of user input including:
|
|
7
|
+
* - Point input (mouse clicks, coordinates)
|
|
8
|
+
* - Entity selection (single or multiple entities)
|
|
9
|
+
* - String, number, angle, and distance input
|
|
10
|
+
* - Cursor management and visual feedback
|
|
11
|
+
*
|
|
12
|
+
* The editor abstracts away low-level mouse and keyboard events, providing a clean API
|
|
13
|
+
* for command implementations. Instead of listening to raw DOM events, commands should
|
|
14
|
+
* use the methods provided by this class.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Get user input for a point
|
|
19
|
+
* const point = await editor.getPoint();
|
|
20
|
+
* console.log('User clicked at:', point);
|
|
21
|
+
*
|
|
22
|
+
* // Get entity selection
|
|
23
|
+
* const selection = await editor.getSelection();
|
|
24
|
+
* console.log('Selected entities:', selection.ids);
|
|
25
|
+
*
|
|
26
|
+
* // Change cursor appearance
|
|
27
|
+
* editor.setCursor(AcEdCorsorType.Crosshair);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare class AcEditor {
|
|
31
|
+
/** Previously set cursor type for restoration */
|
|
32
|
+
private _previousCursor?;
|
|
33
|
+
/** Currently active cursor type */
|
|
34
|
+
private _currentCursor?;
|
|
35
|
+
/** Manager for cursor appearance and behavior */
|
|
36
|
+
private _cursorManager;
|
|
37
|
+
/** The view this editor is associated with */
|
|
38
|
+
protected _view: AcEdBaseView;
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new editor instance for the specified view.
|
|
41
|
+
*
|
|
42
|
+
* @param view - The view that this editor will handle input for
|
|
43
|
+
*/
|
|
44
|
+
constructor(view: AcEdBaseView);
|
|
45
|
+
/**
|
|
46
|
+
* Gets the currently active cursor type.
|
|
47
|
+
*
|
|
48
|
+
* @returns The current cursor type, or undefined if none is set
|
|
49
|
+
*/
|
|
50
|
+
get currentCursor(): AcEdCorsorType | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Restores the previously set cursor.
|
|
53
|
+
*
|
|
54
|
+
* This is useful for temporarily changing the cursor and then reverting
|
|
55
|
+
* to the previous state.
|
|
56
|
+
*/
|
|
57
|
+
restoreCursor(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Sets the cursor appearance for the view.
|
|
60
|
+
*
|
|
61
|
+
* The previous cursor type is stored for potential restoration.
|
|
62
|
+
*
|
|
63
|
+
* @param cursorType - The cursor type to set
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* editor.setCursor(AcEdCorsorType.Crosshair); // For precise point input
|
|
68
|
+
* editor.setCursor(AcEdCorsorType.Grab); // For pan operations
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
setCursor(cursorType: AcEdCorsorType): void;
|
|
72
|
+
/**
|
|
73
|
+
* Prompts the user to input a point by clicking on the view.
|
|
74
|
+
*
|
|
75
|
+
* This method returns a promise that resolves when the user clicks
|
|
76
|
+
* on the view, providing the world coordinates of the click point.
|
|
77
|
+
*
|
|
78
|
+
* @returns Promise that resolves to the input point coordinates
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* const startPoint = await editor.getPoint();
|
|
83
|
+
* const endPoint = await editor.getPoint();
|
|
84
|
+
* // Now you can create a line from startPoint to endPoint
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
getPoint(): Promise<import("@mlightcad/geometry-engine").AcGePoint2d>;
|
|
88
|
+
/**
|
|
89
|
+
* Prompts the user to select entities using box selection.
|
|
90
|
+
*
|
|
91
|
+
* This method allows the user to drag a selection box to select
|
|
92
|
+
* multiple entities at once. The selection behavior follows CAD
|
|
93
|
+
* conventions (left-to-right for crossing, right-to-left for window).
|
|
94
|
+
*
|
|
95
|
+
* @returns Promise that resolves to the selection set containing selected entity IDs
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* const selection = await editor.getSelection();
|
|
100
|
+
* if (selection.count > 0) {
|
|
101
|
+
* console.log(`Selected ${selection.count} entities`);
|
|
102
|
+
* // Process the selected entities
|
|
103
|
+
* for (const id of selection.ids) {
|
|
104
|
+
* // Do something with each selected entity
|
|
105
|
+
* }
|
|
106
|
+
* }
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
getSelection(): Promise<import("@mlightcad/geometry-engine").AcGeBox2d>;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=AcEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD,OAAO,EAAE,cAAc,EAAqB,MAAM,qBAAqB,CAAA;AAGvE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,QAAQ;IACnB,iDAAiD;IACjD,OAAO,CAAC,eAAe,CAAC,CAAgB;IACxC,mCAAmC;IACnC,OAAO,CAAC,cAAc,CAAC,CAAgB;IACvC,iDAAiD;IACjD,OAAO,CAAC,cAAc,CAAmB;IACzC,8CAA8C;IAC9C,SAAS,CAAC,KAAK,EAAE,YAAY,CAAA;IAE7B;;;;OAIG;gBACS,IAAI,EAAE,YAAY;IAK9B;;;;OAIG;IACH,IAAI,aAAa,+BAEhB;IAED;;;;;OAKG;IACH,aAAa;IAMb;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,UAAU,EAAE,cAAc;IAMpC;;;;;;;;;;;;;;OAcG;IACG,QAAQ;IAKd;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,YAAY;CAInB"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
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);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { AcEdBoxSelector } from './AcEdBoxSelector';
|
|
38
|
+
import { AcEdCursorManager } from './AcEdCursorManager';
|
|
39
|
+
import { AcEdInputPoint } from './AcEdInputPoint';
|
|
40
|
+
/**
|
|
41
|
+
* Advanced input handler for CAD operations providing high-level user interaction methods.
|
|
42
|
+
*
|
|
43
|
+
* This class serves as a wrapper for all types of user input including:
|
|
44
|
+
* - Point input (mouse clicks, coordinates)
|
|
45
|
+
* - Entity selection (single or multiple entities)
|
|
46
|
+
* - String, number, angle, and distance input
|
|
47
|
+
* - Cursor management and visual feedback
|
|
48
|
+
*
|
|
49
|
+
* The editor abstracts away low-level mouse and keyboard events, providing a clean API
|
|
50
|
+
* for command implementations. Instead of listening to raw DOM events, commands should
|
|
51
|
+
* use the methods provided by this class.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* // Get user input for a point
|
|
56
|
+
* const point = await editor.getPoint();
|
|
57
|
+
* console.log('User clicked at:', point);
|
|
58
|
+
*
|
|
59
|
+
* // Get entity selection
|
|
60
|
+
* const selection = await editor.getSelection();
|
|
61
|
+
* console.log('Selected entities:', selection.ids);
|
|
62
|
+
*
|
|
63
|
+
* // Change cursor appearance
|
|
64
|
+
* editor.setCursor(AcEdCorsorType.Crosshair);
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
var AcEditor = /** @class */ (function () {
|
|
68
|
+
/**
|
|
69
|
+
* Creates a new editor instance for the specified view.
|
|
70
|
+
*
|
|
71
|
+
* @param view - The view that this editor will handle input for
|
|
72
|
+
*/
|
|
73
|
+
function AcEditor(view) {
|
|
74
|
+
this._view = view;
|
|
75
|
+
this._cursorManager = new AcEdCursorManager();
|
|
76
|
+
}
|
|
77
|
+
Object.defineProperty(AcEditor.prototype, "currentCursor", {
|
|
78
|
+
/**
|
|
79
|
+
* Gets the currently active cursor type.
|
|
80
|
+
*
|
|
81
|
+
* @returns The current cursor type, or undefined if none is set
|
|
82
|
+
*/
|
|
83
|
+
get: function () {
|
|
84
|
+
return this._currentCursor;
|
|
85
|
+
},
|
|
86
|
+
enumerable: false,
|
|
87
|
+
configurable: true
|
|
88
|
+
});
|
|
89
|
+
/**
|
|
90
|
+
* Restores the previously set cursor.
|
|
91
|
+
*
|
|
92
|
+
* This is useful for temporarily changing the cursor and then reverting
|
|
93
|
+
* to the previous state.
|
|
94
|
+
*/
|
|
95
|
+
AcEditor.prototype.restoreCursor = function () {
|
|
96
|
+
if (this._previousCursor != null) {
|
|
97
|
+
this.setCursor(this._previousCursor);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Sets the cursor appearance for the view.
|
|
102
|
+
*
|
|
103
|
+
* The previous cursor type is stored for potential restoration.
|
|
104
|
+
*
|
|
105
|
+
* @param cursorType - The cursor type to set
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* editor.setCursor(AcEdCorsorType.Crosshair); // For precise point input
|
|
110
|
+
* editor.setCursor(AcEdCorsorType.Grab); // For pan operations
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
AcEditor.prototype.setCursor = function (cursorType) {
|
|
114
|
+
this._cursorManager.setCursor(cursorType, this._view.canvas);
|
|
115
|
+
this._previousCursor = this._currentCursor;
|
|
116
|
+
this._currentCursor = cursorType;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Prompts the user to input a point by clicking on the view.
|
|
120
|
+
*
|
|
121
|
+
* This method returns a promise that resolves when the user clicks
|
|
122
|
+
* on the view, providing the world coordinates of the click point.
|
|
123
|
+
*
|
|
124
|
+
* @returns Promise that resolves to the input point coordinates
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const startPoint = await editor.getPoint();
|
|
129
|
+
* const endPoint = await editor.getPoint();
|
|
130
|
+
* // Now you can create a line from startPoint to endPoint
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
AcEditor.prototype.getPoint = function () {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
135
|
+
var inputter;
|
|
136
|
+
return __generator(this, function (_a) {
|
|
137
|
+
switch (_a.label) {
|
|
138
|
+
case 0:
|
|
139
|
+
inputter = new AcEdInputPoint(this._view);
|
|
140
|
+
return [4 /*yield*/, inputter.start()];
|
|
141
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Prompts the user to select entities using box selection.
|
|
148
|
+
*
|
|
149
|
+
* This method allows the user to drag a selection box to select
|
|
150
|
+
* multiple entities at once. The selection behavior follows CAD
|
|
151
|
+
* conventions (left-to-right for crossing, right-to-left for window).
|
|
152
|
+
*
|
|
153
|
+
* @returns Promise that resolves to the selection set containing selected entity IDs
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* const selection = await editor.getSelection();
|
|
158
|
+
* if (selection.count > 0) {
|
|
159
|
+
* console.log(`Selected ${selection.count} entities`);
|
|
160
|
+
* // Process the selected entities
|
|
161
|
+
* for (const id of selection.ids) {
|
|
162
|
+
* // Do something with each selected entity
|
|
163
|
+
* }
|
|
164
|
+
* }
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
AcEditor.prototype.getSelection = function () {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
169
|
+
var selector;
|
|
170
|
+
return __generator(this, function (_a) {
|
|
171
|
+
switch (_a.label) {
|
|
172
|
+
case 0:
|
|
173
|
+
selector = new AcEdBoxSelector(this._view);
|
|
174
|
+
return [4 /*yield*/, selector.start()];
|
|
175
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
return AcEditor;
|
|
181
|
+
}());
|
|
182
|
+
export { AcEditor };
|
|
183
|
+
//# sourceMappingURL=AcEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEditor.js","sourceRoot":"","sources":["../../../src/editor/input/AcEditor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAkB,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;IAUE;;;;OAIG;IACH,kBAAY,IAAkB;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,cAAc,GAAG,IAAI,iBAAiB,EAAE,CAAA;IAC/C,CAAC;IAOD,sBAAI,mCAAa;QALjB;;;;WAIG;aACH;YACE,OAAO,IAAI,CAAC,cAAc,CAAA;QAC5B,CAAC;;;OAAA;IAED;;;;;OAKG;IACH,gCAAa,GAAb;QACE,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,EAAE,CAAC;YACjC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,4BAAS,GAAT,UAAU,UAA0B;QAClC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QAC5D,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,cAAc,CAAA;QAC1C,IAAI,CAAC,cAAc,GAAG,UAAU,CAAA;IAClC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACG,2BAAQ,GAAd;;;;;;wBACQ,QAAQ,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;wBACxC,qBAAM,QAAQ,CAAC,KAAK,EAAE,EAAA;4BAA7B,sBAAO,SAAsB,EAAA;;;;KAC9B;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,+BAAY,GAAlB;;;;;;wBACQ,QAAQ,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;wBACzC,qBAAM,QAAQ,CAAC,KAAK,EAAE,EAAA;4BAA7B,sBAAO,SAAsB,EAAA;;;;KAC9B;IACH,eAAC;AAAD,CAAC,AAzGD,IAyGC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/input/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/editor/input/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA"}
|