@mlightcad/cad-simple-viewer 1.2.4 → 1.2.5
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 +11406 -8892
- package/dist/index.umd.cjs +314 -24
- package/dist/libredwg-parser-worker.js +7267 -7238
- package/dist/mtext-renderer-worker.js +32 -9
- package/lib/app/AcApDocManager.d.ts +20 -3
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +66 -11
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/app/AcApProgress.d.ts +133 -0
- package/lib/app/AcApProgress.d.ts.map +1 -0
- package/lib/app/AcApProgress.js +148 -0
- package/lib/app/AcApProgress.js.map +1 -0
- package/lib/app/AcApSettingManager.d.ts +42 -0
- package/lib/app/AcApSettingManager.d.ts.map +1 -1
- package/lib/app/AcApSettingManager.js +63 -0
- package/lib/app/AcApSettingManager.js.map +1 -1
- package/lib/app/index.d.ts +0 -1
- package/lib/app/index.d.ts.map +1 -1
- package/lib/app/index.js +0 -1
- package/lib/app/index.js.map +1 -1
- package/lib/command/AcApCircleCmd.d.ts +21 -0
- package/lib/command/AcApCircleCmd.d.ts.map +1 -0
- package/lib/command/AcApCircleCmd.js +115 -0
- package/lib/command/AcApCircleCmd.js.map +1 -0
- package/lib/command/AcApDimCmd.d.ts +57 -0
- package/lib/command/AcApDimCmd.d.ts.map +1 -0
- package/lib/command/AcApDimCmd.js +228 -0
- package/lib/command/AcApDimCmd.js.map +1 -0
- package/lib/command/AcApLogCmd.d.ts +13 -0
- package/lib/command/AcApLogCmd.d.ts.map +1 -0
- package/lib/command/AcApLogCmd.js +97 -0
- package/lib/command/AcApLogCmd.js.map +1 -0
- package/lib/command/AcApSysVarCmd.d.ts +15 -0
- package/lib/command/AcApSysVarCmd.d.ts.map +1 -0
- package/lib/command/AcApSysVarCmd.js +94 -0
- package/lib/command/AcApSysVarCmd.js.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts +0 -36
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -1
- package/lib/command/AcApZoomToBoxCmd.js +4 -61
- package/lib/command/AcApZoomToBoxCmd.js.map +1 -1
- package/lib/command/index.d.ts +4 -0
- package/lib/command/index.d.ts.map +1 -1
- package/lib/command/index.js +4 -0
- package/lib/command/index.js.map +1 -1
- package/lib/editor/command/AcEdCommandStack.d.ts +19 -1
- package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -1
- package/lib/editor/command/AcEdCommandStack.js +40 -0
- package/lib/editor/command/AcEdCommandStack.js.map +1 -1
- package/lib/editor/input/AcEdCursorManager.d.ts +14 -30
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
- package/lib/editor/input/AcEdCursorManager.js +32 -31
- package/lib/editor/input/AcEdCursorManager.js.map +1 -1
- package/lib/editor/input/AcEdPreviewJig.d.ts +103 -0
- package/lib/editor/input/AcEdPreviewJig.d.ts.map +1 -0
- package/lib/editor/input/AcEdPreviewJig.js +82 -0
- package/lib/editor/input/AcEdPreviewJig.js.map +1 -0
- package/lib/editor/input/AcEditor.d.ts +58 -11
- package/lib/editor/input/AcEditor.d.ts.map +1 -1
- package/lib/editor/input/AcEditor.js +86 -22
- package/lib/editor/input/AcEditor.js.map +1 -1
- package/lib/editor/input/handler/AcEdAngleHandler.d.ts +12 -0
- package/lib/editor/input/handler/AcEdAngleHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdAngleHandler.js +25 -0
- package/lib/editor/input/handler/AcEdAngleHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdDistanceHandler.d.ts +8 -0
- package/lib/editor/input/handler/AcEdDistanceHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdDistanceHandler.js +29 -0
- package/lib/editor/input/handler/AcEdDistanceHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdDoubleHandler.d.ts +7 -0
- package/lib/editor/input/handler/AcEdDoubleHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdDoubleHandler.js +28 -0
- package/lib/editor/input/handler/AcEdDoubleHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdInputHandler.d.ts +14 -0
- package/lib/editor/input/handler/AcEdInputHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdInputHandler.js +2 -0
- package/lib/editor/input/handler/AcEdInputHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdIntegerHandler.d.ts +11 -0
- package/lib/editor/input/handler/AcEdIntegerHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdIntegerHandler.js +44 -0
- package/lib/editor/input/handler/AcEdIntegerHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdNumericalHandler.d.ts +11 -0
- package/lib/editor/input/handler/AcEdNumericalHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdNumericalHandler.js +24 -0
- package/lib/editor/input/handler/AcEdNumericalHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdPointHandler.d.ts +16 -0
- package/lib/editor/input/handler/AcEdPointHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdPointHandler.js +19 -0
- package/lib/editor/input/handler/AcEdPointHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdStringHandler.d.ts +12 -0
- package/lib/editor/input/handler/AcEdStringHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdStringHandler.js +24 -0
- package/lib/editor/input/handler/AcEdStringHandler.js.map +1 -0
- package/lib/editor/input/handler/index.d.ts +9 -0
- package/lib/editor/input/handler/index.d.ts.map +1 -0
- package/lib/editor/input/handler/index.js +9 -0
- package/lib/editor/input/handler/index.js.map +1 -0
- package/lib/editor/input/index.d.ts +4 -1
- package/lib/editor/input/index.d.ts.map +1 -1
- package/lib/editor/input/index.js +4 -1
- package/lib/editor/input/index.js.map +1 -1
- package/lib/editor/input/marker/AcEdMarker.d.ts +72 -0
- package/lib/editor/input/marker/AcEdMarker.d.ts.map +1 -0
- package/lib/editor/input/marker/AcEdMarker.js +124 -0
- package/lib/editor/input/marker/AcEdMarker.js.map +1 -0
- package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts +52 -0
- package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts.map +1 -0
- package/lib/editor/input/marker/AcEdOSnapMarkerManager.js +91 -0
- package/lib/editor/input/marker/AcEdOSnapMarkerManager.js.map +1 -0
- package/lib/editor/input/marker/index.d.ts +3 -0
- package/lib/editor/input/marker/index.d.ts.map +1 -0
- package/lib/editor/input/marker/index.js +3 -0
- package/lib/editor/input/marker/index.js.map +1 -0
- package/lib/editor/input/prompt/AcEdKeyword.d.ts +63 -0
- package/lib/editor/input/prompt/AcEdKeyword.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdKeyword.js +120 -0
- package/lib/editor/input/prompt/AcEdKeyword.js.map +1 -0
- package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts +52 -0
- package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdKeywordCollection.js +103 -0
- package/lib/editor/input/prompt/AcEdKeywordCollection.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts +75 -0
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.js +182 -0
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.d.ts +46 -0
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.js +114 -0
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptDoubleOptions.d.ts +10 -0
- package/lib/editor/input/prompt/AcEdPromptDoubleOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptDoubleOptions.js +31 -0
- package/lib/editor/input/prompt/AcEdPromptDoubleOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptIntegerOptions.d.ts +39 -0
- package/lib/editor/input/prompt/AcEdPromptIntegerOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptIntegerOptions.js +84 -0
- package/lib/editor/input/prompt/AcEdPromptIntegerOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts +59 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js +140 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalResult.d.ts +19 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalResult.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalResult.js +36 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalResult.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptOptions.d.ts +61 -0
- package/lib/editor/input/prompt/AcEdPromptOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptOptions.js +179 -0
- package/lib/editor/input/prompt/AcEdPromptOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts +46 -0
- package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptPointOptions.js +113 -0
- package/lib/editor/input/prompt/AcEdPromptPointOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptPointResult.d.ts +25 -0
- package/lib/editor/input/prompt/AcEdPromptPointResult.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptPointResult.js +38 -0
- package/lib/editor/input/prompt/AcEdPromptPointResult.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptResult.d.ts +27 -0
- package/lib/editor/input/prompt/AcEdPromptResult.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptResult.js +19 -0
- package/lib/editor/input/prompt/AcEdPromptResult.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptStatus.d.ts +22 -0
- package/lib/editor/input/prompt/AcEdPromptStatus.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptStatus.js +23 -0
- package/lib/editor/input/prompt/AcEdPromptStatus.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts +54 -0
- package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptStringOptions.js +124 -0
- package/lib/editor/input/prompt/AcEdPromptStringOptions.js.map +1 -0
- package/lib/editor/input/prompt/index.d.ts +11 -0
- package/lib/editor/input/prompt/index.d.ts.map +1 -0
- package/lib/editor/input/prompt/index.js +11 -0
- package/lib/editor/input/prompt/index.js.map +1 -0
- package/lib/editor/input/ui/AcEdCommandLine.d.ts +114 -0
- package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdCommandLine.js +453 -0
- package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts +151 -0
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInput.js +239 -0
- package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts +60 -0
- package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInputBox.js +113 -0
- package/lib/editor/input/ui/AcEdFloatingInputBox.js.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts +104 -0
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.js +154 -0
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.js.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +113 -0
- package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInputTypes.js +2 -0
- package/lib/editor/input/ui/AcEdFloatingInputTypes.js.map +1 -0
- package/lib/editor/input/ui/AcEdInputManager.d.ts +132 -0
- package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdInputManager.js +477 -0
- package/lib/editor/input/ui/AcEdInputManager.js.map +1 -0
- package/lib/editor/input/ui/AcEdRubberBand.d.ts +66 -0
- package/lib/editor/input/ui/AcEdRubberBand.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdRubberBand.js +276 -0
- package/lib/editor/input/ui/AcEdRubberBand.js.map +1 -0
- package/lib/editor/input/ui/index.d.ts +3 -0
- package/lib/editor/input/ui/index.d.ts.map +1 -0
- package/lib/editor/input/ui/index.js +3 -0
- package/lib/editor/input/ui/index.js.map +1 -0
- package/lib/editor/view/AcEdBaseView.d.ts +35 -11
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
- package/lib/editor/view/AcEdBaseView.js +14 -11
- package/lib/editor/view/AcEdBaseView.js.map +1 -1
- package/lib/i18n/AcApI18n.d.ts +135 -0
- package/lib/i18n/AcApI18n.d.ts.map +1 -0
- package/lib/i18n/AcApI18n.js +208 -0
- package/lib/i18n/AcApI18n.js.map +1 -0
- package/lib/i18n/en/command.d.ts +18 -0
- package/lib/i18n/en/command.d.ts.map +1 -0
- package/lib/i18n/en/command.js +17 -0
- package/lib/i18n/en/command.js.map +1 -0
- package/lib/i18n/en/jig.d.ts +11 -0
- package/lib/i18n/en/jig.d.ts.map +1 -0
- package/lib/i18n/en/jig.js +10 -0
- package/lib/i18n/en/jig.js.map +1 -0
- package/lib/i18n/en/main.d.ts +37 -0
- package/lib/i18n/en/main.d.ts.map +1 -0
- package/lib/i18n/en/main.js +36 -0
- package/lib/i18n/en/main.js.map +1 -0
- package/lib/i18n/index.d.ts +6 -0
- package/lib/i18n/index.d.ts.map +1 -0
- package/lib/i18n/index.js +31 -0
- package/lib/i18n/index.js.map +1 -0
- package/lib/i18n/zh/command.d.ts +18 -0
- package/lib/i18n/zh/command.d.ts.map +1 -0
- package/lib/i18n/zh/command.js +17 -0
- package/lib/i18n/zh/command.js.map +1 -0
- package/lib/i18n/zh/jig.d.ts +11 -0
- package/lib/i18n/zh/jig.d.ts.map +1 -0
- package/lib/i18n/zh/jig.js +10 -0
- package/lib/i18n/zh/jig.js.map +1 -0
- package/lib/i18n/zh/main.d.ts +37 -0
- package/lib/i18n/zh/main.d.ts.map +1 -0
- package/lib/i18n/zh/main.js +36 -0
- package/lib/i18n/zh/main.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/view/AcTrScene.d.ts +19 -6
- package/lib/view/AcTrScene.d.ts.map +1 -1
- package/lib/view/AcTrScene.js +25 -6
- package/lib/view/AcTrScene.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +11 -1
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +73 -35
- package/lib/view/AcTrView2d.js.map +1 -1
- package/package.json +7 -7
- package/lib/editor/input/AcEdBaseInput.d.ts +0 -89
- package/lib/editor/input/AcEdBaseInput.d.ts.map +0 -1
- package/lib/editor/input/AcEdBaseInput.js +0 -166
- package/lib/editor/input/AcEdBaseInput.js.map +0 -1
- package/lib/editor/input/AcEdBoxSelector.d.ts +0 -108
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +0 -1
- package/lib/editor/input/AcEdBoxSelector.js +0 -220
- package/lib/editor/input/AcEdBoxSelector.js.map +0 -1
- package/lib/editor/input/AcEdInputPoint.d.ts +0 -51
- package/lib/editor/input/AcEdInputPoint.d.ts.map +0 -1
- package/lib/editor/input/AcEdInputPoint.js +0 -78
- package/lib/editor/input/AcEdInputPoint.js.map +0 -1
- package/lib/editor/input/AcEdJig.d.ts +0 -180
- package/lib/editor/input/AcEdJig.d.ts.map +0 -1
- package/lib/editor/input/AcEdJig.js +0 -256
- package/lib/editor/input/AcEdJig.js.map +0 -1
- package/lib/editor/input/AcEdJigLoop.d.ts +0 -63
- package/lib/editor/input/AcEdJigLoop.d.ts.map +0 -1
- package/lib/editor/input/AcEdJigLoop.js +0 -91
- package/lib/editor/input/AcEdJigLoop.js.map +0 -1
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { AcEdBaseView } from '../view';
|
|
2
|
-
/**
|
|
3
|
-
* Base class for interactive drawing operations (jigs) in the CAD editor.
|
|
4
|
-
*
|
|
5
|
-
* A jig is an interactive operation that allows users to dynamically preview
|
|
6
|
-
* and modify geometric elements during creation. Common examples include:
|
|
7
|
-
* - Drawing lines with real-time preview as the mouse moves
|
|
8
|
-
* - Selecting rectangular areas with visual feedback
|
|
9
|
-
* - Dynamic entity placement with instant visual updates
|
|
10
|
-
*
|
|
11
|
-
* The jig system provides:
|
|
12
|
-
* - Real-time visual feedback during user interaction
|
|
13
|
-
* - Event-driven updates based on mouse movement
|
|
14
|
-
* - Asynchronous completion handling
|
|
15
|
-
* - Cancellation and error handling
|
|
16
|
-
*
|
|
17
|
-
* @template TResult - The type of result returned when the jig completes
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* class RectangleSelectionJig extends AcEdJig<Rectangle> {
|
|
22
|
-
* private startPoint?: Point;
|
|
23
|
-
* private currentPoint?: Point;
|
|
24
|
-
*
|
|
25
|
-
* async sampler() {
|
|
26
|
-
* // Get start point
|
|
27
|
-
* this.startPoint = await this.view.editor.getPoint();
|
|
28
|
-
*
|
|
29
|
-
* // Continue updating until complete
|
|
30
|
-
* this.view.events.mouseMove.addEventListener(this.onMouseMove);
|
|
31
|
-
* }
|
|
32
|
-
*
|
|
33
|
-
* update() {
|
|
34
|
-
* if (this.startPoint && this.currentPoint) {
|
|
35
|
-
* // Update preview rectangle
|
|
36
|
-
* this.drawPreviewRectangle(this.startPoint, this.currentPoint);
|
|
37
|
-
* }
|
|
38
|
-
* }
|
|
39
|
-
*
|
|
40
|
-
* private onMouseMove = (args) => {
|
|
41
|
-
* this.currentPoint = args;
|
|
42
|
-
* // Jig loop will call update() automatically
|
|
43
|
-
* }
|
|
44
|
-
* }
|
|
45
|
-
*
|
|
46
|
-
* // Usage
|
|
47
|
-
* const jig = new RectangleSelectionJig(view);
|
|
48
|
-
* const rectangle = await jig.drag();
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
export declare class AcEdJig<TResult> {
|
|
52
|
-
/** Internal jig loop that handles the interactive operation */
|
|
53
|
-
private _jigLoop;
|
|
54
|
-
/** The view associated with this jig */
|
|
55
|
-
private _view;
|
|
56
|
-
/**
|
|
57
|
-
* Creates a new jig instance for the specified view.
|
|
58
|
-
*
|
|
59
|
-
* Sets up the jig loop and connects update event handling.
|
|
60
|
-
*
|
|
61
|
-
* @param view - The view this jig will operate in
|
|
62
|
-
*/
|
|
63
|
-
constructor(view: AcEdBaseView);
|
|
64
|
-
/**
|
|
65
|
-
* Gets the view associated with this jig.
|
|
66
|
-
*
|
|
67
|
-
* @returns The view instance
|
|
68
|
-
*/
|
|
69
|
-
get view(): AcEdBaseView;
|
|
70
|
-
/**
|
|
71
|
-
* Resolves the jig operation with the specified result.
|
|
72
|
-
*
|
|
73
|
-
* This method should be called when the jig operation completes successfully.
|
|
74
|
-
* It cleans up event listeners and resolves the underlying promise.
|
|
75
|
-
*
|
|
76
|
-
* @param result - The result to return from the jig operation
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* // In a line drawing jig, when user completes the line
|
|
81
|
-
* if (this.hasValidEndPoint()) {
|
|
82
|
-
* const line = new Line(this.startPoint, this.endPoint);
|
|
83
|
-
* this.resolve(line);
|
|
84
|
-
* }
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
resolve(result: TResult): void;
|
|
88
|
-
/**
|
|
89
|
-
* Rejects the jig operation with an error.
|
|
90
|
-
*
|
|
91
|
-
* This method should be called when the jig operation fails or is cancelled.
|
|
92
|
-
* It cleans up event listeners and rejects the underlying promise.
|
|
93
|
-
*
|
|
94
|
-
* @param reason - The reason for the rejection
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```typescript
|
|
98
|
-
* // If user cancels or invalid input is detected
|
|
99
|
-
* if (userPressedEscape) {
|
|
100
|
-
* this.reject('Operation cancelled by user');
|
|
101
|
-
* }
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
reject(reason: string): void;
|
|
105
|
-
/**
|
|
106
|
-
* Starts the interactive jig operation.
|
|
107
|
-
*
|
|
108
|
-
* This method initiates both the jig loop and the sampling process.
|
|
109
|
-
* It returns a promise that resolves when the jig operation completes
|
|
110
|
-
* or rejects if an error occurs.
|
|
111
|
-
*
|
|
112
|
-
* @returns Promise that resolves when the jig operation completes
|
|
113
|
-
*
|
|
114
|
-
* @example
|
|
115
|
-
* ```typescript
|
|
116
|
-
* const jig = new MyCustomJig(view);
|
|
117
|
-
* try {
|
|
118
|
-
* const result = await jig.drag();
|
|
119
|
-
* console.log('Jig completed with result:', result);
|
|
120
|
-
* } catch (error) {
|
|
121
|
-
* console.log('Jig was cancelled or failed:', error);
|
|
122
|
-
* }
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
drag(): Promise<void>;
|
|
126
|
-
/**
|
|
127
|
-
* Abstract method for handling jig input sampling.
|
|
128
|
-
*
|
|
129
|
-
* This method should be overridden by subclasses to implement
|
|
130
|
-
* the specific input handling logic for the jig. It typically:
|
|
131
|
-
* - Gets initial user input (like a start point)
|
|
132
|
-
* - Sets up event listeners for dynamic updates
|
|
133
|
-
* - Handles user interaction until completion
|
|
134
|
-
*
|
|
135
|
-
* The sampler runs concurrently with the jig loop and should
|
|
136
|
-
* call `resolve()` or `reject()` when the operation completes.
|
|
137
|
-
*
|
|
138
|
-
* @example
|
|
139
|
-
* ```typescript
|
|
140
|
-
* async sampler() {
|
|
141
|
-
* // Get initial point
|
|
142
|
-
* const startPoint = await this.view.editor.getPoint();
|
|
143
|
-
*
|
|
144
|
-
* // Set up mouse tracking for dynamic preview
|
|
145
|
-
* this.view.events.mouseMove.addEventListener(this.onMouseMove);
|
|
146
|
-
* this.view.events.mouseClick.addEventListener(this.onMouseClick);
|
|
147
|
-
* }
|
|
148
|
-
* ```
|
|
149
|
-
*/
|
|
150
|
-
sampler(): Promise<void>;
|
|
151
|
-
/**
|
|
152
|
-
* Called during each update cycle to refresh the jig display.
|
|
153
|
-
*
|
|
154
|
-
* This method should be overridden by subclasses to implement
|
|
155
|
-
* the visual update logic. It's called automatically by the jig loop
|
|
156
|
-
* whenever the display needs to be refreshed (typically on mouse movement).
|
|
157
|
-
*
|
|
158
|
-
* Common update operations include:
|
|
159
|
-
* - Redrawing preview geometry
|
|
160
|
-
* - Updating dimension displays
|
|
161
|
-
* - Refreshing visual feedback elements
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* ```typescript
|
|
165
|
-
* update() {
|
|
166
|
-
* if (this.startPoint && this.currentMousePoint) {
|
|
167
|
-
* // Clear previous preview
|
|
168
|
-
* this.clearPreview();
|
|
169
|
-
*
|
|
170
|
-
* // Draw new preview line
|
|
171
|
-
* this.drawPreviewLine(this.startPoint, this.currentMousePoint);
|
|
172
|
-
* }
|
|
173
|
-
* }
|
|
174
|
-
* ```
|
|
175
|
-
*/
|
|
176
|
-
update(): void;
|
|
177
|
-
/** Internal event handler for jig loop updates */
|
|
178
|
-
private onUpdate;
|
|
179
|
-
}
|
|
180
|
-
//# sourceMappingURL=AcEdJig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdJig.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdJig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,qBAAa,OAAO,CAAC,OAAO;IAC1B,+DAA+D;IAC/D,OAAO,CAAC,QAAQ,CAAsB;IACtC,wCAAwC;IACxC,OAAO,CAAC,KAAK,CAAc;IAE3B;;;;;;OAMG;gBACS,IAAI,EAAE,YAAY;IAM9B;;;;OAIG;IACH,IAAI,IAAI,iBAEP;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,MAAM,EAAE,OAAO;IAKvB;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM;IAKrB;;;;;;;;;;;;;;;;;;;OAmBG;IACG,IAAI;IAMV;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,OAAO;IAIb;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM;IAIN,kDAAkD;IAClD,OAAO,CAAC,QAAQ,CAEf;CACF"}
|
|
@@ -1,256 +0,0 @@
|
|
|
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 { AcEdJigLoop } from './AcEdJigLoop';
|
|
38
|
-
/**
|
|
39
|
-
* Base class for interactive drawing operations (jigs) in the CAD editor.
|
|
40
|
-
*
|
|
41
|
-
* A jig is an interactive operation that allows users to dynamically preview
|
|
42
|
-
* and modify geometric elements during creation. Common examples include:
|
|
43
|
-
* - Drawing lines with real-time preview as the mouse moves
|
|
44
|
-
* - Selecting rectangular areas with visual feedback
|
|
45
|
-
* - Dynamic entity placement with instant visual updates
|
|
46
|
-
*
|
|
47
|
-
* The jig system provides:
|
|
48
|
-
* - Real-time visual feedback during user interaction
|
|
49
|
-
* - Event-driven updates based on mouse movement
|
|
50
|
-
* - Asynchronous completion handling
|
|
51
|
-
* - Cancellation and error handling
|
|
52
|
-
*
|
|
53
|
-
* @template TResult - The type of result returned when the jig completes
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```typescript
|
|
57
|
-
* class RectangleSelectionJig extends AcEdJig<Rectangle> {
|
|
58
|
-
* private startPoint?: Point;
|
|
59
|
-
* private currentPoint?: Point;
|
|
60
|
-
*
|
|
61
|
-
* async sampler() {
|
|
62
|
-
* // Get start point
|
|
63
|
-
* this.startPoint = await this.view.editor.getPoint();
|
|
64
|
-
*
|
|
65
|
-
* // Continue updating until complete
|
|
66
|
-
* this.view.events.mouseMove.addEventListener(this.onMouseMove);
|
|
67
|
-
* }
|
|
68
|
-
*
|
|
69
|
-
* update() {
|
|
70
|
-
* if (this.startPoint && this.currentPoint) {
|
|
71
|
-
* // Update preview rectangle
|
|
72
|
-
* this.drawPreviewRectangle(this.startPoint, this.currentPoint);
|
|
73
|
-
* }
|
|
74
|
-
* }
|
|
75
|
-
*
|
|
76
|
-
* private onMouseMove = (args) => {
|
|
77
|
-
* this.currentPoint = args;
|
|
78
|
-
* // Jig loop will call update() automatically
|
|
79
|
-
* }
|
|
80
|
-
* }
|
|
81
|
-
*
|
|
82
|
-
* // Usage
|
|
83
|
-
* const jig = new RectangleSelectionJig(view);
|
|
84
|
-
* const rectangle = await jig.drag();
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
var AcEdJig = /** @class */ (function () {
|
|
88
|
-
/**
|
|
89
|
-
* Creates a new jig instance for the specified view.
|
|
90
|
-
*
|
|
91
|
-
* Sets up the jig loop and connects update event handling.
|
|
92
|
-
*
|
|
93
|
-
* @param view - The view this jig will operate in
|
|
94
|
-
*/
|
|
95
|
-
function AcEdJig(view) {
|
|
96
|
-
var _this = this;
|
|
97
|
-
/** Internal event handler for jig loop updates */
|
|
98
|
-
this.onUpdate = function () {
|
|
99
|
-
_this.update();
|
|
100
|
-
};
|
|
101
|
-
this._view = view;
|
|
102
|
-
this._jigLoop = new AcEdJigLoop(view);
|
|
103
|
-
this._jigLoop.events.update.addEventListener(this.onUpdate);
|
|
104
|
-
}
|
|
105
|
-
Object.defineProperty(AcEdJig.prototype, "view", {
|
|
106
|
-
/**
|
|
107
|
-
* Gets the view associated with this jig.
|
|
108
|
-
*
|
|
109
|
-
* @returns The view instance
|
|
110
|
-
*/
|
|
111
|
-
get: function () {
|
|
112
|
-
return this._view;
|
|
113
|
-
},
|
|
114
|
-
enumerable: false,
|
|
115
|
-
configurable: true
|
|
116
|
-
});
|
|
117
|
-
/**
|
|
118
|
-
* Resolves the jig operation with the specified result.
|
|
119
|
-
*
|
|
120
|
-
* This method should be called when the jig operation completes successfully.
|
|
121
|
-
* It cleans up event listeners and resolves the underlying promise.
|
|
122
|
-
*
|
|
123
|
-
* @param result - The result to return from the jig operation
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* ```typescript
|
|
127
|
-
* // In a line drawing jig, when user completes the line
|
|
128
|
-
* if (this.hasValidEndPoint()) {
|
|
129
|
-
* const line = new Line(this.startPoint, this.endPoint);
|
|
130
|
-
* this.resolve(line);
|
|
131
|
-
* }
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
AcEdJig.prototype.resolve = function (result) {
|
|
135
|
-
this._jigLoop.events.update.removeEventListener(this.onUpdate);
|
|
136
|
-
this._jigLoop.resolve(result);
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* Rejects the jig operation with an error.
|
|
140
|
-
*
|
|
141
|
-
* This method should be called when the jig operation fails or is cancelled.
|
|
142
|
-
* It cleans up event listeners and rejects the underlying promise.
|
|
143
|
-
*
|
|
144
|
-
* @param reason - The reason for the rejection
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* ```typescript
|
|
148
|
-
* // If user cancels or invalid input is detected
|
|
149
|
-
* if (userPressedEscape) {
|
|
150
|
-
* this.reject('Operation cancelled by user');
|
|
151
|
-
* }
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
AcEdJig.prototype.reject = function (reason) {
|
|
155
|
-
this._jigLoop.events.update.removeEventListener(this.onUpdate);
|
|
156
|
-
this._jigLoop.reject(reason);
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Starts the interactive jig operation.
|
|
160
|
-
*
|
|
161
|
-
* This method initiates both the jig loop and the sampling process.
|
|
162
|
-
* It returns a promise that resolves when the jig operation completes
|
|
163
|
-
* or rejects if an error occurs.
|
|
164
|
-
*
|
|
165
|
-
* @returns Promise that resolves when the jig operation completes
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
* ```typescript
|
|
169
|
-
* const jig = new MyCustomJig(view);
|
|
170
|
-
* try {
|
|
171
|
-
* const result = await jig.drag();
|
|
172
|
-
* console.log('Jig completed with result:', result);
|
|
173
|
-
* } catch (error) {
|
|
174
|
-
* console.log('Jig was cancelled or failed:', error);
|
|
175
|
-
* }
|
|
176
|
-
* ```
|
|
177
|
-
*/
|
|
178
|
-
AcEdJig.prototype.drag = function () {
|
|
179
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
180
|
-
var promise1, promise2;
|
|
181
|
-
return __generator(this, function (_a) {
|
|
182
|
-
switch (_a.label) {
|
|
183
|
-
case 0:
|
|
184
|
-
promise1 = this._jigLoop.start();
|
|
185
|
-
promise2 = this.sampler();
|
|
186
|
-
return [4 /*yield*/, Promise.allSettled([promise1, promise2])];
|
|
187
|
-
case 1:
|
|
188
|
-
_a.sent();
|
|
189
|
-
return [2 /*return*/];
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* Abstract method for handling jig input sampling.
|
|
196
|
-
*
|
|
197
|
-
* This method should be overridden by subclasses to implement
|
|
198
|
-
* the specific input handling logic for the jig. It typically:
|
|
199
|
-
* - Gets initial user input (like a start point)
|
|
200
|
-
* - Sets up event listeners for dynamic updates
|
|
201
|
-
* - Handles user interaction until completion
|
|
202
|
-
*
|
|
203
|
-
* The sampler runs concurrently with the jig loop and should
|
|
204
|
-
* call `resolve()` or `reject()` when the operation completes.
|
|
205
|
-
*
|
|
206
|
-
* @example
|
|
207
|
-
* ```typescript
|
|
208
|
-
* async sampler() {
|
|
209
|
-
* // Get initial point
|
|
210
|
-
* const startPoint = await this.view.editor.getPoint();
|
|
211
|
-
*
|
|
212
|
-
* // Set up mouse tracking for dynamic preview
|
|
213
|
-
* this.view.events.mouseMove.addEventListener(this.onMouseMove);
|
|
214
|
-
* this.view.events.mouseClick.addEventListener(this.onMouseClick);
|
|
215
|
-
* }
|
|
216
|
-
* ```
|
|
217
|
-
*/
|
|
218
|
-
AcEdJig.prototype.sampler = function () {
|
|
219
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
220
|
-
return __generator(this, function (_a) {
|
|
221
|
-
return [2 /*return*/];
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
};
|
|
225
|
-
/**
|
|
226
|
-
* Called during each update cycle to refresh the jig display.
|
|
227
|
-
*
|
|
228
|
-
* This method should be overridden by subclasses to implement
|
|
229
|
-
* the visual update logic. It's called automatically by the jig loop
|
|
230
|
-
* whenever the display needs to be refreshed (typically on mouse movement).
|
|
231
|
-
*
|
|
232
|
-
* Common update operations include:
|
|
233
|
-
* - Redrawing preview geometry
|
|
234
|
-
* - Updating dimension displays
|
|
235
|
-
* - Refreshing visual feedback elements
|
|
236
|
-
*
|
|
237
|
-
* @example
|
|
238
|
-
* ```typescript
|
|
239
|
-
* update() {
|
|
240
|
-
* if (this.startPoint && this.currentMousePoint) {
|
|
241
|
-
* // Clear previous preview
|
|
242
|
-
* this.clearPreview();
|
|
243
|
-
*
|
|
244
|
-
* // Draw new preview line
|
|
245
|
-
* this.drawPreviewLine(this.startPoint, this.currentMousePoint);
|
|
246
|
-
* }
|
|
247
|
-
* }
|
|
248
|
-
* ```
|
|
249
|
-
*/
|
|
250
|
-
AcEdJig.prototype.update = function () {
|
|
251
|
-
// Do nothing for now
|
|
252
|
-
};
|
|
253
|
-
return AcEdJig;
|
|
254
|
-
}());
|
|
255
|
-
export { AcEdJig };
|
|
256
|
-
//# sourceMappingURL=AcEdJig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdJig.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdJig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH;IAME;;;;;;OAMG;IACH,iBAAY,IAAkB;QAA9B,iBAIC;QAyID,kDAAkD;QAC1C,aAAQ,GAAG;YACjB,KAAI,CAAC,MAAM,EAAE,CAAA;QACf,CAAC,CAAA;QA/IC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,QAAQ,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAA;QACrC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC7D,CAAC;IAOD,sBAAI,yBAAI;QALR;;;;WAIG;aACH;YACE,OAAO,IAAI,CAAC,KAAK,CAAA;QACnB,CAAC;;;OAAA;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,yBAAO,GAAP,UAAQ,MAAe;QACrB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC9D,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IAC/B,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,wBAAM,GAAN,UAAO,MAAc;QACnB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC9D,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACG,sBAAI,GAAV;;;;;;wBACQ,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAA;wBAChC,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;wBAC/B,qBAAM,OAAO,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAA;;wBAA9C,SAA8C,CAAA;;;;;KAC/C;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,yBAAO,GAAb;;;;;;KAEC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,wBAAM,GAAN;QACE,qBAAqB;IACvB,CAAC;IAMH,cAAC;AAAD,CAAC,AA9JD,IA8JC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { AcCmEventManager, AcGePoint2d } from '@mlightcad/data-model';
|
|
2
|
-
import { AcEdBaseView } from '../view/AcEdBaseView';
|
|
3
|
-
import { AcEdBaseInput } from './AcEdBaseInput';
|
|
4
|
-
/**
|
|
5
|
-
* A specialized input class for jig operations that provides continuous mouse tracking.
|
|
6
|
-
*
|
|
7
|
-
* This class extends the base input functionality to provide real-time mouse position
|
|
8
|
-
* tracking for interactive operations like drawing previews or dynamic objects that
|
|
9
|
-
* follow the mouse cursor. It fires update events whenever the mouse moves, allowing
|
|
10
|
-
* subscribers to respond to cursor movement.
|
|
11
|
-
*
|
|
12
|
-
* Jig loops are commonly used in CAD applications for operations like:
|
|
13
|
-
* - Drawing preview lines that stretch from a fixed point to the cursor
|
|
14
|
-
* - Moving objects dynamically with the mouse
|
|
15
|
-
* - Providing visual feedback during interactive operations
|
|
16
|
-
*
|
|
17
|
-
* @template TResult - The type of result that this jig operation will return
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const jigLoop = new AcEdJigLoop<string>(view);
|
|
22
|
-
* jigLoop.events.update.subscribe(() => {
|
|
23
|
-
* // Update preview based on jigLoop.curPos
|
|
24
|
-
* console.log(`Mouse at: ${jigLoop.curPos.x}, ${jigLoop.curPos.y}`);
|
|
25
|
-
* });
|
|
26
|
-
* const result = await jigLoop.start();
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export declare class AcEdJigLoop<TResult> extends AcEdBaseInput<TResult> {
|
|
30
|
-
/** Event manager for handling mouse movement updates */
|
|
31
|
-
readonly events: {
|
|
32
|
-
/** Event fired when the mouse position updates */
|
|
33
|
-
update: AcCmEventManager<void>;
|
|
34
|
-
};
|
|
35
|
-
/** Current mouse position in screen coordinates */
|
|
36
|
-
curPos: AcGePoint2d;
|
|
37
|
-
/**
|
|
38
|
-
* Creates a new jig loop instance.
|
|
39
|
-
*
|
|
40
|
-
* @param view - The view that will handle this jig operation
|
|
41
|
-
*/
|
|
42
|
-
constructor(view: AcEdBaseView);
|
|
43
|
-
/**
|
|
44
|
-
* Activates the jig loop operation.
|
|
45
|
-
* Sets up the mouse move event listener to track cursor position.
|
|
46
|
-
* Overrides the base class to add mouse move event handling.
|
|
47
|
-
*/
|
|
48
|
-
activate(): void;
|
|
49
|
-
/**
|
|
50
|
-
* Deactivates the jig loop operation.
|
|
51
|
-
* Removes the mouse move event listener.
|
|
52
|
-
* Overrides the base class to clean up mouse move event handling.
|
|
53
|
-
*/
|
|
54
|
-
deactivate(): void;
|
|
55
|
-
/**
|
|
56
|
-
* Handles mouse move events to update the current cursor position.
|
|
57
|
-
* Updates the current position and fires the update event to notify subscribers.
|
|
58
|
-
*
|
|
59
|
-
* @param event - The mouse move event containing the new cursor position
|
|
60
|
-
*/
|
|
61
|
-
private onMouseMove;
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=AcEdJigLoop.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdJigLoop.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdJigLoop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,WAAW,CAAC,OAAO,CAAE,SAAQ,aAAa,CAAC,OAAO,CAAC;IAC9D,wDAAwD;IACxD,SAAgB,MAAM;QACpB,kDAAkD;;MAEnD;IACD,mDAAmD;IAC5C,MAAM,EAAE,WAAW,CAAA;IAE1B;;;;OAIG;gBACS,IAAI,EAAE,YAAY;IAK9B;;;;OAIG;IACH,QAAQ;IAKR;;;;OAIG;IACH,UAAU;IAKV;;;;;OAKG;IACH,OAAO,CAAC,WAAW,CAGlB;CACF"}
|
|
@@ -1,91 +0,0 @@
|
|
|
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 { AcCmEventManager, AcGePoint2d } from '@mlightcad/data-model';
|
|
17
|
-
import { AcEdBaseInput } from './AcEdBaseInput';
|
|
18
|
-
/**
|
|
19
|
-
* A specialized input class for jig operations that provides continuous mouse tracking.
|
|
20
|
-
*
|
|
21
|
-
* This class extends the base input functionality to provide real-time mouse position
|
|
22
|
-
* tracking for interactive operations like drawing previews or dynamic objects that
|
|
23
|
-
* follow the mouse cursor. It fires update events whenever the mouse moves, allowing
|
|
24
|
-
* subscribers to respond to cursor movement.
|
|
25
|
-
*
|
|
26
|
-
* Jig loops are commonly used in CAD applications for operations like:
|
|
27
|
-
* - Drawing preview lines that stretch from a fixed point to the cursor
|
|
28
|
-
* - Moving objects dynamically with the mouse
|
|
29
|
-
* - Providing visual feedback during interactive operations
|
|
30
|
-
*
|
|
31
|
-
* @template TResult - The type of result that this jig operation will return
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* const jigLoop = new AcEdJigLoop<string>(view);
|
|
36
|
-
* jigLoop.events.update.subscribe(() => {
|
|
37
|
-
* // Update preview based on jigLoop.curPos
|
|
38
|
-
* console.log(`Mouse at: ${jigLoop.curPos.x}, ${jigLoop.curPos.y}`);
|
|
39
|
-
* });
|
|
40
|
-
* const result = await jigLoop.start();
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
var AcEdJigLoop = /** @class */ (function (_super) {
|
|
44
|
-
__extends(AcEdJigLoop, _super);
|
|
45
|
-
/**
|
|
46
|
-
* Creates a new jig loop instance.
|
|
47
|
-
*
|
|
48
|
-
* @param view - The view that will handle this jig operation
|
|
49
|
-
*/
|
|
50
|
-
function AcEdJigLoop(view) {
|
|
51
|
-
var _this = _super.call(this, view) || this;
|
|
52
|
-
/** Event manager for handling mouse movement updates */
|
|
53
|
-
_this.events = {
|
|
54
|
-
/** Event fired when the mouse position updates */
|
|
55
|
-
update: new AcCmEventManager()
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Handles mouse move events to update the current cursor position.
|
|
59
|
-
* Updates the current position and fires the update event to notify subscribers.
|
|
60
|
-
*
|
|
61
|
-
* @param event - The mouse move event containing the new cursor position
|
|
62
|
-
*/
|
|
63
|
-
_this.onMouseMove = function (event) {
|
|
64
|
-
_this.curPos.set(event.clientX, event.clientY);
|
|
65
|
-
_this.events.update.dispatch();
|
|
66
|
-
};
|
|
67
|
-
_this.curPos = new AcGePoint2d();
|
|
68
|
-
return _this;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Activates the jig loop operation.
|
|
72
|
-
* Sets up the mouse move event listener to track cursor position.
|
|
73
|
-
* Overrides the base class to add mouse move event handling.
|
|
74
|
-
*/
|
|
75
|
-
AcEdJigLoop.prototype.activate = function () {
|
|
76
|
-
_super.prototype.activate.call(this);
|
|
77
|
-
this.view.canvas.addEventListener('mousemove', this.onMouseMove);
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Deactivates the jig loop operation.
|
|
81
|
-
* Removes the mouse move event listener.
|
|
82
|
-
* Overrides the base class to clean up mouse move event handling.
|
|
83
|
-
*/
|
|
84
|
-
AcEdJigLoop.prototype.deactivate = function () {
|
|
85
|
-
_super.prototype.deactivate.call(this);
|
|
86
|
-
this.view.canvas.removeEventListener('mousemove', this.onMouseMove);
|
|
87
|
-
};
|
|
88
|
-
return AcEdJigLoop;
|
|
89
|
-
}(AcEdBaseInput));
|
|
90
|
-
export { AcEdJigLoop };
|
|
91
|
-
//# sourceMappingURL=AcEdJigLoop.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdJigLoop.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdJigLoop.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGrE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IAA0C,+BAAsB;IAS9D;;;;OAIG;IACH,qBAAY,IAAkB;QAC5B,YAAA,MAAK,YAAC,IAAI,CAAC,SAAA;QAdb,wDAAwD;QACxC,YAAM,GAAG;YACvB,kDAAkD;YAClD,MAAM,EAAE,IAAI,gBAAgB,EAAQ;SACrC,CAAA;QAkCD;;;;;WAKG;QACK,iBAAW,GAAG,UAAC,KAAiB;YACtC,KAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;YAC7C,KAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAA;QAC/B,CAAC,CAAA;QAhCC,KAAI,CAAC,MAAM,GAAG,IAAI,WAAW,EAAE,CAAA;;IACjC,CAAC;IAED;;;;OAIG;IACH,8BAAQ,GAAR;QACE,gBAAK,CAAC,QAAQ,WAAE,CAAA;QAChB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IAClE,CAAC;IAED;;;;OAIG;IACH,gCAAU,GAAV;QACE,gBAAK,CAAC,UAAU,WAAE,CAAA;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IACrE,CAAC;IAYH,kBAAC;AAAD,CAAC,AAjDD,CAA0C,aAAa,GAiDtD"}
|