@mlightcad/cad-simple-viewer 1.2.4 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13000 -10094
- package/dist/index.umd.cjs +327 -24
- package/dist/libredwg-parser-worker.js +7267 -7238
- package/dist/mtext-renderer-worker.js +81 -41
- package/lib/app/AcApContext.js +1 -1
- package/lib/app/AcApContext.js.map +1 -1
- package/lib/app/AcApDocManager.d.ts +20 -3
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +67 -12
- 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/AcApZoomCmd.js +1 -1
- package/lib/command/AcApZoomCmd.js.map +1 -1
- 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 +116 -0
- package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdCommandLine.js +481 -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 +54 -16
- 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/editor/view/AcEdLayerInfo.d.ts +5 -0
- package/lib/editor/view/AcEdLayerInfo.d.ts.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/AcTrLayer.d.ts +29 -5
- package/lib/view/AcTrLayer.d.ts.map +1 -1
- package/lib/view/AcTrLayer.js +44 -6
- package/lib/view/AcTrLayer.js.map +1 -1
- package/lib/view/AcTrLayout.d.ts +13 -7
- package/lib/view/AcTrLayout.d.ts.map +1 -1
- package/lib/view/AcTrLayout.js +29 -21
- package/lib/view/AcTrLayout.js.map +1 -1
- package/lib/view/AcTrScene.d.ts +22 -8
- package/lib/view/AcTrScene.d.ts.map +1 -1
- package/lib/view/AcTrScene.js +36 -9
- package/lib/view/AcTrScene.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +19 -4
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +135 -43
- 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,89 +0,0 @@
|
|
|
1
|
-
import { AcEdBaseView } from '../view/AcEdBaseView';
|
|
2
|
-
/**
|
|
3
|
-
* The base class for all of classes to get user inputs such as string, angle, number, point, selection,
|
|
4
|
-
* and so on.
|
|
5
|
-
*
|
|
6
|
-
* This abstract class provides a common framework for handling user input operations in the CAD editor.
|
|
7
|
-
* It manages the input lifecycle including activation, deactivation, and promise-based resolution.
|
|
8
|
-
* Subclasses must implement specific input behaviors while this base class handles common functionality
|
|
9
|
-
* like keyboard event handling and promise management.
|
|
10
|
-
*
|
|
11
|
-
* @template TResult - The type of result that this input operation will return
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* class MyInput extends AcEdBaseInput<string> {
|
|
16
|
-
* // Implement specific input behavior
|
|
17
|
-
* }
|
|
18
|
-
* const input = new MyInput(view);
|
|
19
|
-
* const result = await input.start();
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
export declare abstract class AcEdBaseInput<TResult> {
|
|
25
|
-
/** The view associated with this input operation */
|
|
26
|
-
protected view: AcEdBaseView;
|
|
27
|
-
/** Whether this input is currently active */
|
|
28
|
-
protected active: boolean;
|
|
29
|
-
/** Flag to prevent multiple resolutions of the same promise */
|
|
30
|
-
protected isResolvedOrRejected: boolean;
|
|
31
|
-
/** Promise resolve function for completing the input operation */
|
|
32
|
-
private _resolve?;
|
|
33
|
-
/** Promise reject function for canceling the input operation */
|
|
34
|
-
private _reject?;
|
|
35
|
-
/**
|
|
36
|
-
* Creates a new base input instance.
|
|
37
|
-
*
|
|
38
|
-
* @param view - The view that will handle this input operation
|
|
39
|
-
*/
|
|
40
|
-
constructor(view: AcEdBaseView);
|
|
41
|
-
/**
|
|
42
|
-
* Gets whether this input is currently active.
|
|
43
|
-
*
|
|
44
|
-
* @returns True if the input is active, false otherwise
|
|
45
|
-
*/
|
|
46
|
-
get isActive(): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Activates this input operation.
|
|
49
|
-
* Sets up event listeners and marks the input as active.
|
|
50
|
-
* Subclasses should call super.activate() when overriding.
|
|
51
|
-
*/
|
|
52
|
-
activate(): void;
|
|
53
|
-
/**
|
|
54
|
-
* Deactivates this input operation.
|
|
55
|
-
* Removes event listeners and marks the input as inactive.
|
|
56
|
-
* Subclasses should call super.deactivate() when overriding.
|
|
57
|
-
*/
|
|
58
|
-
deactivate(): void;
|
|
59
|
-
/**
|
|
60
|
-
* Resolves the input operation with the specified result.
|
|
61
|
-
* Automatically deactivates the input and prevents multiple resolutions.
|
|
62
|
-
*
|
|
63
|
-
* @param result - The result to resolve the promise with
|
|
64
|
-
*/
|
|
65
|
-
resolve(result: TResult): void;
|
|
66
|
-
/**
|
|
67
|
-
* Rejects the input operation with the specified reason.
|
|
68
|
-
* Automatically deactivates the input and prevents multiple rejections.
|
|
69
|
-
*
|
|
70
|
-
* @param reason - The reason for rejecting the input operation
|
|
71
|
-
*/
|
|
72
|
-
reject(reason: string): void;
|
|
73
|
-
/**
|
|
74
|
-
* Handles keyboard events for the input operation.
|
|
75
|
-
* By default, cancels the operation when Escape is pressed.
|
|
76
|
-
*
|
|
77
|
-
* @param e - The keyboard event
|
|
78
|
-
*/
|
|
79
|
-
private onKeyDown;
|
|
80
|
-
/**
|
|
81
|
-
* Starts the input operation and returns a promise that resolves with the result.
|
|
82
|
-
* This method activates the input and returns a promise that will be resolved
|
|
83
|
-
* when the user completes the input operation.
|
|
84
|
-
*
|
|
85
|
-
* @returns A promise that resolves with the input result
|
|
86
|
-
*/
|
|
87
|
-
start(): Promise<TResult>;
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=AcEdBaseInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdBaseInput.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdBaseInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,8BAAsB,aAAa,CAAC,OAAO;IACzC,oDAAoD;IACpD,SAAS,CAAC,IAAI,EAAE,YAAY,CAAA;IAC5B,6CAA6C;IAC7C,SAAS,CAAC,MAAM,UAAQ;IACxB,+DAA+D;IAC/D,SAAS,CAAC,oBAAoB,UAAQ;IAEtC,kEAAkE;IAClE,OAAO,CAAC,QAAQ,CAAC,CAA0B;IAC3C,gEAAgE;IAChE,OAAO,CAAC,OAAO,CAAC,CAA0B;IAE1C;;;;OAIG;gBACS,IAAI,EAAE,YAAY;IAI9B;;;;OAIG;IACH,IAAI,QAAQ,YAEX;IAED;;;;OAIG;IACH,QAAQ;IAQR;;;;OAIG;IACH,UAAU;IAKV;;;;;OAKG;IACH,OAAO,CAAC,MAAM,EAAE,OAAO;IAQvB;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM;IAQrB;;;;;OAKG;IACH,OAAO,CAAC,SAAS,CAIhB;IAED;;;;;;OAMG;IACG,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC;CAQhC"}
|
|
@@ -1,166 +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
|
-
/**
|
|
38
|
-
* The base class for all of classes to get user inputs such as string, angle, number, point, selection,
|
|
39
|
-
* and so on.
|
|
40
|
-
*
|
|
41
|
-
* This abstract class provides a common framework for handling user input operations in the CAD editor.
|
|
42
|
-
* It manages the input lifecycle including activation, deactivation, and promise-based resolution.
|
|
43
|
-
* Subclasses must implement specific input behaviors while this base class handles common functionality
|
|
44
|
-
* like keyboard event handling and promise management.
|
|
45
|
-
*
|
|
46
|
-
* @template TResult - The type of result that this input operation will return
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```typescript
|
|
50
|
-
* class MyInput extends AcEdBaseInput<string> {
|
|
51
|
-
* // Implement specific input behavior
|
|
52
|
-
* }
|
|
53
|
-
* const input = new MyInput(view);
|
|
54
|
-
* const result = await input.start();
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* @internal
|
|
58
|
-
*/
|
|
59
|
-
var AcEdBaseInput = /** @class */ (function () {
|
|
60
|
-
/**
|
|
61
|
-
* Creates a new base input instance.
|
|
62
|
-
*
|
|
63
|
-
* @param view - The view that will handle this input operation
|
|
64
|
-
*/
|
|
65
|
-
function AcEdBaseInput(view) {
|
|
66
|
-
var _this = this;
|
|
67
|
-
/** Whether this input is currently active */
|
|
68
|
-
this.active = false;
|
|
69
|
-
/** Flag to prevent multiple resolutions of the same promise */
|
|
70
|
-
this.isResolvedOrRejected = false;
|
|
71
|
-
/**
|
|
72
|
-
* Handles keyboard events for the input operation.
|
|
73
|
-
* By default, cancels the operation when Escape is pressed.
|
|
74
|
-
*
|
|
75
|
-
* @param e - The keyboard event
|
|
76
|
-
*/
|
|
77
|
-
this.onKeyDown = function (e) {
|
|
78
|
-
if (e.code === 'Escape') {
|
|
79
|
-
_this.reject('Canceled by user!');
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
this.view = view;
|
|
83
|
-
}
|
|
84
|
-
Object.defineProperty(AcEdBaseInput.prototype, "isActive", {
|
|
85
|
-
/**
|
|
86
|
-
* Gets whether this input is currently active.
|
|
87
|
-
*
|
|
88
|
-
* @returns True if the input is active, false otherwise
|
|
89
|
-
*/
|
|
90
|
-
get: function () {
|
|
91
|
-
return this.active;
|
|
92
|
-
},
|
|
93
|
-
enumerable: false,
|
|
94
|
-
configurable: true
|
|
95
|
-
});
|
|
96
|
-
/**
|
|
97
|
-
* Activates this input operation.
|
|
98
|
-
* Sets up event listeners and marks the input as active.
|
|
99
|
-
* Subclasses should call super.activate() when overriding.
|
|
100
|
-
*/
|
|
101
|
-
AcEdBaseInput.prototype.activate = function () {
|
|
102
|
-
if (this.isActive) {
|
|
103
|
-
console.warn('Something wrong here!');
|
|
104
|
-
}
|
|
105
|
-
this.active = true;
|
|
106
|
-
this.view.canvas.addEventListener('keydown', this.onKeyDown);
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Deactivates this input operation.
|
|
110
|
-
* Removes event listeners and marks the input as inactive.
|
|
111
|
-
* Subclasses should call super.deactivate() when overriding.
|
|
112
|
-
*/
|
|
113
|
-
AcEdBaseInput.prototype.deactivate = function () {
|
|
114
|
-
this.active = false;
|
|
115
|
-
this.view.canvas.removeEventListener('keydown', this.onKeyDown);
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Resolves the input operation with the specified result.
|
|
119
|
-
* Automatically deactivates the input and prevents multiple resolutions.
|
|
120
|
-
*
|
|
121
|
-
* @param result - The result to resolve the promise with
|
|
122
|
-
*/
|
|
123
|
-
AcEdBaseInput.prototype.resolve = function (result) {
|
|
124
|
-
this.deactivate();
|
|
125
|
-
if (this._resolve && !this.isResolvedOrRejected) {
|
|
126
|
-
this._resolve(result);
|
|
127
|
-
this.isResolvedOrRejected = true;
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Rejects the input operation with the specified reason.
|
|
132
|
-
* Automatically deactivates the input and prevents multiple rejections.
|
|
133
|
-
*
|
|
134
|
-
* @param reason - The reason for rejecting the input operation
|
|
135
|
-
*/
|
|
136
|
-
AcEdBaseInput.prototype.reject = function (reason) {
|
|
137
|
-
this.deactivate();
|
|
138
|
-
if (this._reject && !this.isResolvedOrRejected) {
|
|
139
|
-
this._reject(reason);
|
|
140
|
-
this.isResolvedOrRejected = true;
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
/**
|
|
144
|
-
* Starts the input operation and returns a promise that resolves with the result.
|
|
145
|
-
* This method activates the input and returns a promise that will be resolved
|
|
146
|
-
* when the user completes the input operation.
|
|
147
|
-
*
|
|
148
|
-
* @returns A promise that resolves with the input result
|
|
149
|
-
*/
|
|
150
|
-
AcEdBaseInput.prototype.start = function () {
|
|
151
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
152
|
-
var _this = this;
|
|
153
|
-
return __generator(this, function (_a) {
|
|
154
|
-
this.isResolvedOrRejected = false;
|
|
155
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
156
|
-
_this._resolve = resolve;
|
|
157
|
-
_this._reject = reject;
|
|
158
|
-
_this.activate();
|
|
159
|
-
})];
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
};
|
|
163
|
-
return AcEdBaseInput;
|
|
164
|
-
}());
|
|
165
|
-
export { AcEdBaseInput };
|
|
166
|
-
//# sourceMappingURL=AcEdBaseInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdBaseInput.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdBaseInput.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAaE;;;;OAIG;IACH,uBAAY,IAAkB;QAA9B,iBAEC;QAjBD,6CAA6C;QACnC,WAAM,GAAG,KAAK,CAAA;QACxB,+DAA+D;QACrD,yBAAoB,GAAG,KAAK,CAAA;QA4EtC;;;;;WAKG;QACK,cAAS,GAAG,UAAC,CAAgB;YACnC,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACxB,KAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAA;YAClC,CAAC;QACH,CAAC,CAAA;QAzEC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAOD,sBAAI,mCAAQ;QALZ;;;;WAIG;aACH;YACE,OAAO,IAAI,CAAC,MAAM,CAAA;QACpB,CAAC;;;OAAA;IAED;;;;OAIG;IACH,gCAAQ,GAAR;QACE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA;QACvC,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CA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';
|
|
4
|
-
/**
|
|
5
|
-
* Selector used to select entities by a box.
|
|
6
|
-
*
|
|
7
|
-
* This class provides interactive box selection functionality for the CAD editor.
|
|
8
|
-
* Users can click and drag to create a selection rectangle, which is then converted
|
|
9
|
-
* to world coordinates for entity selection operations.
|
|
10
|
-
*
|
|
11
|
-
* The selector handles mouse events to track the selection area and provides visual
|
|
12
|
-
* feedback through a DOM overlay showing the selection bounds.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const boxSelector = new AcEdBoxSelector(view);
|
|
17
|
-
* const selectionBox = await boxSelector.start();
|
|
18
|
-
* // Use selectionBox to select entities
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
export declare class AcEdBoxSelector extends AcEdBaseInput<AcGeBox2d> {
|
|
24
|
-
/** Whether the mouse button is currently pressed */
|
|
25
|
-
private mouseDown;
|
|
26
|
-
/** Whether the mouse has moved since being pressed */
|
|
27
|
-
private mouseMove;
|
|
28
|
-
/** X coordinate where mouse was initially pressed (-1 indicates invalid) */
|
|
29
|
-
private mouseDownPositionX;
|
|
30
|
-
/** Y coordinate where mouse was initially pressed (-1 indicates invalid) */
|
|
31
|
-
private mouseDownPositionY;
|
|
32
|
-
/** DOM element used to draw the selection box */
|
|
33
|
-
private boxDom?;
|
|
34
|
-
/** Selection box border color */
|
|
35
|
-
color: number;
|
|
36
|
-
/** The container element for the selection box */
|
|
37
|
-
private container;
|
|
38
|
-
/**
|
|
39
|
-
* Creates a new box selector instance.
|
|
40
|
-
*
|
|
41
|
-
* @param view - The view that will handle this box selection operation
|
|
42
|
-
*/
|
|
43
|
-
constructor(view: AcEdBaseView);
|
|
44
|
-
/**
|
|
45
|
-
* Activates the box selector.
|
|
46
|
-
* Sets up mouse event listeners for tracking selection area.
|
|
47
|
-
* Overrides the base class to add mouse event handling.
|
|
48
|
-
*/
|
|
49
|
-
activate(): void;
|
|
50
|
-
/**
|
|
51
|
-
* Deactivates the box selector.
|
|
52
|
-
* Removes mouse event listeners and hides the selection box.
|
|
53
|
-
* Overrides the base class to clean up mouse event handling.
|
|
54
|
-
*/
|
|
55
|
-
deactivate(): void;
|
|
56
|
-
/**
|
|
57
|
-
* Rejects the box selection operation.
|
|
58
|
-
* Cleans up the selection box DOM element.
|
|
59
|
-
*
|
|
60
|
-
* @param reason - The reason for rejecting the selection operation
|
|
61
|
-
*/
|
|
62
|
-
reject(reason: string): void;
|
|
63
|
-
/**
|
|
64
|
-
* Handles mouse down events to start box selection.
|
|
65
|
-
* Records the initial mouse position for the selection area.
|
|
66
|
-
*
|
|
67
|
-
* @param e - The mouse event
|
|
68
|
-
*/
|
|
69
|
-
private mousedown;
|
|
70
|
-
/**
|
|
71
|
-
* Handles mouse move events to update the selection box.
|
|
72
|
-
* Creates and updates the visual selection rectangle as the user drags.
|
|
73
|
-
*
|
|
74
|
-
* @param e - The mouse event
|
|
75
|
-
*/
|
|
76
|
-
private mousemove;
|
|
77
|
-
/**
|
|
78
|
-
* Handles mouse up events to complete box selection.
|
|
79
|
-
* Calculates the final selection area and resolves the promise with the result.
|
|
80
|
-
*
|
|
81
|
-
* @param e - The mouse event
|
|
82
|
-
*/
|
|
83
|
-
private mouseup;
|
|
84
|
-
/**
|
|
85
|
-
* Draws the selection rectangle on screen.
|
|
86
|
-
* Creates or updates the DOM element representing the selection box.
|
|
87
|
-
*
|
|
88
|
-
* @param leftTop - The top-left corner of the selection rectangle
|
|
89
|
-
* @param rightBottom - The bottom-right corner of the selection rectangle
|
|
90
|
-
*/
|
|
91
|
-
private drawRect;
|
|
92
|
-
/**
|
|
93
|
-
* Sets the visibility of the selection rectangle DOM element.
|
|
94
|
-
*
|
|
95
|
-
* @param visible - Whether the selection rectangle should be visible
|
|
96
|
-
*/
|
|
97
|
-
private setRectDomVisible;
|
|
98
|
-
/**
|
|
99
|
-
* Converts a screen coordinate box to world coordinate system.
|
|
100
|
-
* Transforms the selection box from screen coordinates to world coordinates
|
|
101
|
-
* for use in entity selection operations.
|
|
102
|
-
*
|
|
103
|
-
* @param box - The selection box in screen coordinates
|
|
104
|
-
* @returns The selection box in world coordinates
|
|
105
|
-
*/
|
|
106
|
-
private toWcs;
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=AcEdBoxSelector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdBoxSelector.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdBoxSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAe,MAAM,uBAAuB,CAAA;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAO/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,eAAgB,SAAQ,aAAa,CAAC,SAAS,CAAC;IAC3D,oDAAoD;IACpD,OAAO,CAAC,SAAS,CAAQ;IACzB,sDAAsD;IACtD,OAAO,CAAC,SAAS,CAAQ;IACzB,4EAA4E;IAC5E,OAAO,CAAC,kBAAkB,CAAK;IAC/B,4EAA4E;IAC5E,OAAO,CAAC,kBAAkB,CAAK;IAE/B,iDAAiD;IACjD,OAAO,CAAC,MAAM,CAAC,CAAgB;IAC/B,iCAAiC;IAC1B,KAAK,EAAE,MAAM,CAAA;IACpB,kDAAkD;IAClD,OAAO,CAAC,SAAS,CAAa;IAE9B;;;;OAIG;gBACS,IAAI,EAAE,YAAY;IAM9B;;;;OAIG;IACH,QAAQ;IAQR;;;;OAIG;IACH,UAAU;IAQV;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM;IAMrB;;;;;OAKG;IACH,OAAO,CAAC,SAAS,CAOhB;IAED;;;;;OAKG;IACH,OAAO,CAAC,SAAS,CAuBhB;IAED;;;;;OAKG;IACH,OAAO,CAAC,OAAO,CAmBd;IAED;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ;IAiChB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK;CAQd"}
|
|
@@ -1,220 +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 { AcCmColor, AcGeBox2d, AcGePoint2d } from '@mlightcad/data-model';
|
|
17
|
-
import { AcEdBaseInput } from './AcEdBaseInput';
|
|
18
|
-
/** Default border color for the selection box */
|
|
19
|
-
var BORDER_COLOR = 0xffffff;
|
|
20
|
-
/** Default border width for the selection box */
|
|
21
|
-
var BORDER_WIDTH = '1px';
|
|
22
|
-
/**
|
|
23
|
-
* Selector used to select entities by a box.
|
|
24
|
-
*
|
|
25
|
-
* This class provides interactive box selection functionality for the CAD editor.
|
|
26
|
-
* Users can click and drag to create a selection rectangle, which is then converted
|
|
27
|
-
* to world coordinates for entity selection operations.
|
|
28
|
-
*
|
|
29
|
-
* The selector handles mouse events to track the selection area and provides visual
|
|
30
|
-
* feedback through a DOM overlay showing the selection bounds.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```typescript
|
|
34
|
-
* const boxSelector = new AcEdBoxSelector(view);
|
|
35
|
-
* const selectionBox = await boxSelector.start();
|
|
36
|
-
* // Use selectionBox to select entities
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @internal
|
|
40
|
-
*/
|
|
41
|
-
var AcEdBoxSelector = /** @class */ (function (_super) {
|
|
42
|
-
__extends(AcEdBoxSelector, _super);
|
|
43
|
-
/**
|
|
44
|
-
* Creates a new box selector instance.
|
|
45
|
-
*
|
|
46
|
-
* @param view - The view that will handle this box selection operation
|
|
47
|
-
*/
|
|
48
|
-
function AcEdBoxSelector(view) {
|
|
49
|
-
var _this = _super.call(this, view) || this;
|
|
50
|
-
/** Whether the mouse button is currently pressed */
|
|
51
|
-
_this.mouseDown = false;
|
|
52
|
-
/** Whether the mouse has moved since being pressed */
|
|
53
|
-
_this.mouseMove = false;
|
|
54
|
-
/** X coordinate where mouse was initially pressed (-1 indicates invalid) */
|
|
55
|
-
_this.mouseDownPositionX = -1; // -1 means invalid point
|
|
56
|
-
/** Y coordinate where mouse was initially pressed (-1 indicates invalid) */
|
|
57
|
-
_this.mouseDownPositionY = -1;
|
|
58
|
-
/**
|
|
59
|
-
* Handles mouse down events to start box selection.
|
|
60
|
-
* Records the initial mouse position for the selection area.
|
|
61
|
-
*
|
|
62
|
-
* @param e - The mouse event
|
|
63
|
-
*/
|
|
64
|
-
_this.mousedown = function (e) {
|
|
65
|
-
if (e.button === 0) {
|
|
66
|
-
_this.mouseDown = true;
|
|
67
|
-
var point = new AcGePoint2d(e.x, e.y);
|
|
68
|
-
_this.mouseDownPositionX = point.x;
|
|
69
|
-
_this.mouseDownPositionY = point.y;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Handles mouse move events to update the selection box.
|
|
74
|
-
* Creates and updates the visual selection rectangle as the user drags.
|
|
75
|
-
*
|
|
76
|
-
* @param e - The mouse event
|
|
77
|
-
*/
|
|
78
|
-
_this.mousemove = function (e) {
|
|
79
|
-
if (!_this.mouseDown) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
var point = new AcGePoint2d(e.x, e.y);
|
|
83
|
-
if (_this.mouseDownPositionX >= 0 && _this.mouseDownPositionY >= 0) {
|
|
84
|
-
var TOLERANCE = 5;
|
|
85
|
-
if (Math.abs(point.x - _this.mouseDownPositionX) >= TOLERANCE ||
|
|
86
|
-
Math.abs(point.y - _this.mouseDownPositionY) >= TOLERANCE) {
|
|
87
|
-
_this.mouseMove = true;
|
|
88
|
-
var leftTop = new AcGePoint2d(Math.min(_this.mouseDownPositionX, point.x), Math.min(_this.mouseDownPositionY, point.y));
|
|
89
|
-
var rightBottom = new AcGePoint2d(Math.max(_this.mouseDownPositionX, point.x), Math.max(_this.mouseDownPositionY, point.y));
|
|
90
|
-
_this.drawRect(leftTop, rightBottom);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Handles mouse up events to complete box selection.
|
|
96
|
-
* Calculates the final selection area and resolves the promise with the result.
|
|
97
|
-
*
|
|
98
|
-
* @param e - The mouse event
|
|
99
|
-
*/
|
|
100
|
-
_this.mouseup = function (e) {
|
|
101
|
-
if (_this.mouseDown && _this.mouseMove) {
|
|
102
|
-
var point = new AcGePoint2d(e.x, e.y);
|
|
103
|
-
var min = new AcGePoint2d(Math.min(_this.mouseDownPositionX, point.x), Math.min(_this.mouseDownPositionY, point.y));
|
|
104
|
-
var max = new AcGePoint2d(Math.max(_this.mouseDownPositionX, point.x), Math.max(_this.mouseDownPositionY, point.y));
|
|
105
|
-
var bbox = new AcGeBox2d(min, max);
|
|
106
|
-
_this.resolve(_this.toWcs(bbox));
|
|
107
|
-
}
|
|
108
|
-
_this.mouseDown = false;
|
|
109
|
-
_this.mouseMove = false;
|
|
110
|
-
// reset
|
|
111
|
-
_this.mouseDownPositionX = -1;
|
|
112
|
-
_this.mouseDownPositionY = -1;
|
|
113
|
-
};
|
|
114
|
-
_this.container = view.canvas;
|
|
115
|
-
_this.color = BORDER_COLOR;
|
|
116
|
-
return _this;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Activates the box selector.
|
|
120
|
-
* Sets up mouse event listeners for tracking selection area.
|
|
121
|
-
* Overrides the base class to add mouse event handling.
|
|
122
|
-
*/
|
|
123
|
-
AcEdBoxSelector.prototype.activate = function () {
|
|
124
|
-
_super.prototype.activate.call(this);
|
|
125
|
-
this.active = true;
|
|
126
|
-
this.container.addEventListener('pointerdown', this.mousedown);
|
|
127
|
-
this.container.addEventListener('pointermove', this.mousemove);
|
|
128
|
-
this.container.addEventListener('pointerup', this.mouseup);
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Deactivates the box selector.
|
|
132
|
-
* Removes mouse event listeners and hides the selection box.
|
|
133
|
-
* Overrides the base class to clean up mouse event handling.
|
|
134
|
-
*/
|
|
135
|
-
AcEdBoxSelector.prototype.deactivate = function () {
|
|
136
|
-
_super.prototype.deactivate.call(this);
|
|
137
|
-
this.container.removeEventListener('pointerdown', this.mousedown);
|
|
138
|
-
this.container.removeEventListener('pointermove', this.mousemove);
|
|
139
|
-
this.container.removeEventListener('pointerup', this.mouseup);
|
|
140
|
-
this.setRectDomVisible(false);
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* Rejects the box selection operation.
|
|
144
|
-
* Cleans up the selection box DOM element.
|
|
145
|
-
*
|
|
146
|
-
* @param reason - The reason for rejecting the selection operation
|
|
147
|
-
*/
|
|
148
|
-
AcEdBoxSelector.prototype.reject = function (reason) {
|
|
149
|
-
var _a;
|
|
150
|
-
_super.prototype.reject.call(this, reason);
|
|
151
|
-
(_a = this.boxDom) === null || _a === void 0 ? void 0 : _a.remove();
|
|
152
|
-
this.boxDom = undefined;
|
|
153
|
-
};
|
|
154
|
-
/**
|
|
155
|
-
* Draws the selection rectangle on screen.
|
|
156
|
-
* Creates or updates the DOM element representing the selection box.
|
|
157
|
-
*
|
|
158
|
-
* @param leftTop - The top-left corner of the selection rectangle
|
|
159
|
-
* @param rightBottom - The bottom-right corner of the selection rectangle
|
|
160
|
-
*/
|
|
161
|
-
AcEdBoxSelector.prototype.drawRect = function (leftTop, rightBottom) {
|
|
162
|
-
if (!this.boxDom) {
|
|
163
|
-
var color = new AcCmColor();
|
|
164
|
-
color.color = this.color;
|
|
165
|
-
this.boxDom = document.createElement('div');
|
|
166
|
-
this.boxDom.style.cssText = "position: absolute;border: ".concat(BORDER_WIDTH, " solid ").concat(color.cssColor, ";");
|
|
167
|
-
document.body.appendChild(this.boxDom);
|
|
168
|
-
}
|
|
169
|
-
this.setRectDomVisible(true);
|
|
170
|
-
// Adjust leftTop and rightBottom position to make them always in container bounding box
|
|
171
|
-
// Otherwise, the box may exceed the container bounding box and scrollbar will be shown.
|
|
172
|
-
if (leftTop.x <= 0) {
|
|
173
|
-
leftTop.x = 0;
|
|
174
|
-
}
|
|
175
|
-
if (leftTop.y <= 0) {
|
|
176
|
-
leftTop.y = 0;
|
|
177
|
-
}
|
|
178
|
-
if (rightBottom.x >= this.container.clientWidth - 2) {
|
|
179
|
-
rightBottom.x = this.container.clientWidth - 2;
|
|
180
|
-
}
|
|
181
|
-
if (rightBottom.y >= this.container.clientHeight - 2) {
|
|
182
|
-
rightBottom.y = this.container.clientHeight - 2;
|
|
183
|
-
}
|
|
184
|
-
this.boxDom.style.left = "".concat(leftTop.x, "px");
|
|
185
|
-
this.boxDom.style.top = "".concat(leftTop.y, "px");
|
|
186
|
-
var width = Math.abs(rightBottom.x - leftTop.x);
|
|
187
|
-
var height = Math.abs(rightBottom.y - leftTop.y);
|
|
188
|
-
this.boxDom.style.width = "".concat(width, "px");
|
|
189
|
-
this.boxDom.style.height = "".concat(height, "px");
|
|
190
|
-
};
|
|
191
|
-
/**
|
|
192
|
-
* Sets the visibility of the selection rectangle DOM element.
|
|
193
|
-
*
|
|
194
|
-
* @param visible - Whether the selection rectangle should be visible
|
|
195
|
-
*/
|
|
196
|
-
AcEdBoxSelector.prototype.setRectDomVisible = function (visible) {
|
|
197
|
-
if (this.boxDom) {
|
|
198
|
-
this.boxDom.style.display = visible ? 'inline-block' : 'none';
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
/**
|
|
202
|
-
* Converts a screen coordinate box to world coordinate system.
|
|
203
|
-
* Transforms the selection box from screen coordinates to world coordinates
|
|
204
|
-
* for use in entity selection operations.
|
|
205
|
-
*
|
|
206
|
-
* @param box - The selection box in screen coordinates
|
|
207
|
-
* @returns The selection box in world coordinates
|
|
208
|
-
*/
|
|
209
|
-
AcEdBoxSelector.prototype.toWcs = function (box) {
|
|
210
|
-
var wcsBox = new AcGeBox2d();
|
|
211
|
-
var p1 = new AcGePoint2d(box.min.x, box.min.y);
|
|
212
|
-
var p2 = new AcGePoint2d(box.max.x, box.max.y);
|
|
213
|
-
wcsBox.expandByPoint(this.view.cwcs2Wcs(p1));
|
|
214
|
-
wcsBox.expandByPoint(this.view.cwcs2Wcs(p2));
|
|
215
|
-
return wcsBox;
|
|
216
|
-
};
|
|
217
|
-
return AcEdBoxSelector;
|
|
218
|
-
}(AcEdBaseInput));
|
|
219
|
-
export { AcEdBoxSelector };
|
|
220
|
-
//# sourceMappingURL=AcEdBoxSelector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdBoxSelector.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdBoxSelector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,iDAAiD;AACjD,IAAM,YAAY,GAAG,QAAQ,CAAA;AAC7B,iDAAiD;AACjD,IAAM,YAAY,GAAG,KAAK,CAAA;AAE1B;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAAqC,mCAAwB;IAiB3D;;;;OAIG;IACH,yBAAY,IAAkB;QAC5B,YAAA,MAAK,YAA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AI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;QAC5C,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;QAC5C,OAAO,MAAM,CAAA;IACf,CAAC;IACH,sBAAC;AAAD,CAAC,AA9MD,CAAqC,aAAa,GA8MjD"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { AcGePoint2d } from '@mlightcad/data-model';
|
|
2
|
-
import { AcEdBaseView } from '../view/AcEdBaseView';
|
|
3
|
-
import { AcEdBaseInput } from './AcEdBaseInput';
|
|
4
|
-
/**
|
|
5
|
-
* Class used to input one point from user interaction.
|
|
6
|
-
*
|
|
7
|
-
* This class provides functionality for capturing a single point input from the user
|
|
8
|
-
* by handling mouse click events. When the user clicks on the canvas, the click
|
|
9
|
-
* coordinates are converted from screen coordinates to world coordinates and
|
|
10
|
-
* returned as the result.
|
|
11
|
-
*
|
|
12
|
-
* The input operation can be canceled by pressing the Escape key (handled by the base class).
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const pointInput = new AcEdInputPoint(view);
|
|
17
|
-
* const point = await pointInput.start();
|
|
18
|
-
* console.log(`User clicked at: ${point.x}, ${point.y}`);
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
export declare class AcEdInputPoint extends AcEdBaseInput<AcGePoint2d> {
|
|
24
|
-
/**
|
|
25
|
-
* Creates a new point input instance.
|
|
26
|
-
*
|
|
27
|
-
* @param view - The view that will handle this point input operation
|
|
28
|
-
*/
|
|
29
|
-
constructor(view: AcEdBaseView);
|
|
30
|
-
/**
|
|
31
|
-
* Activates the point input operation.
|
|
32
|
-
* Sets up the click event listener to capture user point selection.
|
|
33
|
-
* Overrides the base class to add click event handling.
|
|
34
|
-
*/
|
|
35
|
-
activate(): void;
|
|
36
|
-
/**
|
|
37
|
-
* Deactivates the point input operation.
|
|
38
|
-
* Removes the click event listener.
|
|
39
|
-
* Overrides the base class to clean up click event handling.
|
|
40
|
-
*/
|
|
41
|
-
deactivate(): void;
|
|
42
|
-
/**
|
|
43
|
-
* Handles mouse click events to capture the selected point.
|
|
44
|
-
* Converts the click coordinates from screen space to world coordinates
|
|
45
|
-
* and resolves the input operation with the resulting point.
|
|
46
|
-
*
|
|
47
|
-
* @param event - The mouse click event containing the screen coordinates
|
|
48
|
-
*/
|
|
49
|
-
private onClick;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=AcEdInputPoint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdInputPoint.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdInputPoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,cAAe,SAAQ,aAAa,CAAC,WAAW,CAAC;IAC5D;;;;OAIG;gBACS,IAAI,EAAE,YAAY;IAI9B;;;;OAIG;IACH,QAAQ;IAKR;;;;OAIG;IACH,UAAU;IAKV;;;;;;OAMG;IACH,OAAO,CAAC,OAAO,CAEd;CACF"}
|