@mlightcad/cad-simple-viewer 1.4.11 → 1.4.13
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 +20139 -12511
- package/dist/index.umd.cjs +102 -94
- package/dist/libredwg-parser-worker.js +6958 -12596
- package/lib/app/AcApAnnotation.d.ts.map +1 -1
- package/lib/app/AcApAnnotation.js +3 -3
- package/lib/app/AcApAnnotation.js.map +1 -1
- package/lib/app/AcApDocManager.d.ts +61 -4
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +162 -29
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/app/AcApDocument.d.ts +6 -0
- package/lib/app/AcApDocument.d.ts.map +1 -1
- package/lib/app/AcApDocument.js +12 -0
- package/lib/app/AcApDocument.js.map +1 -1
- package/lib/app/AcApProgress.d.ts.map +1 -1
- package/lib/app/AcApProgress.js +3 -3
- package/lib/app/AcApProgress.js.map +1 -1
- package/lib/app/AcApSettingManager.d.ts.map +1 -1
- package/lib/app/AcApSettingManager.js +3 -1
- package/lib/app/AcApSettingManager.js.map +1 -1
- package/lib/app/AcDbOpenDatabaseOptions.d.ts.map +1 -1
- package/lib/command/AcApArcCmd.d.ts +140 -0
- package/lib/command/AcApArcCmd.d.ts.map +1 -0
- package/lib/command/AcApArcCmd.js +1009 -0
- package/lib/command/AcApArcCmd.js.map +1 -0
- package/lib/command/AcApCircleCmd.d.ts +59 -0
- package/lib/command/AcApCircleCmd.d.ts.map +1 -1
- package/lib/command/AcApCircleCmd.js +490 -13
- package/lib/command/AcApCircleCmd.js.map +1 -1
- package/lib/command/AcApClearMeasurementsCmd.d.ts +1 -1
- package/lib/command/AcApClearMeasurementsCmd.d.ts.map +1 -1
- package/lib/command/AcApClearMeasurementsCmd.js +2 -4
- package/lib/command/AcApClearMeasurementsCmd.js.map +1 -1
- package/lib/command/AcApConvertToDxfCmd.d.ts +9 -0
- package/lib/command/AcApConvertToDxfCmd.d.ts.map +1 -0
- package/lib/command/{AcApZoomToBoxCmd.js → AcApConvertToDxfCmd.js} +14 -40
- package/lib/command/AcApConvertToDxfCmd.js.map +1 -0
- package/lib/command/AcApConvertToPngCmd.d.ts +35 -0
- package/lib/command/AcApConvertToPngCmd.d.ts.map +1 -0
- package/lib/command/AcApConvertToPngCmd.js +127 -0
- package/lib/command/AcApConvertToPngCmd.js.map +1 -0
- package/lib/command/AcApDimLinearCmd.d.ts.map +1 -1
- package/lib/command/AcApDimLinearCmd.js +14 -5
- package/lib/command/AcApDimLinearCmd.js.map +1 -1
- package/lib/command/AcApDxfConvertor.d.ts +12 -0
- package/lib/command/AcApDxfConvertor.d.ts.map +1 -0
- package/lib/command/AcApDxfConvertor.js +37 -0
- package/lib/command/AcApDxfConvertor.js.map +1 -0
- package/lib/command/AcApEllipseCmd.d.ts +87 -0
- package/lib/command/AcApEllipseCmd.d.ts.map +1 -0
- package/lib/command/AcApEllipseCmd.js +583 -0
- package/lib/command/AcApEllipseCmd.js.map +1 -0
- package/lib/command/AcApEraseCmd.d.ts.map +1 -1
- package/lib/command/AcApEraseCmd.js +10 -6
- package/lib/command/AcApEraseCmd.js.map +1 -1
- package/lib/command/AcApHatchCmd.d.ts +210 -0
- package/lib/command/AcApHatchCmd.d.ts.map +1 -0
- package/lib/command/AcApHatchCmd.js +808 -0
- package/lib/command/AcApHatchCmd.js.map +1 -0
- package/lib/command/AcApLayerCmd.d.ts +217 -0
- package/lib/command/AcApLayerCmd.d.ts.map +1 -0
- package/lib/command/AcApLayerCmd.js +768 -0
- package/lib/command/AcApLayerCmd.js.map +1 -0
- package/lib/command/AcApLineCmd.d.ts +36 -1
- package/lib/command/AcApLineCmd.d.ts.map +1 -1
- package/lib/command/AcApLineCmd.js +159 -16
- package/lib/command/AcApLineCmd.js.map +1 -1
- package/lib/command/AcApMTextCmd.d.ts.map +1 -1
- package/lib/command/AcApMTextCmd.js +6 -3
- package/lib/command/AcApMTextCmd.js.map +1 -1
- package/lib/command/AcApMeasureAngleCmd.d.ts.map +1 -1
- package/lib/command/AcApMeasureAngleCmd.js +134 -123
- package/lib/command/AcApMeasureAngleCmd.js.map +1 -1
- package/lib/command/AcApMeasureArcCmd.d.ts.map +1 -1
- package/lib/command/AcApMeasureArcCmd.js +165 -147
- package/lib/command/AcApMeasureArcCmd.js.map +1 -1
- package/lib/command/AcApMeasureAreaCmd.d.ts.map +1 -1
- package/lib/command/AcApMeasureAreaCmd.js +186 -175
- package/lib/command/AcApMeasureAreaCmd.js.map +1 -1
- package/lib/command/AcApMeasureDistanceCmd.d.ts.map +1 -1
- package/lib/command/AcApMeasureDistanceCmd.js +51 -39
- package/lib/command/AcApMeasureDistanceCmd.js.map +1 -1
- package/lib/command/AcApMoveCmd.d.ts +16 -0
- package/lib/command/AcApMoveCmd.d.ts.map +1 -0
- package/lib/command/AcApMoveCmd.js +278 -0
- package/lib/command/AcApMoveCmd.js.map +1 -0
- package/lib/command/AcApPngConvertor.d.ts +95 -0
- package/lib/command/AcApPngConvertor.d.ts.map +1 -0
- package/lib/command/AcApPngConvertor.js +205 -0
- package/lib/command/AcApPngConvertor.js.map +1 -0
- package/lib/command/AcApPolygonCmd.d.ts +69 -0
- package/lib/command/AcApPolygonCmd.d.ts.map +1 -0
- package/lib/command/AcApPolygonCmd.js +422 -0
- package/lib/command/AcApPolygonCmd.js.map +1 -0
- package/lib/command/AcApPolylineCmd.d.ts +71 -0
- package/lib/command/AcApPolylineCmd.d.ts.map +1 -0
- package/lib/command/AcApPolylineCmd.js +569 -0
- package/lib/command/AcApPolylineCmd.js.map +1 -0
- package/lib/command/AcApRectCmd.d.ts +149 -4
- package/lib/command/AcApRectCmd.d.ts.map +1 -1
- package/lib/command/AcApRectCmd.js +717 -29
- package/lib/command/AcApRectCmd.js.map +1 -1
- package/lib/command/AcApRevCircleCmd.d.ts +8 -0
- package/lib/command/AcApRevCircleCmd.d.ts.map +1 -1
- package/lib/command/AcApRevCircleCmd.js +30 -6
- package/lib/command/AcApRevCircleCmd.js.map +1 -1
- package/lib/command/AcApRevCloudCmd.d.ts.map +1 -1
- package/lib/command/AcApRevCloudCmd.js +10 -4
- package/lib/command/AcApRevCloudCmd.js.map +1 -1
- package/lib/command/AcApRevRectCmd.d.ts +8 -0
- package/lib/command/AcApRevRectCmd.d.ts.map +1 -1
- package/lib/command/AcApRevRectCmd.js +78 -6
- package/lib/command/AcApRevRectCmd.js.map +1 -1
- package/lib/command/AcApSketchCmd.d.ts.map +1 -1
- package/lib/command/AcApSketchCmd.js +11 -7
- package/lib/command/AcApSketchCmd.js.map +1 -1
- package/lib/command/AcApSplineCmd.d.ts +85 -0
- package/lib/command/AcApSplineCmd.d.ts.map +1 -0
- package/lib/command/AcApSplineCmd.js +620 -0
- package/lib/command/AcApSplineCmd.js.map +1 -0
- package/lib/command/AcApSysVarCmd.d.ts.map +1 -1
- package/lib/command/AcApSysVarCmd.js +6 -3
- package/lib/command/AcApSysVarCmd.js.map +1 -1
- package/lib/command/AcApZoomCmd.d.ts +91 -20
- package/lib/command/AcApZoomCmd.d.ts.map +1 -1
- package/lib/command/AcApZoomCmd.js +288 -23
- package/lib/command/AcApZoomCmd.js.map +1 -1
- package/lib/command/index.d.ts +12 -1
- package/lib/command/index.d.ts.map +1 -1
- package/lib/command/index.js +12 -1
- package/lib/command/index.js.map +1 -1
- package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -1
- package/lib/editor/command/AcEdCommandIterator.js.map +1 -1
- package/lib/editor/command/AcEdCommandStack.d.ts +54 -1
- package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -1
- package/lib/editor/command/AcEdCommandStack.js +207 -25
- package/lib/editor/command/AcEdCommandStack.js.map +1 -1
- package/lib/editor/global/AcEdUiTheme.d.ts +4 -0
- package/lib/editor/global/AcEdUiTheme.d.ts.map +1 -0
- package/lib/editor/global/AcEdUiTheme.js +44 -0
- package/lib/editor/global/AcEdUiTheme.js.map +1 -0
- package/lib/editor/global/index.d.ts +1 -0
- package/lib/editor/global/index.d.ts.map +1 -1
- package/lib/editor/global/index.js +1 -0
- package/lib/editor/global/index.js.map +1 -1
- package/lib/editor/input/AcEdCursorManager.d.ts +10 -0
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
- package/lib/editor/input/AcEdCursorManager.js +24 -4
- package/lib/editor/input/AcEdCursorManager.js.map +1 -1
- package/lib/editor/input/AcEdInputModifiers.d.ts +39 -0
- package/lib/editor/input/AcEdInputModifiers.d.ts.map +1 -0
- package/lib/editor/input/AcEdInputModifiers.js +2 -0
- package/lib/editor/input/AcEdInputModifiers.js.map +1 -0
- package/lib/editor/input/AcEdInputToggles.d.ts +24 -0
- package/lib/editor/input/AcEdInputToggles.d.ts.map +1 -0
- package/lib/editor/input/AcEdInputToggles.js +2 -0
- package/lib/editor/input/AcEdInputToggles.js.map +1 -0
- package/lib/editor/input/AcEdPromptStateMachine.d.ts +110 -0
- package/lib/editor/input/AcEdPromptStateMachine.d.ts.map +1 -0
- package/lib/editor/input/AcEdPromptStateMachine.js +147 -0
- package/lib/editor/input/AcEdPromptStateMachine.js.map +1 -0
- package/lib/editor/input/AcEdSelectionFilter.d.ts +79 -0
- package/lib/editor/input/AcEdSelectionFilter.d.ts.map +1 -0
- package/lib/editor/input/AcEdSelectionFilter.js +231 -0
- package/lib/editor/input/AcEdSelectionFilter.js.map +1 -0
- package/lib/editor/input/AcEditor.d.ts +77 -10
- package/lib/editor/input/AcEditor.d.ts.map +1 -1
- package/lib/editor/input/AcEditor.js +162 -1
- package/lib/editor/input/AcEditor.js.map +1 -1
- package/lib/editor/input/index.d.ts +4 -0
- package/lib/editor/input/index.d.ts.map +1 -1
- package/lib/editor/input/index.js +4 -0
- package/lib/editor/input/index.js.map +1 -1
- package/lib/editor/input/marker/AcEdMarker.d.ts.map +1 -1
- package/lib/editor/input/marker/AcEdMarker.js +3 -3
- package/lib/editor/input/marker/AcEdMarker.js.map +1 -1
- package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts +47 -0
- package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdKeywordCollection.js +30 -4
- package/lib/editor/input/prompt/AcEdKeywordCollection.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts +8 -1
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.js +19 -2
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptBoxResult.d.ts +12 -0
- package/lib/editor/input/prompt/AcEdPromptBoxResult.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptBoxResult.js +30 -0
- package/lib/editor/input/prompt/AcEdPromptBoxResult.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptDoubleResult.d.ts +9 -0
- package/lib/editor/input/prompt/AcEdPromptDoubleResult.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptDoubleResult.js +28 -0
- package/lib/editor/input/prompt/AcEdPromptDoubleResult.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptEntityOptions.d.ts +18 -1
- package/lib/editor/input/prompt/AcEdPromptEntityOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptEntityOptions.js +32 -5
- package/lib/editor/input/prompt/AcEdPromptEntityOptions.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptEntityResult.d.ts +14 -0
- package/lib/editor/input/prompt/AcEdPromptEntityResult.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptEntityResult.js +31 -0
- package/lib/editor/input/prompt/AcEdPromptEntityResult.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptIntegerResult.d.ts +9 -0
- package/lib/editor/input/prompt/AcEdPromptIntegerResult.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptIntegerResult.js +28 -0
- package/lib/editor/input/prompt/AcEdPromptIntegerResult.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptKeywordOptions.d.ts +1 -1
- package/lib/editor/input/prompt/AcEdPromptKeywordOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptKeywordOptions.js +2 -2
- package/lib/editor/input/prompt/AcEdPromptKeywordOptions.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts +1 -1
- package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js +2 -2
- package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptOptions.d.ts +9 -3
- package/lib/editor/input/prompt/AcEdPromptOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptOptions.js +22 -4
- package/lib/editor/input/prompt/AcEdPromptOptions.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts +1 -1
- package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptPointOptions.js +2 -2
- package/lib/editor/input/prompt/AcEdPromptPointOptions.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptPointResult.d.ts +3 -3
- package/lib/editor/input/prompt/AcEdPromptSelectionOptions.d.ts +1 -1
- package/lib/editor/input/prompt/AcEdPromptSelectionOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptSelectionOptions.js +2 -2
- package/lib/editor/input/prompt/AcEdPromptSelectionOptions.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptSelectionResult.d.ts +12 -0
- package/lib/editor/input/prompt/AcEdPromptSelectionResult.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptSelectionResult.js +30 -0
- package/lib/editor/input/prompt/AcEdPromptSelectionResult.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts +1 -1
- package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptStringOptions.js +2 -2
- package/lib/editor/input/prompt/AcEdPromptStringOptions.js.map +1 -1
- package/lib/editor/input/prompt/index.d.ts +9 -0
- package/lib/editor/input/prompt/index.d.ts.map +1 -1
- package/lib/editor/input/prompt/index.js +9 -0
- package/lib/editor/input/prompt/index.js.map +1 -1
- package/lib/editor/input/session/AcEdKeywordSession.d.ts +67 -1
- package/lib/editor/input/session/AcEdKeywordSession.d.ts.map +1 -1
- package/lib/editor/input/session/AcEdKeywordSession.js +78 -1
- package/lib/editor/input/session/AcEdKeywordSession.js.map +1 -1
- package/lib/editor/input/ui/AcEdCommandLine.d.ts +27 -1
- package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdCommandLine.js +75 -10
- package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts +24 -1
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInput.js +147 -27
- package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts +2 -0
- package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputBox.js +4 -0
- package/lib/editor/input/ui/AcEdFloatingInputBox.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts +30 -1
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.js +46 -15
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +33 -0
- package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingMessage.d.ts +12 -0
- package/lib/editor/input/ui/AcEdFloatingMessage.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingMessage.js +61 -2
- package/lib/editor/input/ui/AcEdFloatingMessage.js.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.d.ts +403 -29
- package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.js +1313 -414
- package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
- package/lib/editor/input/ui/AcEdRubberBand.d.ts +15 -1
- package/lib/editor/input/ui/AcEdRubberBand.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdRubberBand.js +43 -11
- package/lib/editor/input/ui/AcEdRubberBand.js.map +1 -1
- package/lib/editor/view/AcEdBaseView.d.ts +66 -0
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
- package/lib/editor/view/AcEdBaseView.js +170 -0
- package/lib/editor/view/AcEdBaseView.js.map +1 -1
- package/lib/editor/view/AcEdSpatialQueryResult.d.ts.map +1 -1
- package/lib/i18n/en/command.d.ts +36 -3
- package/lib/i18n/en/command.d.ts.map +1 -1
- package/lib/i18n/en/command.js +36 -3
- package/lib/i18n/en/command.js.map +1 -1
- package/lib/i18n/en/jig.d.ts +553 -0
- package/lib/i18n/en/jig.d.ts.map +1 -1
- package/lib/i18n/en/jig.js +557 -4
- package/lib/i18n/en/jig.js.map +1 -1
- package/lib/i18n/zh/command.d.ts +36 -3
- package/lib/i18n/zh/command.d.ts.map +1 -1
- package/lib/i18n/zh/command.js +36 -3
- package/lib/i18n/zh/command.js.map +1 -1
- package/lib/i18n/zh/jig.d.ts +553 -0
- package/lib/i18n/zh/jig.d.ts.map +1 -1
- package/lib/i18n/zh/jig.js +557 -4
- package/lib/i18n/zh/jig.js.map +1 -1
- package/lib/plugin/AcApPluginManager.d.ts.map +1 -1
- package/lib/plugin/AcApPluginManager.js.map +1 -1
- package/lib/util/AcApMeasurementElementGenerator.d.ts +36 -0
- package/lib/util/AcApMeasurementElementGenerator.d.ts.map +1 -0
- package/lib/util/AcApMeasurementElementGenerator.js +92 -0
- package/lib/util/AcApMeasurementElementGenerator.js.map +1 -0
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/view/AcTrLayer.d.ts.map +1 -1
- package/lib/view/AcTrLayer.js +5 -3
- package/lib/view/AcTrLayer.js.map +1 -1
- package/lib/view/AcTrLayoutView.d.ts +6 -0
- package/lib/view/AcTrLayoutView.d.ts.map +1 -1
- package/lib/view/AcTrLayoutView.js +20 -0
- package/lib/view/AcTrLayoutView.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +0 -1
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +103 -50
- package/lib/view/AcTrView2d.js.map +1 -1
- package/package.json +15 -13
- package/lib/command/AcApZoomToBoxCmd.d.ts +0 -29
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +0 -1
- package/lib/command/AcApZoomToBoxCmd.js.map +0 -1
- package/lib/util/AcApMeasurementUtils.d.ts +0 -12
- package/lib/util/AcApMeasurementUtils.d.ts.map +0 -1
- package/lib/util/AcApMeasurementUtils.js +0 -36
- package/lib/util/AcApMeasurementUtils.js.map +0 -1
|
@@ -69,18 +69,25 @@ var AcEdCursorManager = /** @class */ (function () {
|
|
|
69
69
|
*/
|
|
70
70
|
function AcEdCursorManager(view) {
|
|
71
71
|
var _this = this;
|
|
72
|
+
/** The current background color */
|
|
73
|
+
this._backgroundColor = 0;
|
|
74
|
+
/** Total length of the cursor crosshair */
|
|
75
|
+
this._totalLength = 20;
|
|
72
76
|
this._view = view;
|
|
73
77
|
this._cursorMap = new Map();
|
|
74
|
-
|
|
75
|
-
var rectSize = 10;
|
|
76
|
-
this._cursorMap.set(AcEdCorsorType.Crosshair, this.createRectCrossIcon(rectSize, totalLength - rectSize));
|
|
78
|
+
this.setCursorColor(this._backgroundColor === 0 ? 'white' : 'black');
|
|
77
79
|
AcDbSysVarManager.instance().events.sysVarChanged.addEventListener(function (args) {
|
|
78
80
|
if (args.name === AcDbSystemVariables.PICKBOX.toLowerCase()) {
|
|
79
81
|
var size = args.newVal;
|
|
80
82
|
size = size >= 0 ? size : 0;
|
|
81
|
-
_this._cursorMap.set(AcEdCorsorType.Crosshair, _this.createRectCrossIcon(size,
|
|
83
|
+
_this._cursorMap.set(AcEdCorsorType.Crosshair, _this.createRectCrossIcon(size, _this._totalLength - size, _this._backgroundColor === 0 ? 'white' : 'black'));
|
|
82
84
|
_this.setCursor(_this._currentCursor);
|
|
83
85
|
}
|
|
86
|
+
else if (args.name === AcDbSystemVariables.WHITEBKCOLOR.toLowerCase()) {
|
|
87
|
+
var useWhiteBackgroundColor = args.newVal;
|
|
88
|
+
_this._backgroundColor = useWhiteBackgroundColor ? 0xffffff : 0;
|
|
89
|
+
_this.setCursorColor(_this._backgroundColor === 0 ? 'white' : 'black');
|
|
90
|
+
}
|
|
84
91
|
});
|
|
85
92
|
this.setCursor(AcEdCorsorType.Crosshair);
|
|
86
93
|
}
|
|
@@ -115,6 +122,19 @@ var AcEdCursorManager = /** @class */ (function () {
|
|
|
115
122
|
}
|
|
116
123
|
this._currentCursor = cursorType;
|
|
117
124
|
};
|
|
125
|
+
/**
|
|
126
|
+
* Sets the cursor color for the crosshair cursor
|
|
127
|
+
*
|
|
128
|
+
* @param color - The color for the cursor
|
|
129
|
+
*/
|
|
130
|
+
AcEdCursorManager.prototype.setCursorColor = function (color) {
|
|
131
|
+
var rectSize = 10;
|
|
132
|
+
var cursor = this.createRectCrossIcon(rectSize, this._totalLength - rectSize, color);
|
|
133
|
+
this._cursorMap.set(AcEdCorsorType.Crosshair, cursor);
|
|
134
|
+
if (this._currentCursor === AcEdCorsorType.Crosshair) {
|
|
135
|
+
this._view.canvas.style.cursor = cursor;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
118
138
|
/**
|
|
119
139
|
* Encodes an SVG string into a CSS cursor URL.
|
|
120
140
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdCursorManager.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdCursorManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAI9E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAN,IAAY,cA+BX;AA/BD,WAAY,cAAc;IACxB,+CAA+C;IAC/C,0EAAoB,CAAA;IACpB,mDAAmD;IACnD,6DAAa,CAAA;IACb,0CAA0C;IAC1C,+DAAU,CAAA;IACV,6CAA6C;IAC7C,+DAAU,CAAA;IACV,yBAAyB;IACzB,+DAAU,CAAA;IACV,4CAA4C;IAC5C,6DAAS,CAAA;IACT,+BAA+B;IAC/B,2EAAgB,CAAA;IAChB,8CAA8C;IAC9C,6EAAiB,CAAA;IACjB,yCAAyC;IACzC,6DAAS,CAAA;IACT,8BAA8B;IAC9B,mEAAY,CAAA;IACZ,iDAAiD;IACjD,qEAAa,CAAA;IACb,+CAA+C;IAC/C,kFAAmB,CAAA;IACnB,gDAAgD;IAChD,wEAAc,CAAA;IACd,8BAA8B;IAC9B,0EAAe,CAAA;IACf,mCAAmC;IACnC,oDAAI,CAAA;AACN,CAAC,EA/BW,cAAc,KAAd,cAAc,QA+BzB;AAED;;;;;;;;;GASG;AACH;
|
|
1
|
+
{"version":3,"file":"AcEdCursorManager.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdCursorManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAI9E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAN,IAAY,cA+BX;AA/BD,WAAY,cAAc;IACxB,+CAA+C;IAC/C,0EAAoB,CAAA;IACpB,mDAAmD;IACnD,6DAAa,CAAA;IACb,0CAA0C;IAC1C,+DAAU,CAAA;IACV,6CAA6C;IA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AU,yBAAa,SAAS,uCACnG,QAAQ,GAAG,UAAU,qBAAS,QAAQ,GAAG,UAAU,qBAAS,QAAQ,GAAG,CAAC,GAAG,UAAU,qBAAS,QAAQ,GAAG,UAAU,yBAAa,SAAS,uCACzI,QAAQ,GAAG,UAAU,qBAAS,QAAQ,GAAG,UAAU,qBAAS,QAAQ,GAAG,UAAU,qBAAS,QAAQ,GAAG,CAAC,GAAG,UAAU,yBAAa,SAAS,gDAClI,QAAQ,GAAG,UAAU,qBAAS,UAAU,qBAAS,QAAQ,GAAG,UAAU,yBAAa,SAAS,8BAElH,CAAA;QACD,OAAO,IAAI,CAAC,iBAAiB,CAC3B,GAAG,EACH,QAAQ,GAAG,UAAU,EACrB,QAAQ,GAAG,UAAU,CACtB,CAAA;IACH,CAAC;IACH,wBAAC;AAAD,CAAC,AA7ID,IA6IC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snapshot of modifier key states captured by the editor input system.
|
|
3
|
+
*
|
|
4
|
+
* This mirrors the DOM Keyboard/MouseEvent modifier fields, but is exposed as
|
|
5
|
+
* a stable, command-friendly data object so commands can read modifier state
|
|
6
|
+
* without attaching to raw key/mouse events directly.
|
|
7
|
+
*
|
|
8
|
+
* Notes:
|
|
9
|
+
* - This is a *moment-in-time* state (not a toggle).
|
|
10
|
+
* - Toggle-style behaviors (e.g. Ctrl to flip arc direction) should live in
|
|
11
|
+
* {@link AcEdInputToggles}.
|
|
12
|
+
*/
|
|
13
|
+
export interface AcEdInputModifiers {
|
|
14
|
+
/**
|
|
15
|
+
* Whether the Control key is currently pressed.
|
|
16
|
+
*
|
|
17
|
+
* On Windows/Linux this reflects the physical Ctrl key.
|
|
18
|
+
* On macOS, this reflects the Control key (not Command).
|
|
19
|
+
*/
|
|
20
|
+
ctrlKey: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the Shift key is currently pressed.
|
|
23
|
+
*/
|
|
24
|
+
shiftKey: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the Alt key is currently pressed.
|
|
27
|
+
*
|
|
28
|
+
* On macOS this is the Option key.
|
|
29
|
+
*/
|
|
30
|
+
altKey: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the Meta key is currently pressed.
|
|
33
|
+
*
|
|
34
|
+
* On macOS this is the Command key.
|
|
35
|
+
* On Windows this is the Windows key.
|
|
36
|
+
*/
|
|
37
|
+
metaKey: boolean;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=AcEdInputModifiers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdInputModifiers.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdInputModifiers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAA;IACjB;;;;OAIG;IACH,MAAM,EAAE,OAAO,CAAA;IACf;;;;;OAKG;IACH,OAAO,EAAE,OAAO,CAAA;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdInputModifiers.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdInputModifiers.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toggle-style input flags maintained by the editor input system.
|
|
3
|
+
*
|
|
4
|
+
* These represent *stateful switches* that flip on key press and persist
|
|
5
|
+
* after key release, matching AutoCAD-style behavior where a key acts as a
|
|
6
|
+
* toggle rather than a momentary modifier.
|
|
7
|
+
*
|
|
8
|
+
* Notes:
|
|
9
|
+
* - Toggle states are command-friendly and should be read (not mutated)
|
|
10
|
+
* by commands.
|
|
11
|
+
* - Moment-in-time modifier states live in {@link AcEdInputModifiers}.
|
|
12
|
+
*/
|
|
13
|
+
export interface AcEdInputToggles {
|
|
14
|
+
/**
|
|
15
|
+
* Arc direction flip toggle for PLINE-style arc segments.
|
|
16
|
+
*
|
|
17
|
+
* Behavior:
|
|
18
|
+
* - Each Ctrl key press flips this flag.
|
|
19
|
+
* - Releasing Ctrl does NOT revert it.
|
|
20
|
+
* - The active arc direction should be computed based on this value.
|
|
21
|
+
*/
|
|
22
|
+
ctrlArcFlip: boolean;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=AcEdInputToggles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdInputToggles.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdInputToggles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;OAOG;IACH,WAAW,EAAE,OAAO,CAAA;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdInputToggles.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdInputToggles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Indicates how the state machine should proceed after handling a prompt result.
|
|
3
|
+
*
|
|
4
|
+
* - `continue` keeps the loop running and may transition to another state.
|
|
5
|
+
* - `finish` stops the loop immediately.
|
|
6
|
+
*/
|
|
7
|
+
export type AcEdPromptStateStep = 'continue' | 'finish';
|
|
8
|
+
/**
|
|
9
|
+
* Represents a single prompt step in a state machine workflow.
|
|
10
|
+
*
|
|
11
|
+
* Each state is responsible for:
|
|
12
|
+
* - Building a prompt (options/config) to show to the user.
|
|
13
|
+
* - Handling the prompt result and deciding whether to continue or finish.
|
|
14
|
+
*
|
|
15
|
+
* @typeParam TPromptOptions - The prompt options type passed to the editor.
|
|
16
|
+
* @typeParam TResult - The result type returned by the editor.
|
|
17
|
+
*/
|
|
18
|
+
export interface AcEdPromptState<TPromptOptions, TResult> {
|
|
19
|
+
/**
|
|
20
|
+
* Build the prompt options for this state.
|
|
21
|
+
*/
|
|
22
|
+
buildPrompt(): TPromptOptions;
|
|
23
|
+
/**
|
|
24
|
+
* Handle the prompt result and return the next step directive.
|
|
25
|
+
*
|
|
26
|
+
* @param result - The result returned from the editor for this prompt.
|
|
27
|
+
*/
|
|
28
|
+
handleResult(result: TResult): Promise<AcEdPromptStateStep> | AcEdPromptStateStep;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A lightweight state machine for chaining editor prompts.
|
|
32
|
+
*
|
|
33
|
+
* It repeatedly:
|
|
34
|
+
* 1. Builds a prompt from the current state,
|
|
35
|
+
* 2. Awaits a result from an injected `getResult` function,
|
|
36
|
+
* 3. Lets the state decide whether to continue or finish.
|
|
37
|
+
*
|
|
38
|
+
* The state itself can also mutate the machine by calling `setState(...)`
|
|
39
|
+
* from within `handleResult`.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* type Prompt = { message: string }
|
|
44
|
+
* type Result = { status: 'ok' | 'cancel'; value?: number }
|
|
45
|
+
*
|
|
46
|
+
* class FirstState implements AcEdPromptState<Prompt, Result> {
|
|
47
|
+
* constructor(private sm: AcEdPromptStateMachine<Prompt, Result>) {}
|
|
48
|
+
*
|
|
49
|
+
* buildPrompt() {
|
|
50
|
+
* return { message: 'Enter first value:' }
|
|
51
|
+
* }
|
|
52
|
+
*
|
|
53
|
+
* handleResult(result: Result) {
|
|
54
|
+
* if (result.status !== 'ok') return 'finish'
|
|
55
|
+
* this.sm.setState(new SecondState(this.sm, result.value ?? 0))
|
|
56
|
+
* return 'continue'
|
|
57
|
+
* }
|
|
58
|
+
* }
|
|
59
|
+
*
|
|
60
|
+
* class SecondState implements AcEdPromptState<Prompt, Result> {
|
|
61
|
+
* constructor(
|
|
62
|
+
* private sm: AcEdPromptStateMachine<Prompt, Result>,
|
|
63
|
+
* private firstValue: number
|
|
64
|
+
* ) {}
|
|
65
|
+
*
|
|
66
|
+
* buildPrompt() {
|
|
67
|
+
* return { message: 'Enter second value:' }
|
|
68
|
+
* }
|
|
69
|
+
*
|
|
70
|
+
* handleResult(result: Result) {
|
|
71
|
+
* if (result.status !== 'ok') return 'finish'
|
|
72
|
+
* const sum = this.firstValue + (result.value ?? 0)
|
|
73
|
+
* console.log('sum', sum)
|
|
74
|
+
* return 'finish'
|
|
75
|
+
* }
|
|
76
|
+
* }
|
|
77
|
+
*
|
|
78
|
+
* const sm = new AcEdPromptStateMachine<Prompt, Result>()
|
|
79
|
+
* sm.setState(new FirstState(sm))
|
|
80
|
+
* await sm.run(async prompt => {
|
|
81
|
+
* // Editor interaction happens here:
|
|
82
|
+
* return { status: 'ok', value: 1 }
|
|
83
|
+
* })
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export declare class AcEdPromptStateMachine<TPromptOptions, TResult> {
|
|
87
|
+
/**
|
|
88
|
+
* The current active state. When undefined, the machine is idle.
|
|
89
|
+
*/
|
|
90
|
+
state?: AcEdPromptState<TPromptOptions, TResult>;
|
|
91
|
+
/**
|
|
92
|
+
* Create a new state machine with an optional initial state.
|
|
93
|
+
*
|
|
94
|
+
* @param initialState - The first state to run, if any.
|
|
95
|
+
*/
|
|
96
|
+
constructor(initialState?: AcEdPromptState<TPromptOptions, TResult>);
|
|
97
|
+
/**
|
|
98
|
+
* Replace the current state.
|
|
99
|
+
*
|
|
100
|
+
* @param state - The new state to activate.
|
|
101
|
+
*/
|
|
102
|
+
setState(state: AcEdPromptState<TPromptOptions, TResult>): void;
|
|
103
|
+
/**
|
|
104
|
+
* Run the state machine until a state returns `finish` or an error occurs.
|
|
105
|
+
*
|
|
106
|
+
* @param getResult - Function that executes a prompt and returns its result.
|
|
107
|
+
*/
|
|
108
|
+
run(getResult: (prompt: TPromptOptions) => Promise<TResult>): Promise<void>;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=AcEdPromptStateMachine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdPromptStateMachine.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdPromptStateMachine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEvD;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe,CAAC,cAAc,EAAE,OAAO;IACtD;;OAEG;IACH,WAAW,IAAI,cAAc,CAAA;IAE7B;;;;OAIG;IACH,YAAY,CACV,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAA;CACtD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,qBAAa,sBAAsB,CAAC,cAAc,EAAE,OAAO;IACzD;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC,cAAc,EAAE,OAAO,CAAC,CAAA;IAEhD;;;;OAIG;gBACS,YAAY,CAAC,EAAE,eAAe,CAAC,cAAc,EAAE,OAAO,CAAC;IAInE;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC,cAAc,EAAE,OAAO,CAAC;IAIxD;;;;OAIG;IACG,GAAG,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC;CAYlE"}
|
|
@@ -0,0 +1,147 @@
|
|
|
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
|
+
* A lightweight state machine for chaining editor prompts.
|
|
39
|
+
*
|
|
40
|
+
* It repeatedly:
|
|
41
|
+
* 1. Builds a prompt from the current state,
|
|
42
|
+
* 2. Awaits a result from an injected `getResult` function,
|
|
43
|
+
* 3. Lets the state decide whether to continue or finish.
|
|
44
|
+
*
|
|
45
|
+
* The state itself can also mutate the machine by calling `setState(...)`
|
|
46
|
+
* from within `handleResult`.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* type Prompt = { message: string }
|
|
51
|
+
* type Result = { status: 'ok' | 'cancel'; value?: number }
|
|
52
|
+
*
|
|
53
|
+
* class FirstState implements AcEdPromptState<Prompt, Result> {
|
|
54
|
+
* constructor(private sm: AcEdPromptStateMachine<Prompt, Result>) {}
|
|
55
|
+
*
|
|
56
|
+
* buildPrompt() {
|
|
57
|
+
* return { message: 'Enter first value:' }
|
|
58
|
+
* }
|
|
59
|
+
*
|
|
60
|
+
* handleResult(result: Result) {
|
|
61
|
+
* if (result.status !== 'ok') return 'finish'
|
|
62
|
+
* this.sm.setState(new SecondState(this.sm, result.value ?? 0))
|
|
63
|
+
* return 'continue'
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
*
|
|
67
|
+
* class SecondState implements AcEdPromptState<Prompt, Result> {
|
|
68
|
+
* constructor(
|
|
69
|
+
* private sm: AcEdPromptStateMachine<Prompt, Result>,
|
|
70
|
+
* private firstValue: number
|
|
71
|
+
* ) {}
|
|
72
|
+
*
|
|
73
|
+
* buildPrompt() {
|
|
74
|
+
* return { message: 'Enter second value:' }
|
|
75
|
+
* }
|
|
76
|
+
*
|
|
77
|
+
* handleResult(result: Result) {
|
|
78
|
+
* if (result.status !== 'ok') return 'finish'
|
|
79
|
+
* const sum = this.firstValue + (result.value ?? 0)
|
|
80
|
+
* console.log('sum', sum)
|
|
81
|
+
* return 'finish'
|
|
82
|
+
* }
|
|
83
|
+
* }
|
|
84
|
+
*
|
|
85
|
+
* const sm = new AcEdPromptStateMachine<Prompt, Result>()
|
|
86
|
+
* sm.setState(new FirstState(sm))
|
|
87
|
+
* await sm.run(async prompt => {
|
|
88
|
+
* // Editor interaction happens here:
|
|
89
|
+
* return { status: 'ok', value: 1 }
|
|
90
|
+
* })
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
var AcEdPromptStateMachine = /** @class */ (function () {
|
|
94
|
+
/**
|
|
95
|
+
* Create a new state machine with an optional initial state.
|
|
96
|
+
*
|
|
97
|
+
* @param initialState - The first state to run, if any.
|
|
98
|
+
*/
|
|
99
|
+
function AcEdPromptStateMachine(initialState) {
|
|
100
|
+
this.state = initialState;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Replace the current state.
|
|
104
|
+
*
|
|
105
|
+
* @param state - The new state to activate.
|
|
106
|
+
*/
|
|
107
|
+
AcEdPromptStateMachine.prototype.setState = function (state) {
|
|
108
|
+
this.state = state;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Run the state machine until a state returns `finish` or an error occurs.
|
|
112
|
+
*
|
|
113
|
+
* @param getResult - Function that executes a prompt and returns its result.
|
|
114
|
+
*/
|
|
115
|
+
AcEdPromptStateMachine.prototype.run = function (getResult) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
117
|
+
var prompt_1, result, step, _a;
|
|
118
|
+
return __generator(this, function (_b) {
|
|
119
|
+
switch (_b.label) {
|
|
120
|
+
case 0:
|
|
121
|
+
if (!this.state) return [3 /*break*/, 6];
|
|
122
|
+
_b.label = 1;
|
|
123
|
+
case 1:
|
|
124
|
+
_b.trys.push([1, 4, , 5]);
|
|
125
|
+
prompt_1 = this.state.buildPrompt();
|
|
126
|
+
return [4 /*yield*/, getResult(prompt_1)];
|
|
127
|
+
case 2:
|
|
128
|
+
result = _b.sent();
|
|
129
|
+
return [4 /*yield*/, this.state.handleResult(result)];
|
|
130
|
+
case 3:
|
|
131
|
+
step = _b.sent();
|
|
132
|
+
if (step === 'finish')
|
|
133
|
+
return [3 /*break*/, 6];
|
|
134
|
+
return [3 /*break*/, 5];
|
|
135
|
+
case 4:
|
|
136
|
+
_a = _b.sent();
|
|
137
|
+
return [3 /*break*/, 6];
|
|
138
|
+
case 5: return [3 /*break*/, 0];
|
|
139
|
+
case 6: return [2 /*return*/];
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
return AcEdPromptStateMachine;
|
|
145
|
+
}());
|
|
146
|
+
export { AcEdPromptStateMachine };
|
|
147
|
+
//# sourceMappingURL=AcEdPromptStateMachine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdPromptStateMachine.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdPromptStateMachine.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH;IAME;;;;OAIG;IACH,gCAAY,YAAuD;QACjE,IAAI,CAAC,KAAK,GAAG,YAAY,CAAA;IAC3B,CAAC;IAED;;;;OAIG;IACH,yCAAQ,GAAR,UAAS,KAA+C;QACtD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED;;;;OAIG;IACG,oCAAG,GAAT,UAAU,SAAuD;;;;;;6BACxD,IAAI,CAAC,KAAK;;;;wBAEP,WAAS,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAA;wBACxB,qBAAM,SAAS,CAAC,QAAM,CAAC,EAAA;;wBAAhC,MAAM,GAAG,SAAuB;wBACzB,qBAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,EAAA;;wBAA5C,IAAI,GAAG,SAAqC;wBAClD,IAAI,IAAI,KAAK,QAAQ;4BAAE,wBAAK;;;;wBAE5B,wBAAK;;;;;;KAGV;IACH,6BAAC;AAAD,CAAC,AAzCD,IAyCC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { AcDbEntity, AcDbTypedValue } from '@mlightcad/data-model';
|
|
2
|
+
/**
|
|
3
|
+
* Represents one entity filter expression for selection operations.
|
|
4
|
+
*
|
|
5
|
+
* This class is inspired by AutoCAD .NET `SelectionFilter`, where filter clauses
|
|
6
|
+
* are expressed by typed DXF values. Conditions are evaluated with AND semantics.
|
|
7
|
+
*
|
|
8
|
+
* Supported typed values:
|
|
9
|
+
* - `AcDbDxfCode.Start` => entity type (DXF type or runtime type)
|
|
10
|
+
* - `AcDbDxfCode.LayerName` => layer name
|
|
11
|
+
* - `AcDbDxfCode.ColorName` => `entity.color.toString()`
|
|
12
|
+
* - `AcDbDxfCode.LinetypeName` => line type name
|
|
13
|
+
* - `AcDbDxfCode.LineWeight` => lineweight
|
|
14
|
+
* - `AcDbDxfCode.Operator` => comparison operator for next clause
|
|
15
|
+
*
|
|
16
|
+
* Supported operator tokens:
|
|
17
|
+
* - `=`, `==`
|
|
18
|
+
* - `!=`, `<>`
|
|
19
|
+
* - `>`, `>=`, `<`, `<=`
|
|
20
|
+
*/
|
|
21
|
+
export declare class AcEdSelectionFilter {
|
|
22
|
+
private readonly _typedValues;
|
|
23
|
+
constructor(values?: AcDbTypedValue[]);
|
|
24
|
+
/**
|
|
25
|
+
* Returns typed values used by this filter.
|
|
26
|
+
*/
|
|
27
|
+
get typedValues(): AcDbTypedValue<unknown>[];
|
|
28
|
+
/**
|
|
29
|
+
* Returns whether the specified entity satisfies all filter clauses.
|
|
30
|
+
*/
|
|
31
|
+
matches(entity: AcDbEntity): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Parses one operator token from typed-value input.
|
|
34
|
+
*
|
|
35
|
+
* Accepted tokens follow common AutoCAD comparison syntax. Unknown values
|
|
36
|
+
* safely fall back to equality.
|
|
37
|
+
*
|
|
38
|
+
* @param raw - Raw operator token (usually from `AcDbDxfCode.Operator`)
|
|
39
|
+
* @returns Normalized internal comparison operator
|
|
40
|
+
*/
|
|
41
|
+
private parseOperator;
|
|
42
|
+
/**
|
|
43
|
+
* Evaluates whether one typed-value clause matches the given entity.
|
|
44
|
+
*
|
|
45
|
+
* The method first resolves an entity-side value by DXF code, then compares
|
|
46
|
+
* it with the filter value using the operator currently in effect.
|
|
47
|
+
*
|
|
48
|
+
* @param entity - Entity being tested
|
|
49
|
+
* @param tv - Typed-value clause (`code` + `value`)
|
|
50
|
+
* @param op - Comparison operator for this clause
|
|
51
|
+
* @returns `true` if the clause matches; otherwise `false`
|
|
52
|
+
*/
|
|
53
|
+
private matchTypedValue;
|
|
54
|
+
/**
|
|
55
|
+
* Resolves the entity property value associated with one DXF group code.
|
|
56
|
+
*
|
|
57
|
+
* Only codes used by current Quick Select flow are mapped. Unsupported
|
|
58
|
+
* codes return `undefined` and are treated as non-matching clauses.
|
|
59
|
+
*
|
|
60
|
+
* @param entity - Source entity
|
|
61
|
+
* @param code - DXF code indicating which property to read
|
|
62
|
+
* @returns Resolved value for comparison, or `undefined` if unsupported
|
|
63
|
+
*/
|
|
64
|
+
private resolveEntityValue;
|
|
65
|
+
/**
|
|
66
|
+
* Compares runtime value and filter value with the given operator.
|
|
67
|
+
*
|
|
68
|
+
* Comparison strategy:
|
|
69
|
+
* - Numeric path: when both values are finite numbers
|
|
70
|
+
* - String path: case-insensitive lexicographic comparison otherwise
|
|
71
|
+
*
|
|
72
|
+
* @param actual - Runtime value resolved from entity
|
|
73
|
+
* @param expected - Target value from filter clause
|
|
74
|
+
* @param op - Comparison operator
|
|
75
|
+
* @returns `true` when comparison succeeds; otherwise `false`
|
|
76
|
+
*/
|
|
77
|
+
private compare;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=AcEdSelectionFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdSelectionFilter.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdSelectionFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAU/E;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkB;gBAEnC,MAAM,GAAE,cAAc,EAAO;IAIzC;;OAEG;IACH,IAAI,WAAW,8BAEd;IAED;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO;IAqBpC;;;;;;;;OAQG;IACH,OAAO,CAAC,aAAa;IAqBrB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,eAAe;IAYvB;;;;;;;;;OASG;IACH,OAAO,CAAC,kBAAkB;IAiB1B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,OAAO;CA+ChB"}
|