@mlightcad/cad-simple-viewer 1.4.12 → 1.5.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 +35505 -24550
- package/dist/index.umd.cjs +180 -49
- package/dist/libredwg-parser-worker.js +4874 -4548
- package/dist/mtext-renderer-worker.js +3587 -3534
- package/lib/app/AcApDocManager.d.ts +73 -8
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +216 -46
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/command/AcApLogCmd.d.ts +1 -1
- package/lib/command/AcApLogCmd.d.ts.map +1 -1
- package/lib/command/AcApLogCmd.js +1 -1
- package/lib/command/AcApLogCmd.js.map +1 -1
- package/lib/command/AcApOpenCmd.d.ts +1 -1
- package/lib/command/AcApOpenCmd.d.ts.map +1 -1
- package/lib/command/AcApOpenCmd.js +1 -2
- package/lib/command/AcApOpenCmd.js.map +1 -1
- package/lib/command/AcApPanCmd.d.ts +1 -1
- package/lib/command/AcApPanCmd.d.ts.map +1 -1
- package/lib/command/AcApPanCmd.js +1 -2
- package/lib/command/AcApPanCmd.js.map +1 -1
- package/lib/command/AcApQNewCmd.d.ts +1 -1
- package/lib/command/AcApQNewCmd.d.ts.map +1 -1
- package/lib/command/AcApQNewCmd.js +1 -1
- package/lib/command/AcApQNewCmd.js.map +1 -1
- package/lib/command/AcApRegenCmd.d.ts +1 -1
- package/lib/command/AcApRegenCmd.d.ts.map +1 -1
- package/lib/command/AcApRegenCmd.js +1 -1
- package/lib/command/AcApRegenCmd.js.map +1 -1
- package/lib/command/AcApSelectCmd.d.ts +1 -1
- package/lib/command/AcApSelectCmd.d.ts.map +1 -1
- package/lib/command/AcApSelectCmd.js +1 -2
- package/lib/command/AcApSelectCmd.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/{AcApConvertToDxfCmd.d.ts → convert/AcApConvertToDxfCmd.d.ts} +2 -2
- package/lib/command/convert/AcApConvertToDxfCmd.d.ts.map +1 -0
- package/lib/command/{AcApConvertToDxfCmd.js → convert/AcApConvertToDxfCmd.js} +1 -1
- package/lib/command/convert/AcApConvertToDxfCmd.js.map +1 -0
- package/lib/command/convert/AcApConvertToPngCmd.d.ts +53 -0
- package/lib/command/convert/AcApConvertToPngCmd.d.ts.map +1 -0
- package/lib/command/convert/AcApConvertToPngCmd.js +200 -0
- package/lib/command/convert/AcApConvertToPngCmd.js.map +1 -0
- package/lib/command/{AcApConvertToSvgCmd.d.ts → convert/AcApConvertToSvgCmd.d.ts} +2 -2
- package/lib/command/convert/AcApConvertToSvgCmd.d.ts.map +1 -0
- package/lib/command/{AcApConvertToSvgCmd.js → convert/AcApConvertToSvgCmd.js} +1 -1
- package/lib/command/convert/AcApConvertToSvgCmd.js.map +1 -0
- package/lib/command/convert/AcApDxfConvertor.d.ts.map +1 -0
- package/lib/command/{AcApDxfConvertor.js → convert/AcApDxfConvertor.js} +1 -1
- package/lib/command/convert/AcApDxfConvertor.js.map +1 -0
- package/lib/command/convert/AcApPngConvertor.d.ts +80 -0
- package/lib/command/convert/AcApPngConvertor.d.ts.map +1 -0
- package/lib/command/convert/AcApPngConvertor.js +233 -0
- package/lib/command/convert/AcApPngConvertor.js.map +1 -0
- package/lib/command/convert/AcApSvgConvertor.d.ts.map +1 -0
- package/lib/command/{AcApSvgConvertor.js → convert/AcApSvgConvertor.js} +1 -1
- package/lib/command/convert/AcApSvgConvertor.js.map +1 -0
- package/lib/command/convert/index.d.ts +6 -0
- package/lib/command/convert/index.d.ts.map +1 -0
- package/lib/command/convert/index.js +6 -0
- package/lib/command/convert/index.js.map +1 -0
- package/lib/command/draw/AcApArcCmd.d.ts +297 -0
- package/lib/command/draw/AcApArcCmd.d.ts.map +1 -0
- package/lib/command/{AcApArcCmd.js → draw/AcApArcCmd.js} +794 -13
- package/lib/command/draw/AcApArcCmd.js.map +1 -0
- package/lib/command/draw/AcApCircleCmd.d.ts +81 -0
- package/lib/command/draw/AcApCircleCmd.d.ts.map +1 -0
- package/lib/command/draw/AcApCircleCmd.js +594 -0
- package/lib/command/draw/AcApCircleCmd.js.map +1 -0
- package/lib/command/{AcApDimLinearCmd.d.ts → draw/AcApDimLinearCmd.d.ts} +2 -2
- package/lib/command/draw/AcApDimLinearCmd.d.ts.map +1 -0
- package/lib/command/{AcApDimLinearCmd.js → draw/AcApDimLinearCmd.js} +3 -3
- package/lib/command/draw/AcApDimLinearCmd.js.map +1 -0
- package/lib/command/draw/AcApEllipseCmd.d.ts +87 -0
- package/lib/command/draw/AcApEllipseCmd.d.ts.map +1 -0
- package/lib/command/draw/AcApEllipseCmd.js +583 -0
- package/lib/command/draw/AcApEllipseCmd.js.map +1 -0
- package/lib/command/draw/AcApHatchCmd.d.ts +247 -0
- package/lib/command/draw/AcApHatchCmd.d.ts.map +1 -0
- package/lib/command/draw/AcApHatchCmd.js +900 -0
- package/lib/command/draw/AcApHatchCmd.js.map +1 -0
- package/lib/command/draw/AcApLineCmd.d.ts +57 -0
- package/lib/command/draw/AcApLineCmd.d.ts.map +1 -0
- package/lib/command/draw/AcApLineCmd.js +263 -0
- package/lib/command/draw/AcApLineCmd.js.map +1 -0
- package/lib/command/draw/AcApMLineCmd.d.ts +31 -0
- package/lib/command/draw/AcApMLineCmd.d.ts.map +1 -0
- package/lib/command/draw/AcApMLineCmd.js +531 -0
- package/lib/command/draw/AcApMLineCmd.js.map +1 -0
- package/lib/command/{AcApMTextCmd.d.ts → draw/AcApMTextCmd.d.ts} +2 -2
- package/lib/command/draw/AcApMTextCmd.d.ts.map +1 -0
- package/lib/command/{AcApMTextCmd.js → draw/AcApMTextCmd.js} +3 -3
- package/lib/command/draw/AcApMTextCmd.js.map +1 -0
- package/lib/command/draw/AcApPointCmd.d.ts +16 -0
- package/lib/command/draw/AcApPointCmd.d.ts.map +1 -0
- package/lib/command/{AcApZoomToBoxCmd.js → draw/AcApPointCmd.js} +32 -37
- package/lib/command/draw/AcApPointCmd.js.map +1 -0
- package/lib/command/draw/AcApPolygonCmd.d.ts +69 -0
- package/lib/command/draw/AcApPolygonCmd.d.ts.map +1 -0
- package/lib/command/draw/AcApPolygonCmd.js +422 -0
- package/lib/command/draw/AcApPolygonCmd.js.map +1 -0
- package/lib/command/{AcApPolylineCmd.d.ts → draw/AcApPolylineCmd.d.ts} +2 -2
- package/lib/command/draw/AcApPolylineCmd.d.ts.map +1 -0
- package/lib/command/{AcApPolylineCmd.js → draw/AcApPolylineCmd.js} +3 -3
- package/lib/command/draw/AcApPolylineCmd.js.map +1 -0
- package/lib/command/draw/AcApRayCmd.d.ts +10 -0
- package/lib/command/draw/AcApRayCmd.d.ts.map +1 -0
- package/lib/command/{AcApLineCmd.js → draw/AcApRayCmd.js} +63 -44
- package/lib/command/draw/AcApRayCmd.js.map +1 -0
- package/lib/command/draw/AcApRectCmd.d.ts +168 -0
- package/lib/command/draw/AcApRectCmd.d.ts.map +1 -0
- package/lib/command/draw/AcApRectCmd.js +822 -0
- package/lib/command/draw/AcApRectCmd.js.map +1 -0
- package/lib/command/draw/AcApSplineCmd.d.ts +85 -0
- package/lib/command/draw/AcApSplineCmd.d.ts.map +1 -0
- package/lib/command/draw/AcApSplineCmd.js +620 -0
- package/lib/command/draw/AcApSplineCmd.js.map +1 -0
- package/lib/command/draw/AcApXLineCmd.d.ts +25 -0
- package/lib/command/draw/AcApXLineCmd.d.ts.map +1 -0
- package/lib/command/draw/AcApXLineCmd.js +210 -0
- package/lib/command/draw/AcApXLineCmd.js.map +1 -0
- package/lib/command/draw/index.d.ts +16 -0
- package/lib/command/draw/index.d.ts.map +1 -0
- package/lib/command/draw/index.js +16 -0
- package/lib/command/draw/index.js.map +1 -0
- package/lib/command/index.d.ts +6 -26
- package/lib/command/index.d.ts.map +1 -1
- package/lib/command/index.js +6 -26
- package/lib/command/index.js.map +1 -1
- package/lib/command/layer/AcApLayerCloseCmd.d.ts +23 -0
- package/lib/command/layer/AcApLayerCloseCmd.d.ts.map +1 -0
- package/lib/command/{AcApRevRectCmd.js → layer/AcApLayerCloseCmd.js} +27 -24
- package/lib/command/layer/AcApLayerCloseCmd.js.map +1 -0
- package/lib/command/layer/AcApLayerCmd.d.ts +215 -0
- package/lib/command/layer/AcApLayerCmd.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerCmd.js +765 -0
- package/lib/command/layer/AcApLayerCmd.js.map +1 -0
- package/lib/command/layer/AcApLayerCurCmd.d.ts +43 -0
- package/lib/command/layer/AcApLayerCurCmd.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerCurCmd.js +183 -0
- package/lib/command/layer/AcApLayerCurCmd.js.map +1 -0
- package/lib/command/layer/AcApLayerDelCmd.d.ts +112 -0
- package/lib/command/layer/AcApLayerDelCmd.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerDelCmd.js +446 -0
- package/lib/command/layer/AcApLayerDelCmd.js.map +1 -0
- package/lib/command/layer/AcApLayerFreezeCmd.d.ts +103 -0
- package/lib/command/layer/AcApLayerFreezeCmd.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerFreezeCmd.js +398 -0
- package/lib/command/layer/AcApLayerFreezeCmd.js.map +1 -0
- package/lib/command/layer/AcApLayerIsoCmd.d.ts +99 -0
- package/lib/command/layer/AcApLayerIsoCmd.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerIsoCmd.js +485 -0
- package/lib/command/layer/AcApLayerIsoCmd.js.map +1 -0
- package/lib/command/layer/AcApLayerIsoState.d.ts +68 -0
- package/lib/command/layer/AcApLayerIsoState.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerIsoState.js +53 -0
- package/lib/command/layer/AcApLayerIsoState.js.map +1 -0
- package/lib/command/layer/AcApLayerLockCmd.d.ts +50 -0
- package/lib/command/layer/AcApLayerLockCmd.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerLockCmd.js +175 -0
- package/lib/command/layer/AcApLayerLockCmd.js.map +1 -0
- package/lib/command/layer/AcApLayerOffCmd.d.ts +95 -0
- package/lib/command/layer/AcApLayerOffCmd.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerOffCmd.js +384 -0
- package/lib/command/layer/AcApLayerOffCmd.js.map +1 -0
- package/lib/command/layer/AcApLayerOnCmd.d.ts +30 -0
- package/lib/command/layer/AcApLayerOnCmd.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerOnCmd.js +138 -0
- package/lib/command/layer/AcApLayerOnCmd.js.map +1 -0
- package/lib/command/layer/AcApLayerPCmd.d.ts +83 -0
- package/lib/command/layer/AcApLayerPCmd.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerPCmd.js +241 -0
- package/lib/command/layer/AcApLayerPCmd.js.map +1 -0
- package/lib/command/layer/AcApLayerThawCmd.d.ts +37 -0
- package/lib/command/layer/AcApLayerThawCmd.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerThawCmd.js +150 -0
- package/lib/command/layer/AcApLayerThawCmd.js.map +1 -0
- package/lib/command/layer/AcApLayerUnisoCmd.d.ts +52 -0
- package/lib/command/layer/AcApLayerUnisoCmd.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerUnisoCmd.js +199 -0
- package/lib/command/layer/AcApLayerUnisoCmd.js.map +1 -0
- package/lib/command/layer/AcApLayerUnlockCmd.d.ts +50 -0
- package/lib/command/layer/AcApLayerUnlockCmd.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerUnlockCmd.js +175 -0
- package/lib/command/layer/AcApLayerUnlockCmd.js.map +1 -0
- package/lib/command/layer/index.d.ts +14 -0
- package/lib/command/layer/index.d.ts.map +1 -0
- package/lib/command/layer/index.js +14 -0
- package/lib/command/layer/index.js.map +1 -0
- package/lib/command/{AcApClearMeasurementsCmd.d.ts → measure/AcApClearMeasurementsCmd.d.ts} +2 -2
- package/lib/command/measure/AcApClearMeasurementsCmd.d.ts.map +1 -0
- package/lib/command/{AcApClearMeasurementsCmd.js → measure/AcApClearMeasurementsCmd.js} +1 -1
- package/lib/command/measure/AcApClearMeasurementsCmd.js.map +1 -0
- package/lib/command/{AcApMeasureAngleCmd.d.ts → measure/AcApMeasureAngleCmd.d.ts} +2 -2
- package/lib/command/measure/AcApMeasureAngleCmd.d.ts.map +1 -0
- package/lib/command/{AcApMeasureAngleCmd.js → measure/AcApMeasureAngleCmd.js} +3 -3
- package/lib/command/measure/AcApMeasureAngleCmd.js.map +1 -0
- package/lib/command/{AcApMeasureArcCmd.d.ts → measure/AcApMeasureArcCmd.d.ts} +2 -2
- package/lib/command/measure/AcApMeasureArcCmd.d.ts.map +1 -0
- package/lib/command/{AcApMeasureArcCmd.js → measure/AcApMeasureArcCmd.js} +3 -3
- package/lib/command/measure/AcApMeasureArcCmd.js.map +1 -0
- package/lib/command/{AcApMeasureAreaCmd.d.ts → measure/AcApMeasureAreaCmd.d.ts} +2 -2
- package/lib/command/measure/AcApMeasureAreaCmd.d.ts.map +1 -0
- package/lib/command/{AcApMeasureAreaCmd.js → measure/AcApMeasureAreaCmd.js} +6 -3
- package/lib/command/measure/AcApMeasureAreaCmd.js.map +1 -0
- package/lib/command/{AcApMeasureDistanceCmd.d.ts → measure/AcApMeasureDistanceCmd.d.ts} +2 -2
- package/lib/command/measure/AcApMeasureDistanceCmd.d.ts.map +1 -0
- package/lib/command/{AcApMeasureDistanceCmd.js → measure/AcApMeasureDistanceCmd.js} +3 -3
- package/lib/command/measure/AcApMeasureDistanceCmd.js.map +1 -0
- package/lib/command/measure/index.d.ts +6 -0
- package/lib/command/measure/index.d.ts.map +1 -0
- package/lib/command/measure/index.js +6 -0
- package/lib/command/measure/index.js.map +1 -0
- package/lib/command/modify/AcApCopyCmd.d.ts +94 -0
- package/lib/command/modify/AcApCopyCmd.d.ts.map +1 -0
- package/lib/command/modify/AcApCopyCmd.js +549 -0
- package/lib/command/modify/AcApCopyCmd.js.map +1 -0
- package/lib/command/{AcApEraseCmd.d.ts → modify/AcApEraseCmd.d.ts} +2 -2
- package/lib/command/modify/AcApEraseCmd.d.ts.map +1 -0
- package/lib/command/{AcApEraseCmd.js → modify/AcApEraseCmd.js} +3 -5
- package/lib/command/modify/AcApEraseCmd.js.map +1 -0
- package/lib/command/modify/AcApMoveCmd.d.ts +16 -0
- package/lib/command/modify/AcApMoveCmd.d.ts.map +1 -0
- package/lib/command/modify/AcApMoveCmd.js +277 -0
- package/lib/command/modify/AcApMoveCmd.js.map +1 -0
- package/lib/command/modify/AcApRotateCmd.d.ts +81 -0
- package/lib/command/modify/AcApRotateCmd.d.ts.map +1 -0
- package/lib/command/modify/AcApRotateCmd.js +487 -0
- package/lib/command/modify/AcApRotateCmd.js.map +1 -0
- package/lib/command/modify/index.d.ts +5 -0
- package/lib/command/modify/index.d.ts.map +1 -0
- package/lib/command/modify/index.js +5 -0
- package/lib/command/modify/index.js.map +1 -0
- package/lib/command/{AcApBaseRevCmd.d.ts → review/AcApBaseRevCmd.d.ts} +2 -2
- package/lib/command/review/AcApBaseRevCmd.d.ts.map +1 -0
- package/lib/command/{AcApBaseRevCmd.js → review/AcApBaseRevCmd.js} +2 -2
- package/lib/command/review/AcApBaseRevCmd.js.map +1 -0
- package/lib/command/review/AcApRevCircleCmd.d.ts +18 -0
- package/lib/command/review/AcApRevCircleCmd.d.ts.map +1 -0
- package/lib/command/{AcApCircleCmd.js → review/AcApRevCircleCmd.js} +26 -42
- package/lib/command/review/AcApRevCircleCmd.js.map +1 -0
- package/lib/command/{AcApRevCloudCmd.d.ts → review/AcApRevCloudCmd.d.ts} +2 -2
- package/lib/command/review/AcApRevCloudCmd.d.ts.map +1 -0
- package/lib/command/{AcApRevCloudCmd.js → review/AcApRevCloudCmd.js} +3 -3
- package/lib/command/review/AcApRevCloudCmd.js.map +1 -0
- package/lib/command/review/AcApRevRectCmd.d.ts +18 -0
- package/lib/command/review/AcApRevRectCmd.d.ts.map +1 -0
- package/lib/command/{AcApRectCmd.js → review/AcApRevRectCmd.js} +43 -28
- package/lib/command/review/AcApRevRectCmd.js.map +1 -0
- package/lib/command/{AcApRevVisibilityCmd.d.ts → review/AcApRevVisibilityCmd.d.ts} +1 -1
- package/lib/command/review/AcApRevVisibilityCmd.d.ts.map +1 -0
- package/lib/command/{AcApRevVisibilityCmd.js → review/AcApRevVisibilityCmd.js} +2 -2
- package/lib/command/review/AcApRevVisibilityCmd.js.map +1 -0
- package/lib/command/{AcApSketchCmd.d.ts → review/AcApSketchCmd.d.ts} +2 -2
- package/lib/command/review/AcApSketchCmd.d.ts.map +1 -0
- package/lib/command/{AcApSketchCmd.js → review/AcApSketchCmd.js} +3 -3
- package/lib/command/review/AcApSketchCmd.js.map +1 -0
- package/lib/command/review/index.d.ts +7 -0
- package/lib/command/review/index.d.ts.map +1 -0
- package/lib/command/review/index.js +7 -0
- package/lib/command/review/index.js.map +1 -0
- 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/eventBus.d.ts +4 -6
- package/lib/editor/global/eventBus.d.ts.map +1 -1
- package/lib/editor/global/eventBus.js.map +1 -1
- 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 +37 -2
- package/lib/editor/input/AcEditor.d.ts.map +1 -1
- package/lib/editor/input/AcEditor.js +89 -0
- package/lib/editor/input/AcEditor.js.map +1 -1
- package/lib/editor/input/index.d.ts +1 -0
- package/lib/editor/input/index.d.ts.map +1 -1
- package/lib/editor/input/index.js +1 -0
- package/lib/editor/input/index.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 +19 -0
- package/lib/editor/input/prompt/AcEdKeywordCollection.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts +7 -0
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.js +17 -0
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptBoxOptions.d.ts +6 -0
- package/lib/editor/input/prompt/AcEdPromptBoxOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptBoxOptions.js +16 -0
- package/lib/editor/input/prompt/AcEdPromptBoxOptions.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptEntityOptions.d.ts +17 -0
- package/lib/editor/input/prompt/AcEdPromptEntityOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptEntityOptions.js +30 -3
- package/lib/editor/input/prompt/AcEdPromptEntityOptions.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptOptions.d.ts +6 -1
- package/lib/editor/input/prompt/AcEdPromptOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptOptions.js +7 -0
- package/lib/editor/input/prompt/AcEdPromptOptions.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts +6 -0
- package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptPointOptions.js +16 -0
- package/lib/editor/input/prompt/AcEdPromptPointOptions.js.map +1 -1
- package/lib/editor/input/session/AcEdKeywordSession.d.ts +65 -0
- package/lib/editor/input/session/AcEdKeywordSession.d.ts.map +1 -1
- package/lib/editor/input/session/AcEdKeywordSession.js +71 -0
- package/lib/editor/input/session/AcEdKeywordSession.js.map +1 -1
- package/lib/editor/input/ui/AcEdCommandLine.d.ts +29 -4
- package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdCommandLine.js +118 -24
- package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts +1 -0
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInput.js +12 -4
- package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts +23 -1
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.js +32 -9
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +28 -0
- package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.d.ts +377 -16
- package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.js +994 -529
- package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
- package/lib/editor/input/ui/AcEdMessageType.d.ts +10 -0
- package/lib/editor/input/ui/AcEdMessageType.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdMessageType.js +2 -0
- package/lib/editor/input/ui/AcEdMessageType.js.map +1 -0
- 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 +42 -10
- package/lib/editor/input/ui/AcEdRubberBand.js.map +1 -1
- package/lib/editor/input/ui/index.d.ts +1 -0
- package/lib/editor/input/ui/index.d.ts.map +1 -1
- package/lib/editor/input/ui/index.js +1 -0
- package/lib/editor/input/ui/index.js.map +1 -1
- package/lib/editor/view/AcEdBaseView.d.ts +3 -8
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
- package/lib/editor/view/AcEdBaseView.js +3 -5
- package/lib/editor/view/AcEdBaseView.js.map +1 -1
- package/lib/editor/view/AcEdHoverController.d.ts +2 -3
- package/lib/editor/view/AcEdHoverController.d.ts.map +1 -1
- package/lib/editor/view/AcEdHoverController.js +7 -0
- package/lib/editor/view/AcEdHoverController.js.map +1 -1
- package/lib/editor/view/AcEdSelectionAction.d.ts +108 -0
- package/lib/editor/view/AcEdSelectionAction.d.ts.map +1 -0
- package/lib/editor/view/AcEdSelectionAction.js +74 -0
- package/lib/editor/view/AcEdSelectionAction.js.map +1 -0
- package/lib/editor/view/index.d.ts +1 -0
- package/lib/editor/view/index.d.ts.map +1 -1
- package/lib/editor/view/index.js +1 -0
- package/lib/editor/view/index.js.map +1 -1
- package/lib/i18n/en/command.d.ts +148 -10
- package/lib/i18n/en/command.d.ts.map +1 -1
- package/lib/i18n/en/command.js +153 -15
- package/lib/i18n/en/command.js.map +1 -1
- package/lib/i18n/en/jig.d.ts +838 -36
- package/lib/i18n/en/jig.d.ts.map +1 -1
- package/lib/i18n/en/jig.js +827 -25
- package/lib/i18n/en/jig.js.map +1 -1
- package/lib/i18n/zh/command.d.ts +148 -10
- package/lib/i18n/zh/command.d.ts.map +1 -1
- package/lib/i18n/zh/command.js +155 -17
- package/lib/i18n/zh/command.js.map +1 -1
- package/lib/i18n/zh/jig.d.ts +851 -49
- package/lib/i18n/zh/jig.d.ts.map +1 -1
- package/lib/i18n/zh/jig.js +829 -27
- 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/spatialIndex/AcTrHierarchicalSpatialIndex.d.ts +136 -2
- package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.d.ts.map +1 -1
- package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.js +154 -16
- package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.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/AcTrLayout.d.ts +17 -0
- package/lib/view/AcTrLayout.d.ts.map +1 -1
- package/lib/view/AcTrLayout.js +34 -2
- package/lib/view/AcTrLayout.js.map +1 -1
- package/lib/view/AcTrPickResultUtil.d.ts +4 -0
- package/lib/view/AcTrPickResultUtil.d.ts.map +1 -0
- package/lib/view/AcTrPickResultUtil.js +54 -0
- package/lib/view/AcTrPickResultUtil.js.map +1 -0
- package/lib/view/AcTrView2d.d.ts +25 -1
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +242 -104
- package/lib/view/AcTrView2d.js.map +1 -1
- package/package.json +11 -9
- package/lib/command/AcApArcCmd.d.ts +0 -140
- package/lib/command/AcApArcCmd.d.ts.map +0 -1
- package/lib/command/AcApArcCmd.js.map +0 -1
- package/lib/command/AcApBaseRevCmd.d.ts.map +0 -1
- package/lib/command/AcApBaseRevCmd.js.map +0 -1
- package/lib/command/AcApCircleCmd.d.ts +0 -22
- package/lib/command/AcApCircleCmd.d.ts.map +0 -1
- package/lib/command/AcApCircleCmd.js.map +0 -1
- package/lib/command/AcApClearMeasurementsCmd.d.ts.map +0 -1
- package/lib/command/AcApClearMeasurementsCmd.js.map +0 -1
- package/lib/command/AcApConvertToDxfCmd.d.ts.map +0 -1
- package/lib/command/AcApConvertToDxfCmd.js.map +0 -1
- package/lib/command/AcApConvertToSvgCmd.d.ts.map +0 -1
- package/lib/command/AcApConvertToSvgCmd.js.map +0 -1
- package/lib/command/AcApDimLinearCmd.d.ts.map +0 -1
- package/lib/command/AcApDimLinearCmd.js.map +0 -1
- package/lib/command/AcApDxfConvertor.d.ts.map +0 -1
- package/lib/command/AcApDxfConvertor.js.map +0 -1
- package/lib/command/AcApEraseCmd.d.ts.map +0 -1
- package/lib/command/AcApEraseCmd.js.map +0 -1
- package/lib/command/AcApLineCmd.d.ts +0 -22
- package/lib/command/AcApLineCmd.d.ts.map +0 -1
- package/lib/command/AcApLineCmd.js.map +0 -1
- package/lib/command/AcApMTextCmd.d.ts.map +0 -1
- package/lib/command/AcApMTextCmd.js.map +0 -1
- package/lib/command/AcApMeasureAngleCmd.d.ts.map +0 -1
- package/lib/command/AcApMeasureAngleCmd.js.map +0 -1
- package/lib/command/AcApMeasureArcCmd.d.ts.map +0 -1
- package/lib/command/AcApMeasureArcCmd.js.map +0 -1
- package/lib/command/AcApMeasureAreaCmd.d.ts.map +0 -1
- package/lib/command/AcApMeasureAreaCmd.js.map +0 -1
- package/lib/command/AcApMeasureDistanceCmd.d.ts.map +0 -1
- package/lib/command/AcApMeasureDistanceCmd.js.map +0 -1
- package/lib/command/AcApPolylineCmd.d.ts.map +0 -1
- package/lib/command/AcApPolylineCmd.js.map +0 -1
- package/lib/command/AcApRectCmd.d.ts +0 -23
- package/lib/command/AcApRectCmd.d.ts.map +0 -1
- package/lib/command/AcApRectCmd.js.map +0 -1
- package/lib/command/AcApRevCircleCmd.d.ts +0 -10
- package/lib/command/AcApRevCircleCmd.d.ts.map +0 -1
- package/lib/command/AcApRevCircleCmd.js +0 -83
- package/lib/command/AcApRevCircleCmd.js.map +0 -1
- package/lib/command/AcApRevCloudCmd.d.ts.map +0 -1
- package/lib/command/AcApRevCloudCmd.js.map +0 -1
- package/lib/command/AcApRevRectCmd.d.ts +0 -10
- package/lib/command/AcApRevRectCmd.d.ts.map +0 -1
- package/lib/command/AcApRevRectCmd.js.map +0 -1
- package/lib/command/AcApRevVisibilityCmd.d.ts.map +0 -1
- package/lib/command/AcApRevVisibilityCmd.js.map +0 -1
- package/lib/command/AcApSketchCmd.d.ts.map +0 -1
- package/lib/command/AcApSketchCmd.js.map +0 -1
- package/lib/command/AcApSplineCmd.d.ts +0 -20
- package/lib/command/AcApSplineCmd.d.ts.map +0 -1
- package/lib/command/AcApSplineCmd.js +0 -213
- package/lib/command/AcApSplineCmd.js.map +0 -1
- package/lib/command/AcApSvgConvertor.d.ts.map +0 -1
- package/lib/command/AcApSvgConvertor.js.map +0 -1
- 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/command/{AcApDxfConvertor.d.ts → convert/AcApDxfConvertor.d.ts} +0 -0
- /package/lib/command/{AcApSvgConvertor.d.ts → convert/AcApSvgConvertor.d.ts} +0 -0
|
@@ -85,8 +85,8 @@ var __values = (this && this.__values) || function(o) {
|
|
|
85
85
|
};
|
|
86
86
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
87
87
|
};
|
|
88
|
-
import { AcGeBox2d } from '@mlightcad/data-model';
|
|
89
|
-
import { AcApSettingManager } from '../../../app';
|
|
88
|
+
import { acdbHostApplicationServices, AcDbSystemVariables, AcDbSysVarManager, AcGeBox2d } from '@mlightcad/data-model';
|
|
89
|
+
import { AcApDocManager, AcApSettingManager } from '../../../app';
|
|
90
90
|
import { AcApI18n } from '../../../i18n';
|
|
91
91
|
import { AcEdSelectionSet } from '../AcEdSelectionSet';
|
|
92
92
|
import { AcEdAngleHandler, AcEdDistanceHandler, AcEdDoubleHandler, AcEdIntegerHandler, AcEdPointHandler, AcEdStringHandler } from '../handler';
|
|
@@ -95,8 +95,20 @@ import { AcEdPromptBoxResult, AcEdPromptDoubleResult, AcEdPromptEntityResult, Ac
|
|
|
95
95
|
import { AcEdCommandLine } from './AcEdCommandLine';
|
|
96
96
|
import { AcEdFloatingInput } from './AcEdFloatingInput';
|
|
97
97
|
import { AcEdFloatingMessage } from './AcEdFloatingMessage';
|
|
98
|
+
/**
|
|
99
|
+
* Internal control-flow error used to propagate keyword picks out of
|
|
100
|
+
* floating-input loops.
|
|
101
|
+
*
|
|
102
|
+
* This error is intentionally caught by prompt wrappers and converted into
|
|
103
|
+
* `AcEdPromptStatus.Keyword` results.
|
|
104
|
+
*/
|
|
98
105
|
var AcEdKeywordInputError = /** @class */ (function (_super) {
|
|
99
106
|
__extends(AcEdKeywordInputError, _super);
|
|
107
|
+
/**
|
|
108
|
+
* Creates a keyword control-flow error.
|
|
109
|
+
*
|
|
110
|
+
* @param keyword - Canonical keyword token to bubble to prompt callers.
|
|
111
|
+
*/
|
|
100
112
|
function AcEdKeywordInputError(keyword) {
|
|
101
113
|
var _this = _super.call(this, 'keyword') || this;
|
|
102
114
|
_this.keyword = keyword;
|
|
@@ -104,6 +116,16 @@ var AcEdKeywordInputError = /** @class */ (function (_super) {
|
|
|
104
116
|
}
|
|
105
117
|
return AcEdKeywordInputError;
|
|
106
118
|
}(Error));
|
|
119
|
+
/**
|
|
120
|
+
* Internal control-flow error used to represent Enter/RightClick None input.
|
|
121
|
+
*/
|
|
122
|
+
var AcEdNoneInputError = /** @class */ (function (_super) {
|
|
123
|
+
__extends(AcEdNoneInputError, _super);
|
|
124
|
+
function AcEdNoneInputError() {
|
|
125
|
+
return _super.call(this, 'none') || this;
|
|
126
|
+
}
|
|
127
|
+
return AcEdNoneInputError;
|
|
128
|
+
}(Error));
|
|
107
129
|
/**
|
|
108
130
|
* A fully type-safe TypeScript class providing CAD-style interactive user input
|
|
109
131
|
* using floating HTML input boxes and mouse events. Supports collecting points,
|
|
@@ -216,6 +238,33 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
216
238
|
AcEdInputManager.prototype.clearScriptInputs = function () {
|
|
217
239
|
this._scriptInputs.length = 0;
|
|
218
240
|
};
|
|
241
|
+
/**
|
|
242
|
+
* Displays a typed message in the command-line message panel.
|
|
243
|
+
*
|
|
244
|
+
* @param message - Message text to render
|
|
245
|
+
* @param type - Message severity controlling the rendered style
|
|
246
|
+
* @param msgKey - Optional localization key associated with the message
|
|
247
|
+
*/
|
|
248
|
+
AcEdInputManager.prototype.showMessage = function (message, type, msgKey) {
|
|
249
|
+
if (type === void 0) { type = 'info'; }
|
|
250
|
+
this._commandLine.showMessage(message, type, msgKey);
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Returns the next scripted token without consuming it.
|
|
254
|
+
*
|
|
255
|
+
* @returns Next queued scripted token, or `undefined` when empty.
|
|
256
|
+
*/
|
|
257
|
+
AcEdInputManager.prototype.peekScriptInput = function () {
|
|
258
|
+
return this._scriptInputs[0];
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Consumes and returns the next scripted token.
|
|
262
|
+
*
|
|
263
|
+
* @returns Next queued scripted token, or `undefined` when empty.
|
|
264
|
+
*/
|
|
265
|
+
AcEdInputManager.prototype.consumeScriptInput = function () {
|
|
266
|
+
return this.dequeueScriptInput();
|
|
267
|
+
};
|
|
219
268
|
/**
|
|
220
269
|
* Injects minimal CSS required for the floating input and preview rectangle.
|
|
221
270
|
* Useful when you do not have a separate CSS file.
|
|
@@ -244,11 +293,35 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
244
293
|
return value.toFixed(3);
|
|
245
294
|
}
|
|
246
295
|
};
|
|
296
|
+
/**
|
|
297
|
+
* Returns whether the supplied prompt defines any keywords.
|
|
298
|
+
*
|
|
299
|
+
* Keyword-aware prompts need extra command-line wiring so textual input can
|
|
300
|
+
* be interpreted as keyword picks instead of free-form values. This helper
|
|
301
|
+
* centralizes the check and gracefully handles prompts that expose no keyword
|
|
302
|
+
* collection.
|
|
303
|
+
*
|
|
304
|
+
* @param options - Prompt options to inspect
|
|
305
|
+
* @returns `true` when at least one keyword is registered on the prompt
|
|
306
|
+
*/
|
|
247
307
|
AcEdInputManager.prototype.hasKeywords = function (options) {
|
|
248
308
|
var _a, _b;
|
|
249
309
|
var keywords = (_b = (_a = options.keywords) === null || _a === void 0 ? void 0 : _a.toArray()) !== null && _b !== void 0 ? _b : [];
|
|
250
310
|
return keywords.length > 0;
|
|
251
311
|
};
|
|
312
|
+
/**
|
|
313
|
+
* Builds a keyword-only prompt options object from a general prompt.
|
|
314
|
+
*
|
|
315
|
+
* Several input flows support optional keywords in parallel with their main
|
|
316
|
+
* acquisition mode. Rather than duplicating keyword definitions manually, the
|
|
317
|
+
* original prompt's keyword metadata is cloned into a dedicated
|
|
318
|
+
* `AcEdPromptKeywordOptions` instance that can be passed to the command-line
|
|
319
|
+
* keyword session.
|
|
320
|
+
*
|
|
321
|
+
* @typeParam T - Value type produced by the source prompt
|
|
322
|
+
* @param options - Source prompt whose keyword definitions should be copied
|
|
323
|
+
* @returns A keyword prompt configured with the same message and keyword set
|
|
324
|
+
*/
|
|
252
325
|
AcEdInputManager.prototype.buildKeywordOptions = function (options) {
|
|
253
326
|
var _a, _b;
|
|
254
327
|
var keywordOptions = new AcEdPromptKeywordOptions(options.message);
|
|
@@ -262,6 +335,16 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
262
335
|
});
|
|
263
336
|
return keywordOptions;
|
|
264
337
|
};
|
|
338
|
+
/**
|
|
339
|
+
* Copies keyword definitions from one prompt options object to another.
|
|
340
|
+
*
|
|
341
|
+
* This is primarily used by composite prompts such as `getBox()`, which break
|
|
342
|
+
* a higher-level workflow into multiple sub-prompts while preserving the same
|
|
343
|
+
* keyword vocabulary and default keyword behavior across each stage.
|
|
344
|
+
*
|
|
345
|
+
* @param source - Prompt options providing the keyword definitions
|
|
346
|
+
* @param target - Prompt options receiving the cloned keyword definitions
|
|
347
|
+
*/
|
|
265
348
|
AcEdInputManager.prototype.copyKeywords = function (source, target) {
|
|
266
349
|
var _a, _b;
|
|
267
350
|
target.appendKeywordsToMessage = source.appendKeywordsToMessage;
|
|
@@ -273,6 +356,95 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
273
356
|
}
|
|
274
357
|
});
|
|
275
358
|
};
|
|
359
|
+
/**
|
|
360
|
+
* Resolves a picked object id back to its database entity instance.
|
|
361
|
+
*
|
|
362
|
+
* View-level picking only returns lightweight hit-test data such as object
|
|
363
|
+
* ids and bounding information. Prompt validation, however, needs access to
|
|
364
|
+
* the backing `AcDbEntity` so it can inspect runtime metadata like the entity
|
|
365
|
+
* type and layer.
|
|
366
|
+
*
|
|
367
|
+
* @param objectId - Object id returned by the spatial pick query
|
|
368
|
+
* @returns The matching database entity, or `undefined` if it can no longer be found
|
|
369
|
+
*/
|
|
370
|
+
AcEdInputManager.prototype.getEntityById = function (objectId) {
|
|
371
|
+
return AcApDocManager.instance.curDocument.database.tables.blockTable.getEntityById(objectId);
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* Returns whether the specified entity belongs to a locked layer.
|
|
375
|
+
*
|
|
376
|
+
* The entity itself only stores its layer name, so this helper resolves the
|
|
377
|
+
* layer record from the current drawing database and inspects its lock state.
|
|
378
|
+
* Missing layer records are treated as unlocked to avoid rejecting input due
|
|
379
|
+
* to incomplete metadata.
|
|
380
|
+
*
|
|
381
|
+
* @param entity - Entity being evaluated for prompt selection
|
|
382
|
+
* @returns `true` if the entity's layer exists and is locked; otherwise `false`
|
|
383
|
+
*/
|
|
384
|
+
AcEdInputManager.prototype.isEntityOnLockedLayer = function (entity) {
|
|
385
|
+
var _a;
|
|
386
|
+
var layerName = entity.layer;
|
|
387
|
+
if (!layerName) {
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
return !!((_a = AcApDocManager.instance.curDocument.database.tables.layerTable.getAt(layerName)) === null || _a === void 0 ? void 0 : _a.isLocked);
|
|
391
|
+
};
|
|
392
|
+
/**
|
|
393
|
+
* Checks whether a picked entity satisfies the prompt's allowed-class filter.
|
|
394
|
+
*
|
|
395
|
+
* Different parts of the stack expose the entity type in slightly different
|
|
396
|
+
* forms. The data-model layer provides a short CAD type name through
|
|
397
|
+
* `entity.type` (for example `Line`), while runtime inspection exposes the
|
|
398
|
+
* TypeScript constructor name (for example `AcDbLine`). To maximize
|
|
399
|
+
* compatibility with existing caller expectations, both forms are tested
|
|
400
|
+
* against the prompt's allow-list.
|
|
401
|
+
*
|
|
402
|
+
* @param entity - Picked entity being validated
|
|
403
|
+
* @param options - Prompt options containing the configured allowed classes
|
|
404
|
+
* @returns `true` when the entity matches at least one allowed class, or when
|
|
405
|
+
* no class restriction has been configured
|
|
406
|
+
*/
|
|
407
|
+
AcEdInputManager.prototype.isEntityClassAllowed = function (entity, options) {
|
|
408
|
+
var e_1, _a;
|
|
409
|
+
var _b;
|
|
410
|
+
var candidates = new Set();
|
|
411
|
+
if (entity.type) {
|
|
412
|
+
candidates.add(entity.type);
|
|
413
|
+
}
|
|
414
|
+
var constructorName = (_b = entity.constructor) === null || _b === void 0 ? void 0 : _b.name;
|
|
415
|
+
if (constructorName) {
|
|
416
|
+
candidates.add(constructorName);
|
|
417
|
+
}
|
|
418
|
+
try {
|
|
419
|
+
for (var candidates_1 = __values(candidates), candidates_1_1 = candidates_1.next(); !candidates_1_1.done; candidates_1_1 = candidates_1.next()) {
|
|
420
|
+
var candidate = candidates_1_1.value;
|
|
421
|
+
if (options.isClassAllowed(candidate)) {
|
|
422
|
+
return true;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
427
|
+
finally {
|
|
428
|
+
try {
|
|
429
|
+
if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
|
|
430
|
+
}
|
|
431
|
+
finally { if (e_1) throw e_1.error; }
|
|
432
|
+
}
|
|
433
|
+
return false;
|
|
434
|
+
};
|
|
435
|
+
/**
|
|
436
|
+
* Starts a command-line keyword session for the given prompt when needed.
|
|
437
|
+
*
|
|
438
|
+
* Many interactive prompts accept both mouse-driven input and typed keywords
|
|
439
|
+
* at the same time. This helper lazily creates the command-line keyword
|
|
440
|
+
* session only when keywords are actually configured, and returns a small
|
|
441
|
+
* control object that lets callers await or cancel that session.
|
|
442
|
+
*
|
|
443
|
+
* @param options - Prompt options that may define keywords
|
|
444
|
+
* @param allowTyping - Whether arbitrary typing is allowed alongside keyword completion
|
|
445
|
+
* @returns An object containing the keyword promise and cancel callback, or
|
|
446
|
+
* `undefined` when the prompt has no keywords
|
|
447
|
+
*/
|
|
276
448
|
AcEdInputManager.prototype.startKeywordSession = function (options, allowTyping) {
|
|
277
449
|
var _this = this;
|
|
278
450
|
if (!this.hasKeywords(options))
|
|
@@ -283,33 +455,97 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
283
455
|
cancel: function () { return _this._commandLine.cancelActiveSession(); }
|
|
284
456
|
};
|
|
285
457
|
};
|
|
458
|
+
/**
|
|
459
|
+
* Narrows an unknown error value to the internal keyword control-flow error.
|
|
460
|
+
*
|
|
461
|
+
* Prompt implementations use {@link AcEdKeywordInputError} as a private
|
|
462
|
+
* mechanism for bubbling a keyword pick out of deeply nested async UI flows.
|
|
463
|
+
* This type guard keeps the outer prompt wrappers readable while preserving
|
|
464
|
+
* strong typing for the extracted keyword token.
|
|
465
|
+
*
|
|
466
|
+
* @param error - Unknown error value thrown from an input workflow
|
|
467
|
+
* @returns `true` if the error represents a keyword selection
|
|
468
|
+
*/
|
|
286
469
|
AcEdInputManager.prototype.isPromptKeyword = function (error) {
|
|
287
470
|
return error instanceof AcEdKeywordInputError;
|
|
288
471
|
};
|
|
289
472
|
/**
|
|
290
|
-
*
|
|
473
|
+
* Converts internal prompt control-flow errors to typed prompt results.
|
|
474
|
+
*
|
|
475
|
+
* @typeParam T - Prompt result type to construct
|
|
476
|
+
* @param error - Unknown error thrown from prompt workflow
|
|
477
|
+
* @param handlers - Result factories for mapped prompt statuses
|
|
478
|
+
* @returns Mapped prompt result when recognized; otherwise `undefined`
|
|
291
479
|
*/
|
|
292
|
-
AcEdInputManager.prototype.
|
|
480
|
+
AcEdInputManager.prototype.mapPromptError = function (error, handlers) {
|
|
481
|
+
if (handlers.none && this.isPromptNone(error)) {
|
|
482
|
+
return handlers.none();
|
|
483
|
+
}
|
|
484
|
+
if (handlers.cancel && this.isPromptCancelled(error)) {
|
|
485
|
+
return handlers.cancel();
|
|
486
|
+
}
|
|
487
|
+
if (handlers.keyword && this.isPromptKeyword(error)) {
|
|
488
|
+
return handlers.keyword(error.keyword);
|
|
489
|
+
}
|
|
490
|
+
return undefined;
|
|
491
|
+
};
|
|
492
|
+
/**
|
|
493
|
+
* Attaches keyword text to a prompt result and returns it.
|
|
494
|
+
*/
|
|
495
|
+
AcEdInputManager.prototype.withKeywordResult = function (result, keyword) {
|
|
496
|
+
result.stringResult = keyword;
|
|
497
|
+
return result;
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* Maps internal control-flow errors to prompt results by status constructor.
|
|
501
|
+
*
|
|
502
|
+
* @typeParam T - Prompt result type
|
|
503
|
+
* @param error - Unknown error thrown from prompt workflow
|
|
504
|
+
* @param create - Factory creating a result from target status
|
|
505
|
+
* @param options - Toggles for supported mapped statuses
|
|
506
|
+
*/
|
|
507
|
+
AcEdInputManager.prototype.mapPromptErrorToResult = function (error, create, options) {
|
|
508
|
+
var _this = this;
|
|
509
|
+
var _a, _b, _c;
|
|
510
|
+
var includeNone = (_a = options === null || options === void 0 ? void 0 : options.none) !== null && _a !== void 0 ? _a : true;
|
|
511
|
+
var includeCancel = (_b = options === null || options === void 0 ? void 0 : options.cancel) !== null && _b !== void 0 ? _b : true;
|
|
512
|
+
var includeKeyword = (_c = options === null || options === void 0 ? void 0 : options.keyword) !== null && _c !== void 0 ? _c : true;
|
|
513
|
+
return this.mapPromptError(error, {
|
|
514
|
+
none: includeNone ? function () { return create(AcEdPromptStatus.None); } : undefined,
|
|
515
|
+
cancel: includeCancel ? function () { return create(AcEdPromptStatus.Cancel); } : undefined,
|
|
516
|
+
keyword: includeKeyword
|
|
517
|
+
? function (keyword) {
|
|
518
|
+
return _this.withKeywordResult(create(AcEdPromptStatus.Keyword), keyword);
|
|
519
|
+
}
|
|
520
|
+
: undefined
|
|
521
|
+
});
|
|
522
|
+
};
|
|
523
|
+
/**
|
|
524
|
+
* Executes prompt workflow with centralized try/catch mapping.
|
|
525
|
+
*
|
|
526
|
+
* @typeParam T - Raw successful value from prompt workflow
|
|
527
|
+
* @typeParam R - Prompt result type
|
|
528
|
+
* @param run - Async prompt workflow that may throw control-flow errors
|
|
529
|
+
* @param onOk - Maps successful workflow value to result object
|
|
530
|
+
* @param create - Creates a result object from mapped prompt status
|
|
531
|
+
* @param options - Toggles for supported mapped statuses
|
|
532
|
+
*/
|
|
533
|
+
AcEdInputManager.prototype.executePrompt = function (run, onOk, create, options) {
|
|
293
534
|
return __awaiter(this, void 0, void 0, function () {
|
|
294
|
-
var value, error_1,
|
|
535
|
+
var value, error_1, mapped;
|
|
295
536
|
return __generator(this, function (_a) {
|
|
296
537
|
switch (_a.label) {
|
|
297
538
|
case 0:
|
|
298
539
|
_a.trys.push([0, 2, , 3]);
|
|
299
|
-
return [4 /*yield*/,
|
|
540
|
+
return [4 /*yield*/, run()];
|
|
300
541
|
case 1:
|
|
301
542
|
value = _a.sent();
|
|
302
|
-
return [2 /*return*/,
|
|
543
|
+
return [2 /*return*/, onOk(value)];
|
|
303
544
|
case 2:
|
|
304
545
|
error_1 = _a.sent();
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
if (this.isPromptKeyword(error_1)) {
|
|
309
|
-
result = new AcEdPromptPointResult(AcEdPromptStatus.Keyword);
|
|
310
|
-
result.stringResult = error_1.keyword;
|
|
311
|
-
return [2 /*return*/, result];
|
|
312
|
-
}
|
|
546
|
+
mapped = this.mapPromptErrorToResult(error_1, create, options);
|
|
547
|
+
if (mapped)
|
|
548
|
+
return [2 /*return*/, mapped];
|
|
313
549
|
throw error_1;
|
|
314
550
|
case 3: return [2 /*return*/];
|
|
315
551
|
}
|
|
@@ -317,9 +553,49 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
317
553
|
});
|
|
318
554
|
};
|
|
319
555
|
/**
|
|
320
|
-
*
|
|
321
|
-
|
|
322
|
-
|
|
556
|
+
* Extracts default-value behavior from prompt options when supported.
|
|
557
|
+
*/
|
|
558
|
+
AcEdInputManager.prototype.resolvePromptDefaultValue = function (promptOptions) {
|
|
559
|
+
if ('useDefaultValue' in promptOptions &&
|
|
560
|
+
'defaultValue' in promptOptions &&
|
|
561
|
+
promptOptions.useDefaultValue) {
|
|
562
|
+
return {
|
|
563
|
+
useDefaultValue: true,
|
|
564
|
+
defaultValue: promptOptions.defaultValue
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
return { useDefaultValue: false };
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* Prompts the user to specify a point.
|
|
571
|
+
*
|
|
572
|
+
* The point may be supplied by clicking in the view, typing coordinates into
|
|
573
|
+
* the floating input, or consuming a queued scripted input token. Keywords are
|
|
574
|
+
* also supported when configured on the prompt options.
|
|
575
|
+
*
|
|
576
|
+
* @param options - Point prompt options controlling messaging, base-point
|
|
577
|
+
* behavior, jig integration, and keywords
|
|
578
|
+
* @returns A prompt result containing the picked point, cancel status, or keyword
|
|
579
|
+
*/
|
|
580
|
+
AcEdInputManager.prototype.getPoint = function (options) {
|
|
581
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
582
|
+
var _this = this;
|
|
583
|
+
return __generator(this, function (_a) {
|
|
584
|
+
return [2 /*return*/, this.executePrompt(function () { return _this.getPointInternal(options); }, function (value) { return new AcEdPromptPointResult(AcEdPromptStatus.OK, value); }, function (status) { return new AcEdPromptPointResult(status); })];
|
|
585
|
+
});
|
|
586
|
+
});
|
|
587
|
+
};
|
|
588
|
+
/**
|
|
589
|
+
* Prompts the user for a purely typed numeric value through floating input.
|
|
590
|
+
*
|
|
591
|
+
* This helper is shared by distance, angle, double, and integer prompts when
|
|
592
|
+
* no mouse-driven geometric reference is needed. Validation is delegated to
|
|
593
|
+
* the supplied handler so the floating UI can mark invalid values and keep
|
|
594
|
+
* the prompt alive until the user enters an acceptable number.
|
|
595
|
+
*
|
|
596
|
+
* @param options - Numeric prompt options describing the message and keyword set
|
|
597
|
+
* @param handler - Parser/validator responsible for converting raw text into a number
|
|
598
|
+
* @returns A promise that resolves to the parsed numeric value
|
|
323
599
|
*/
|
|
324
600
|
AcEdInputManager.prototype.getNumberTyped = function (options, handler) {
|
|
325
601
|
var getDynamicValue = function () {
|
|
@@ -335,249 +611,238 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
335
611
|
getDynamicValue: getDynamicValue
|
|
336
612
|
});
|
|
337
613
|
};
|
|
338
|
-
/**
|
|
614
|
+
/**
|
|
615
|
+
* Prompts the user to specify a distance value.
|
|
616
|
+
*
|
|
617
|
+
* When a base point is available, the floating input previews the live
|
|
618
|
+
* distance from that reference point to the current cursor. Otherwise, the
|
|
619
|
+
* method falls back to typed numeric entry only. Scripted inputs and keywords
|
|
620
|
+
* are supported as well.
|
|
621
|
+
*
|
|
622
|
+
* @param options - Distance prompt options controlling base-point behavior and messaging
|
|
623
|
+
* @returns A prompt result containing the resolved distance, cancel status, or keyword
|
|
624
|
+
*/
|
|
339
625
|
AcEdInputManager.prototype.getDistance = function (options) {
|
|
340
626
|
return __awaiter(this, void 0, void 0, function () {
|
|
341
|
-
var handler, scriptedValue
|
|
627
|
+
var handler, scriptedValue;
|
|
342
628
|
var _this = this;
|
|
343
629
|
return __generator(this, function (_a) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
if (scriptedValue != null) {
|
|
349
|
-
return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, scriptedValue)];
|
|
350
|
-
}
|
|
351
|
-
_a.label = 1;
|
|
352
|
-
case 1:
|
|
353
|
-
_a.trys.push([1, 5, , 6]);
|
|
354
|
-
if (!!this.lastPoint) return [3 /*break*/, 3];
|
|
355
|
-
return [4 /*yield*/, this.getNumberTyped(options, handler)];
|
|
356
|
-
case 2:
|
|
357
|
-
value_1 = _a.sent();
|
|
358
|
-
return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value_1)];
|
|
359
|
-
case 3:
|
|
360
|
-
getDynamicValue = function (pos) {
|
|
361
|
-
var dx = pos.x - _this.lastPoint.x;
|
|
362
|
-
var dy = pos.y - _this.lastPoint.y;
|
|
363
|
-
var dist = Math.sqrt(dx * dx + dy * dy);
|
|
364
|
-
return {
|
|
365
|
-
value: dist,
|
|
366
|
-
raw: { x: _this.formatNumber(dist, 'distance') }
|
|
367
|
-
};
|
|
368
|
-
};
|
|
369
|
-
return [4 /*yield*/, this.makeFloatingInputPromise({
|
|
370
|
-
inputCount: 1,
|
|
371
|
-
promptOptions: options,
|
|
372
|
-
handler: handler,
|
|
373
|
-
getDynamicValue: getDynamicValue
|
|
374
|
-
})];
|
|
375
|
-
case 4:
|
|
376
|
-
value = _a.sent();
|
|
377
|
-
return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value)];
|
|
378
|
-
case 5:
|
|
379
|
-
error_2 = _a.sent();
|
|
380
|
-
if (this.isPromptCancelled(error_2)) {
|
|
381
|
-
return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.Cancel)];
|
|
382
|
-
}
|
|
383
|
-
if (this.isPromptKeyword(error_2)) {
|
|
384
|
-
result = new AcEdPromptDoubleResult(AcEdPromptStatus.Keyword);
|
|
385
|
-
result.stringResult = error_2.keyword;
|
|
386
|
-
return [2 /*return*/, result];
|
|
387
|
-
}
|
|
388
|
-
throw error_2;
|
|
389
|
-
case 6: return [2 /*return*/];
|
|
630
|
+
handler = new AcEdDistanceHandler(options);
|
|
631
|
+
scriptedValue = this.tryGetScriptedNumber(handler);
|
|
632
|
+
if (scriptedValue != null) {
|
|
633
|
+
return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, scriptedValue)];
|
|
390
634
|
}
|
|
635
|
+
return [2 /*return*/, this.executePrompt(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
636
|
+
var getDynamicValue;
|
|
637
|
+
var _this = this;
|
|
638
|
+
return __generator(this, function (_a) {
|
|
639
|
+
switch (_a.label) {
|
|
640
|
+
case 0:
|
|
641
|
+
if (!!this.lastPoint) return [3 /*break*/, 2];
|
|
642
|
+
return [4 /*yield*/, this.getNumberTyped(options, handler)];
|
|
643
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
644
|
+
case 2:
|
|
645
|
+
getDynamicValue = function (pos) {
|
|
646
|
+
var dx = pos.x - _this.lastPoint.x;
|
|
647
|
+
var dy = pos.y - _this.lastPoint.y;
|
|
648
|
+
var dist = Math.sqrt(dx * dx + dy * dy);
|
|
649
|
+
return {
|
|
650
|
+
value: dist,
|
|
651
|
+
raw: { x: _this.formatNumber(dist, 'distance') }
|
|
652
|
+
};
|
|
653
|
+
};
|
|
654
|
+
return [4 /*yield*/, this.makeFloatingInputPromise({
|
|
655
|
+
inputCount: 1,
|
|
656
|
+
promptOptions: options,
|
|
657
|
+
handler: handler,
|
|
658
|
+
getDynamicValue: getDynamicValue
|
|
659
|
+
})];
|
|
660
|
+
case 3: return [2 /*return*/, _a.sent()];
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
}); }, function (value) { return new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value); }, function (status) { return new AcEdPromptDoubleResult(status); })];
|
|
391
664
|
});
|
|
392
665
|
});
|
|
393
666
|
};
|
|
394
|
-
/**
|
|
667
|
+
/**
|
|
668
|
+
* Prompts the user to specify an angle in degrees.
|
|
669
|
+
*
|
|
670
|
+
* If a base point is available, the cursor position is converted into a live
|
|
671
|
+
* angular preview relative to that point and the optional prompt base angle.
|
|
672
|
+
* Without a geometric reference, the method accepts typed numeric input only.
|
|
673
|
+
*
|
|
674
|
+
* @param options - Angle prompt options controlling base point, base angle, and messaging
|
|
675
|
+
* @returns A prompt result containing the resolved angle, cancel status, or keyword
|
|
676
|
+
*/
|
|
395
677
|
AcEdInputManager.prototype.getAngle = function (options) {
|
|
396
678
|
return __awaiter(this, void 0, void 0, function () {
|
|
397
|
-
var handler, scriptedValue,
|
|
679
|
+
var handler, scriptedValue, basePoint, getDynamicValue;
|
|
398
680
|
var _this = this;
|
|
399
681
|
return __generator(this, function (_a) {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
var angleDeg = (angleRad * 180) / Math.PI;
|
|
412
|
-
return {
|
|
413
|
-
value: angleDeg,
|
|
414
|
-
raw: { x: _this.formatNumber(angleDeg, 'angle') }
|
|
415
|
-
};
|
|
416
|
-
};
|
|
417
|
-
_a.label = 1;
|
|
418
|
-
case 1:
|
|
419
|
-
_a.trys.push([1, 3, , 4]);
|
|
420
|
-
return [4 /*yield*/, this.makeFloatingInputPromise({
|
|
421
|
-
inputCount: 1,
|
|
422
|
-
promptOptions: options,
|
|
423
|
-
handler: handler,
|
|
424
|
-
getDynamicValue: getDynamicValue
|
|
425
|
-
})];
|
|
426
|
-
case 2:
|
|
427
|
-
value = _a.sent();
|
|
428
|
-
return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value)];
|
|
429
|
-
case 3:
|
|
430
|
-
error_3 = _a.sent();
|
|
431
|
-
if (this.isPromptCancelled(error_3)) {
|
|
432
|
-
return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.Cancel)];
|
|
433
|
-
}
|
|
434
|
-
if (this.isPromptKeyword(error_3)) {
|
|
435
|
-
result = new AcEdPromptDoubleResult(AcEdPromptStatus.Keyword);
|
|
436
|
-
result.stringResult = error_3.keyword;
|
|
437
|
-
return [2 /*return*/, result];
|
|
438
|
-
}
|
|
439
|
-
throw error_3;
|
|
440
|
-
case 4: return [2 /*return*/];
|
|
682
|
+
handler = new AcEdAngleHandler(options);
|
|
683
|
+
scriptedValue = this.tryGetScriptedNumber(handler);
|
|
684
|
+
if (scriptedValue != null) {
|
|
685
|
+
return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, scriptedValue)];
|
|
686
|
+
}
|
|
687
|
+
basePoint = options.useBasePoint && options.basePoint
|
|
688
|
+
? options.basePoint
|
|
689
|
+
: this.lastPoint;
|
|
690
|
+
// No reference point available: fallback to typed angle input only.
|
|
691
|
+
if (!basePoint) {
|
|
692
|
+
return [2 /*return*/, this.executePrompt(function () { return _this.getNumberTyped(options, handler); }, function (value) { return new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value); }, function (status) { return new AcEdPromptDoubleResult(status); })];
|
|
441
693
|
}
|
|
694
|
+
getDynamicValue = function (pos) {
|
|
695
|
+
var dx = pos.x - basePoint.x;
|
|
696
|
+
var dy = pos.y - basePoint.y;
|
|
697
|
+
var rawAngleRad = Math.atan2(dy, dx);
|
|
698
|
+
var baseAngleRad = (options.baseAngle * Math.PI) / 180;
|
|
699
|
+
var angleRad = rawAngleRad - baseAngleRad;
|
|
700
|
+
while (angleRad <= -Math.PI)
|
|
701
|
+
angleRad += Math.PI * 2;
|
|
702
|
+
while (angleRad > Math.PI)
|
|
703
|
+
angleRad -= Math.PI * 2;
|
|
704
|
+
var angleDeg = (angleRad * 180) / Math.PI;
|
|
705
|
+
return {
|
|
706
|
+
value: angleDeg,
|
|
707
|
+
raw: { x: _this.formatNumber(angleDeg, 'angle') }
|
|
708
|
+
};
|
|
709
|
+
};
|
|
710
|
+
return [2 /*return*/, this.executePrompt(function () {
|
|
711
|
+
return _this.makeFloatingInputPromise({
|
|
712
|
+
inputCount: 1,
|
|
713
|
+
promptOptions: options,
|
|
714
|
+
handler: handler,
|
|
715
|
+
getDynamicValue: getDynamicValue
|
|
716
|
+
});
|
|
717
|
+
}, function (value) { return new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value); }, function (status) { return new AcEdPromptDoubleResult(status); })];
|
|
442
718
|
});
|
|
443
719
|
});
|
|
444
720
|
};
|
|
445
|
-
/**
|
|
721
|
+
/**
|
|
722
|
+
* Prompts the user for a floating-point number.
|
|
723
|
+
*
|
|
724
|
+
* This is the generic free-form numeric entry path used when no geometric
|
|
725
|
+
* interpretation such as distance or angle is required.
|
|
726
|
+
*
|
|
727
|
+
* @param options - Double prompt options controlling validation and messaging
|
|
728
|
+
* @returns A prompt result containing the parsed number, cancel status, or keyword
|
|
729
|
+
*/
|
|
446
730
|
AcEdInputManager.prototype.getDouble = function (options) {
|
|
447
731
|
return __awaiter(this, void 0, void 0, function () {
|
|
448
|
-
var handler, scriptedValue
|
|
732
|
+
var handler, scriptedValue;
|
|
733
|
+
var _this = this;
|
|
449
734
|
return __generator(this, function (_a) {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
if (scriptedValue != null) {
|
|
455
|
-
return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, scriptedValue)];
|
|
456
|
-
}
|
|
457
|
-
_a.label = 1;
|
|
458
|
-
case 1:
|
|
459
|
-
_a.trys.push([1, 3, , 4]);
|
|
460
|
-
return [4 /*yield*/, this.getNumberTyped(options, handler)];
|
|
461
|
-
case 2:
|
|
462
|
-
value = _a.sent();
|
|
463
|
-
return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value)];
|
|
464
|
-
case 3:
|
|
465
|
-
error_4 = _a.sent();
|
|
466
|
-
if (this.isPromptCancelled(error_4)) {
|
|
467
|
-
return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.Cancel)];
|
|
468
|
-
}
|
|
469
|
-
if (this.isPromptKeyword(error_4)) {
|
|
470
|
-
result = new AcEdPromptDoubleResult(AcEdPromptStatus.Keyword);
|
|
471
|
-
result.stringResult = error_4.keyword;
|
|
472
|
-
return [2 /*return*/, result];
|
|
473
|
-
}
|
|
474
|
-
throw error_4;
|
|
475
|
-
case 4: return [2 /*return*/];
|
|
735
|
+
handler = new AcEdDoubleHandler(options);
|
|
736
|
+
scriptedValue = this.tryGetScriptedNumber(handler);
|
|
737
|
+
if (scriptedValue != null) {
|
|
738
|
+
return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, scriptedValue)];
|
|
476
739
|
}
|
|
740
|
+
return [2 /*return*/, this.executePrompt(function () { return _this.getNumberTyped(options, handler); }, function (value) { return new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value); }, function (status) { return new AcEdPromptDoubleResult(status); })];
|
|
477
741
|
});
|
|
478
742
|
});
|
|
479
743
|
};
|
|
480
|
-
/**
|
|
744
|
+
/**
|
|
745
|
+
* Prompts the user for an integer value.
|
|
746
|
+
*
|
|
747
|
+
* The supplied integer handler enforces integer-only parsing for both typed
|
|
748
|
+
* input and scripted command input.
|
|
749
|
+
*
|
|
750
|
+
* @param options - Integer prompt options controlling validation and messaging
|
|
751
|
+
* @returns A prompt result containing the parsed integer, cancel status, or keyword
|
|
752
|
+
*/
|
|
481
753
|
AcEdInputManager.prototype.getInteger = function (options) {
|
|
482
754
|
return __awaiter(this, void 0, void 0, function () {
|
|
483
|
-
var scriptedValue
|
|
755
|
+
var scriptedValue;
|
|
756
|
+
var _this = this;
|
|
484
757
|
return __generator(this, function (_a) {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
if (scriptedValue != null) {
|
|
489
|
-
return [2 /*return*/, new AcEdPromptIntegerResult(AcEdPromptStatus.OK, scriptedValue)];
|
|
490
|
-
}
|
|
491
|
-
_a.label = 1;
|
|
492
|
-
case 1:
|
|
493
|
-
_a.trys.push([1, 3, , 4]);
|
|
494
|
-
return [4 /*yield*/, this.getNumberTyped(options, new AcEdIntegerHandler(options))];
|
|
495
|
-
case 2:
|
|
496
|
-
value = _a.sent();
|
|
497
|
-
return [2 /*return*/, new AcEdPromptIntegerResult(AcEdPromptStatus.OK, value)];
|
|
498
|
-
case 3:
|
|
499
|
-
error_5 = _a.sent();
|
|
500
|
-
if (this.isPromptCancelled(error_5)) {
|
|
501
|
-
return [2 /*return*/, new AcEdPromptIntegerResult(AcEdPromptStatus.Cancel)];
|
|
502
|
-
}
|
|
503
|
-
if (this.isPromptKeyword(error_5)) {
|
|
504
|
-
result = new AcEdPromptIntegerResult(AcEdPromptStatus.Keyword);
|
|
505
|
-
result.stringResult = error_5.keyword;
|
|
506
|
-
return [2 /*return*/, result];
|
|
507
|
-
}
|
|
508
|
-
throw error_5;
|
|
509
|
-
case 4: return [2 /*return*/];
|
|
758
|
+
scriptedValue = this.tryGetScriptedNumber(new AcEdIntegerHandler(options));
|
|
759
|
+
if (scriptedValue != null) {
|
|
760
|
+
return [2 /*return*/, new AcEdPromptIntegerResult(AcEdPromptStatus.OK, scriptedValue)];
|
|
510
761
|
}
|
|
762
|
+
return [2 /*return*/, this.executePrompt(function () { return _this.getNumberTyped(options, new AcEdIntegerHandler(options)); }, function (value) { return new AcEdPromptIntegerResult(AcEdPromptStatus.OK, value); }, function (status) { return new AcEdPromptIntegerResult(status); })];
|
|
511
763
|
});
|
|
512
764
|
});
|
|
513
765
|
};
|
|
514
766
|
/**
|
|
515
|
-
*
|
|
767
|
+
* Prompts the user to type an arbitrary string.
|
|
768
|
+
*
|
|
769
|
+
* The value is collected through the shared floating-input pipeline so it can
|
|
770
|
+
* participate in the same cancellation, keyword, and scripted-input behavior
|
|
771
|
+
* as the other prompt types.
|
|
772
|
+
*
|
|
773
|
+
* @param options - String prompt options controlling the prompt message and keywords
|
|
774
|
+
* @returns A prompt result containing the entered string, cancel status, or keyword
|
|
516
775
|
*/
|
|
517
776
|
AcEdInputManager.prototype.getString = function (options) {
|
|
518
777
|
return __awaiter(this, void 0, void 0, function () {
|
|
519
|
-
var scriptedValue
|
|
778
|
+
var scriptedValue;
|
|
779
|
+
var _this = this;
|
|
520
780
|
return __generator(this, function (_a) {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
if (scriptedValue != null) {
|
|
525
|
-
return [2 /*return*/, new AcEdPromptResult(AcEdPromptStatus.OK, scriptedValue)];
|
|
526
|
-
}
|
|
527
|
-
_a.label = 1;
|
|
528
|
-
case 1:
|
|
529
|
-
_a.trys.push([1, 3, , 4]);
|
|
530
|
-
getDynamicValue = function () {
|
|
531
|
-
return {
|
|
532
|
-
value: '',
|
|
533
|
-
raw: { x: '' }
|
|
534
|
-
};
|
|
535
|
-
};
|
|
536
|
-
handler = new AcEdStringHandler(options);
|
|
537
|
-
return [4 /*yield*/, this.makeFloatingInputPromise({
|
|
538
|
-
inputCount: 1,
|
|
539
|
-
promptOptions: options,
|
|
540
|
-
handler: handler,
|
|
541
|
-
getDynamicValue: getDynamicValue
|
|
542
|
-
})];
|
|
543
|
-
case 2:
|
|
544
|
-
value = _a.sent();
|
|
545
|
-
return [2 /*return*/, new AcEdPromptResult(AcEdPromptStatus.OK, value)];
|
|
546
|
-
case 3:
|
|
547
|
-
error_6 = _a.sent();
|
|
548
|
-
if (this.isPromptCancelled(error_6)) {
|
|
549
|
-
return [2 /*return*/, new AcEdPromptResult(AcEdPromptStatus.Cancel)];
|
|
550
|
-
}
|
|
551
|
-
if (this.isPromptKeyword(error_6)) {
|
|
552
|
-
return [2 /*return*/, new AcEdPromptResult(AcEdPromptStatus.Keyword, error_6.keyword)];
|
|
553
|
-
}
|
|
554
|
-
throw error_6;
|
|
555
|
-
case 4: return [2 /*return*/];
|
|
781
|
+
scriptedValue = this.tryGetScriptedValue(new AcEdStringHandler(options));
|
|
782
|
+
if (scriptedValue != null) {
|
|
783
|
+
return [2 /*return*/, new AcEdPromptResult(AcEdPromptStatus.OK, scriptedValue)];
|
|
556
784
|
}
|
|
785
|
+
return [2 /*return*/, this.executePrompt(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
786
|
+
var getDynamicValue, handler;
|
|
787
|
+
return __generator(this, function (_a) {
|
|
788
|
+
switch (_a.label) {
|
|
789
|
+
case 0:
|
|
790
|
+
getDynamicValue = function () {
|
|
791
|
+
return {
|
|
792
|
+
value: '',
|
|
793
|
+
raw: { x: '' }
|
|
794
|
+
};
|
|
795
|
+
};
|
|
796
|
+
handler = new AcEdStringHandler(options);
|
|
797
|
+
return [4 /*yield*/, this.makeFloatingInputPromise({
|
|
798
|
+
inputCount: 1,
|
|
799
|
+
promptOptions: options,
|
|
800
|
+
handler: handler,
|
|
801
|
+
getDynamicValue: getDynamicValue
|
|
802
|
+
})];
|
|
803
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
}); }, function (value) { return new AcEdPromptResult(AcEdPromptStatus.OK, value); }, function (status) { return new AcEdPromptResult(status); })];
|
|
557
807
|
});
|
|
558
808
|
});
|
|
559
809
|
};
|
|
560
810
|
/**
|
|
561
|
-
*
|
|
811
|
+
* Prompts the user to enter one of the configured keywords.
|
|
812
|
+
*
|
|
813
|
+
* Unlike the mixed-mode keyword sessions used by other prompt types, this
|
|
814
|
+
* method runs a dedicated keyword prompt and returns the chosen keyword as the
|
|
815
|
+
* result value.
|
|
816
|
+
*
|
|
817
|
+
* @param options - Keyword prompt options describing the allowed keywords
|
|
818
|
+
* @returns A prompt result containing the chosen keyword or cancel status
|
|
562
819
|
*/
|
|
563
820
|
AcEdInputManager.prototype.getKeywords = function (options) {
|
|
564
821
|
return __awaiter(this, void 0, void 0, function () {
|
|
565
|
-
var scriptedValue
|
|
822
|
+
var scriptedValue;
|
|
823
|
+
var _this = this;
|
|
566
824
|
return __generator(this, function (_a) {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
if (scriptedValue != null) {
|
|
571
|
-
return [2 /*return*/, Promise.resolve(scriptedValue)];
|
|
572
|
-
}
|
|
573
|
-
return [4 /*yield*/, this._commandLine.getKeywords(options, true)];
|
|
574
|
-
case 1:
|
|
575
|
-
result = _a.sent();
|
|
576
|
-
if (!result) {
|
|
577
|
-
throw new Error('cancelled');
|
|
578
|
-
}
|
|
579
|
-
return [2 /*return*/, result];
|
|
825
|
+
scriptedValue = this.tryGetScriptedValue(new AcEdKeywordHandler(options));
|
|
826
|
+
if (scriptedValue != null) {
|
|
827
|
+
return [2 /*return*/, new AcEdPromptResult(AcEdPromptStatus.OK, scriptedValue)];
|
|
580
828
|
}
|
|
829
|
+
return [2 /*return*/, this.executePrompt(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
830
|
+
var result;
|
|
831
|
+
return __generator(this, function (_a) {
|
|
832
|
+
switch (_a.label) {
|
|
833
|
+
case 0: return [4 /*yield*/, this._commandLine.getKeywords(options, true)];
|
|
834
|
+
case 1:
|
|
835
|
+
result = _a.sent();
|
|
836
|
+
if (!result) {
|
|
837
|
+
if (options.allowNone) {
|
|
838
|
+
throw new AcEdNoneInputError();
|
|
839
|
+
}
|
|
840
|
+
throw new Error('cancelled');
|
|
841
|
+
}
|
|
842
|
+
return [2 /*return*/, result];
|
|
843
|
+
}
|
|
844
|
+
});
|
|
845
|
+
}); }, function (value) { return new AcEdPromptResult(AcEdPromptStatus.OK, value); }, function (status) { return new AcEdPromptResult(status); }, { keyword: false })];
|
|
581
846
|
});
|
|
582
847
|
});
|
|
583
848
|
};
|
|
@@ -611,281 +876,304 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
611
876
|
*/
|
|
612
877
|
AcEdInputManager.prototype.getSelection = function (options) {
|
|
613
878
|
return __awaiter(this, void 0, void 0, function () {
|
|
614
|
-
var value, error_7;
|
|
615
879
|
var _this = this;
|
|
616
880
|
return __generator(this, function (_a) {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
881
|
+
return [2 /*return*/, this.executePrompt(function () {
|
|
882
|
+
return new Promise(function (resolve, reject) {
|
|
883
|
+
_this.active = true;
|
|
884
|
+
_this.entitySelectionActive = true;
|
|
885
|
+
var keywordSession = _this.startKeywordSession(options, true);
|
|
886
|
+
if (!keywordSession) {
|
|
887
|
+
_this._commandLine.setPrompt(options.message);
|
|
888
|
+
}
|
|
889
|
+
var floatingMessage = new AcEdFloatingMessage(_this.view, {
|
|
890
|
+
parent: _this.view.canvas,
|
|
891
|
+
message: options.message
|
|
892
|
+
});
|
|
893
|
+
var selected = new Set();
|
|
894
|
+
var startWcs = null;
|
|
895
|
+
var startCanvas = null;
|
|
896
|
+
var previewEl = null;
|
|
897
|
+
var settled = false;
|
|
898
|
+
var cleanup = function () {
|
|
899
|
+
if (settled)
|
|
900
|
+
return;
|
|
901
|
+
settled = true;
|
|
902
|
+
_this.active = false;
|
|
903
|
+
_this.entitySelectionActive = false;
|
|
904
|
+
floatingMessage === null || floatingMessage === void 0 ? void 0 : floatingMessage.dispose();
|
|
905
|
+
previewEl === null || previewEl === void 0 ? void 0 : previewEl.remove();
|
|
906
|
+
keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.cancel();
|
|
907
|
+
_this._commandLine.clear();
|
|
908
|
+
document.removeEventListener('keydown', keyHandler);
|
|
909
|
+
_this.view.canvas.removeEventListener('mousedown', mouseDown);
|
|
910
|
+
_this.view.canvas.removeEventListener('mousemove', mouseMove);
|
|
911
|
+
_this.view.canvas.removeEventListener('mouseup', mouseUp);
|
|
912
|
+
_this.view.canvas.removeEventListener('contextmenu', contextMenuHandler);
|
|
913
|
+
};
|
|
914
|
+
keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.promise.then(function (keyword) {
|
|
915
|
+
if (settled)
|
|
916
|
+
return;
|
|
917
|
+
if (!keyword) {
|
|
918
|
+
cleanup();
|
|
919
|
+
reject(new Error('cancelled'));
|
|
920
|
+
return;
|
|
626
921
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
var startCanvas = null;
|
|
634
|
-
var previewEl = null;
|
|
635
|
-
var settled = false;
|
|
636
|
-
var cleanup = function () {
|
|
637
|
-
if (settled)
|
|
638
|
-
return;
|
|
639
|
-
settled = true;
|
|
640
|
-
_this.active = false;
|
|
641
|
-
_this.entitySelectionActive = false;
|
|
642
|
-
floatingMessage === null || floatingMessage === void 0 ? void 0 : floatingMessage.dispose();
|
|
643
|
-
previewEl === null || previewEl === void 0 ? void 0 : previewEl.remove();
|
|
644
|
-
keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.cancel();
|
|
645
|
-
_this._commandLine.clear();
|
|
646
|
-
document.removeEventListener('keydown', keyHandler);
|
|
647
|
-
_this.view.canvas.removeEventListener('mousedown', mouseDown);
|
|
648
|
-
_this.view.canvas.removeEventListener('mousemove', mouseMove);
|
|
649
|
-
_this.view.canvas.removeEventListener('mouseup', mouseUp);
|
|
650
|
-
};
|
|
651
|
-
keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.promise.then(function (keyword) {
|
|
652
|
-
if (settled)
|
|
653
|
-
return;
|
|
654
|
-
if (!keyword) {
|
|
655
|
-
cleanup();
|
|
656
|
-
reject(new Error('cancelled'));
|
|
657
|
-
return;
|
|
658
|
-
}
|
|
922
|
+
cleanup();
|
|
923
|
+
reject(new AcEdKeywordInputError(keyword));
|
|
924
|
+
});
|
|
925
|
+
/** ---------- Keyboard ---------- */
|
|
926
|
+
var keyHandler = function (e) {
|
|
927
|
+
if (e.key === 'Escape') {
|
|
659
928
|
cleanup();
|
|
660
|
-
reject(new
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
929
|
+
reject(new Error('cancelled'));
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
if (e.key === 'Enter') {
|
|
933
|
+
cleanup();
|
|
934
|
+
resolve(__spreadArray([], __read(selected), false));
|
|
935
|
+
}
|
|
936
|
+
};
|
|
937
|
+
/** ---------- Mouse ---------- */
|
|
938
|
+
var contextMenuHandler = function (e) {
|
|
939
|
+
if (_this.shouldUseRightClickEnter()) {
|
|
940
|
+
e.preventDefault();
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
var mouseDown = function (e) {
|
|
944
|
+
if (e.button === 2) {
|
|
945
|
+
if (_this.shouldUseRightClickEnter()) {
|
|
946
|
+
e.preventDefault();
|
|
670
947
|
cleanup();
|
|
671
948
|
resolve(__spreadArray([], __read(selected), false));
|
|
672
949
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
if (e.button !== 0)
|
|
953
|
+
return;
|
|
954
|
+
startCanvas = _this.view.viewportToCanvas({
|
|
955
|
+
x: e.clientX,
|
|
956
|
+
y: e.clientY
|
|
957
|
+
});
|
|
958
|
+
startWcs = _this.view.screenToWorld(startCanvas);
|
|
959
|
+
previewEl = document.createElement('div');
|
|
960
|
+
previewEl.className = 'ml-jig-preview-rect';
|
|
961
|
+
_this.view.container.appendChild(previewEl);
|
|
962
|
+
};
|
|
963
|
+
var mouseMove = function (e) {
|
|
964
|
+
if (e.buttons !== 1)
|
|
965
|
+
return;
|
|
966
|
+
if (!startWcs || !previewEl || !startCanvas)
|
|
967
|
+
return;
|
|
968
|
+
var curWcs = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
|
|
969
|
+
var curCanvas = _this.view.viewportToCanvas({
|
|
970
|
+
x: e.clientX,
|
|
971
|
+
y: e.clientY
|
|
972
|
+
});
|
|
973
|
+
var p1 = _this.view.worldToScreen(startWcs);
|
|
974
|
+
var p2 = _this.view.worldToScreen(curWcs);
|
|
975
|
+
var left = Math.min(p1.x, p2.x);
|
|
976
|
+
var top = Math.min(p1.y, p2.y);
|
|
977
|
+
var width = Math.abs(p1.x - p2.x);
|
|
978
|
+
var height = Math.abs(p1.y - p2.y);
|
|
979
|
+
var mode = _this.view.getSelectionMode(startCanvas, curCanvas);
|
|
980
|
+
var action = _this.view.getSelectionActionFromEvent(e, 'add');
|
|
981
|
+
var style = _this.view.getSelectionPreviewStyle(mode, action);
|
|
982
|
+
Object.assign(previewEl.style, {
|
|
983
|
+
left: "".concat(left, "px"),
|
|
984
|
+
top: "".concat(top, "px"),
|
|
985
|
+
width: "".concat(width, "px"),
|
|
986
|
+
height: "".concat(height, "px"),
|
|
987
|
+
borderStyle: style.borderStyle,
|
|
988
|
+
background: style.background
|
|
989
|
+
});
|
|
990
|
+
previewEl.style.setProperty('--line-color', style.lineColor);
|
|
991
|
+
};
|
|
992
|
+
var mouseUp = function (e) {
|
|
993
|
+
var e_2, _a;
|
|
994
|
+
if (e.button !== 0)
|
|
995
|
+
return;
|
|
996
|
+
if (!startWcs || !startCanvas)
|
|
997
|
+
return;
|
|
998
|
+
var endWcs = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
|
|
999
|
+
var endCanvas = _this.view.viewportToCanvas({
|
|
1000
|
+
x: e.clientX,
|
|
1001
|
+
y: e.clientY
|
|
1002
|
+
});
|
|
1003
|
+
previewEl === null || previewEl === void 0 ? void 0 : previewEl.remove();
|
|
1004
|
+
previewEl = null;
|
|
1005
|
+
// Click selection
|
|
1006
|
+
var action = _this.view.getSelectionActionFromEvent(e, 'add');
|
|
1007
|
+
if (_this.view.isSelectionClick(startCanvas, endCanvas)) {
|
|
1008
|
+
var picked = _this.view.pick(endWcs);
|
|
1009
|
+
if (picked.length > 0) {
|
|
1010
|
+
_this.view.applySelection([picked[0].id], action);
|
|
733
1011
|
}
|
|
734
|
-
else {
|
|
735
|
-
|
|
736
|
-
var box = new AcGeBox2d()
|
|
737
|
-
.expandByPoint(startWcs)
|
|
738
|
-
.expandByPoint(endWcs);
|
|
739
|
-
var mode = _this.view.getSelectionMode(startCanvas, endCanvas);
|
|
740
|
-
_this.view.selectByBoxWithMode(box, mode, action);
|
|
1012
|
+
else if (action === 'replace') {
|
|
1013
|
+
_this.view.selectionSet.clear();
|
|
741
1014
|
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
1015
|
+
}
|
|
1016
|
+
else {
|
|
1017
|
+
// Box selection
|
|
1018
|
+
var box = new AcGeBox2d()
|
|
1019
|
+
.expandByPoint(startWcs)
|
|
1020
|
+
.expandByPoint(endWcs);
|
|
1021
|
+
var mode = _this.view.getSelectionMode(startCanvas, endCanvas);
|
|
1022
|
+
_this.view.selectByBoxWithMode(box, mode, action);
|
|
1023
|
+
}
|
|
1024
|
+
selected.clear();
|
|
1025
|
+
try {
|
|
1026
|
+
for (var _b = __values(_this.view.selectionSet.ids), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1027
|
+
var id = _c.value;
|
|
1028
|
+
selected.add(id);
|
|
748
1029
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
finally { if (e_1) throw e_1.error; }
|
|
1030
|
+
}
|
|
1031
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1032
|
+
finally {
|
|
1033
|
+
try {
|
|
1034
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
755
1035
|
}
|
|
756
|
-
if (
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
1036
|
+
finally { if (e_2) throw e_2.error; }
|
|
1037
|
+
}
|
|
1038
|
+
if (options.singleOnly && action !== 'remove') {
|
|
1039
|
+
if (selected.size > 0) {
|
|
1040
|
+
cleanup();
|
|
1041
|
+
resolve(__spreadArray([], __read(selected), false));
|
|
761
1042
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
if (this.isPromptCancelled(error_7)) {
|
|
776
|
-
return [2 /*return*/, new AcEdPromptSelectionResult(AcEdPromptStatus.Cancel)];
|
|
777
|
-
}
|
|
778
|
-
if (this.isPromptKeyword(error_7)) {
|
|
779
|
-
return [2 /*return*/, new AcEdPromptSelectionResult(AcEdPromptStatus.Keyword, undefined, error_7.keyword)];
|
|
780
|
-
}
|
|
781
|
-
throw error_7;
|
|
782
|
-
case 3: return [2 /*return*/];
|
|
783
|
-
}
|
|
1043
|
+
}
|
|
1044
|
+
startWcs = null;
|
|
1045
|
+
startCanvas = null;
|
|
1046
|
+
};
|
|
1047
|
+
document.addEventListener('keydown', keyHandler);
|
|
1048
|
+
_this.view.canvas.addEventListener('mousedown', mouseDown);
|
|
1049
|
+
_this.view.canvas.addEventListener('mousemove', mouseMove);
|
|
1050
|
+
_this.view.canvas.addEventListener('mouseup', mouseUp);
|
|
1051
|
+
_this.view.canvas.addEventListener('contextmenu', contextMenuHandler);
|
|
1052
|
+
});
|
|
1053
|
+
}, function (value) {
|
|
1054
|
+
return new AcEdPromptSelectionResult(AcEdPromptStatus.OK, new AcEdSelectionSet(value));
|
|
1055
|
+
}, function (status) { return new AcEdPromptSelectionResult(status); }, { none: false })];
|
|
784
1056
|
});
|
|
785
1057
|
});
|
|
786
1058
|
};
|
|
787
1059
|
/**
|
|
788
1060
|
* Prompts the user to select a single entity.
|
|
789
|
-
*
|
|
1061
|
+
*
|
|
1062
|
+
* Selection is performed by clicking in the view and validating the first
|
|
1063
|
+
* hit-tested entity under the cursor. The picked entity may be rejected when
|
|
1064
|
+
* it belongs to a locked layer or does not satisfy the prompt's allowed-class
|
|
1065
|
+
* filter, in which case the rejection message is shown and the prompt remains
|
|
1066
|
+
* active. Keywords and `AllowNone` behavior are also supported.
|
|
1067
|
+
*
|
|
1068
|
+
* @param options - Entity prompt options controlling filtering, messaging, and keywords
|
|
1069
|
+
* @returns A prompt result containing the selected entity id, picked point,
|
|
1070
|
+
* cancel status, or keyword
|
|
790
1071
|
*/
|
|
791
1072
|
AcEdInputManager.prototype.getEntity = function (options) {
|
|
792
1073
|
return __awaiter(this, void 0, void 0, function () {
|
|
793
|
-
var
|
|
1074
|
+
var pickedPoint;
|
|
794
1075
|
var _this = this;
|
|
795
1076
|
return __generator(this, function (_a) {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
1077
|
+
return [2 /*return*/, this.executePrompt(function () {
|
|
1078
|
+
return new Promise(function (resolve, reject) {
|
|
1079
|
+
_this.active = true;
|
|
1080
|
+
_this.entitySelectionActive = true;
|
|
1081
|
+
var keywordSession = _this.startKeywordSession(options, true);
|
|
1082
|
+
var floatingMessage = new AcEdFloatingMessage(_this.view, {
|
|
1083
|
+
parent: _this.view.canvas,
|
|
1084
|
+
message: options.message
|
|
1085
|
+
});
|
|
1086
|
+
if (!keywordSession) {
|
|
1087
|
+
_this._commandLine.setPrompt(options.message);
|
|
1088
|
+
}
|
|
1089
|
+
var settled = false;
|
|
1090
|
+
var cleanup = function () {
|
|
1091
|
+
var _a;
|
|
1092
|
+
if (settled)
|
|
1093
|
+
return;
|
|
1094
|
+
settled = true;
|
|
1095
|
+
_this.active = false;
|
|
1096
|
+
_this.entitySelectionActive = false;
|
|
1097
|
+
(_a = options.jig) === null || _a === void 0 ? void 0 : _a.end();
|
|
1098
|
+
document.removeEventListener('keydown', keyHandler);
|
|
1099
|
+
_this.view.canvas.removeEventListener('mousedown', clickHandler);
|
|
1100
|
+
_this.view.canvas.removeEventListener('contextmenu', contextMenuHandler);
|
|
1101
|
+
floatingMessage === null || floatingMessage === void 0 ? void 0 : floatingMessage.dispose();
|
|
1102
|
+
keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.cancel();
|
|
1103
|
+
_this._commandLine.clear();
|
|
1104
|
+
};
|
|
1105
|
+
keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.promise.then(function (keyword) {
|
|
1106
|
+
if (settled)
|
|
1107
|
+
return;
|
|
1108
|
+
if (!keyword) {
|
|
1109
|
+
cleanup();
|
|
1110
|
+
reject(new Error('cancelled'));
|
|
1111
|
+
return;
|
|
809
1112
|
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
_this.
|
|
817
|
-
|
|
818
|
-
(_a = options.jig) === null || _a === void 0 ? void 0 : _a.end();
|
|
819
|
-
document.removeEventListener('keydown', keyHandler);
|
|
820
|
-
_this.view.canvas.removeEventListener('mousedown', clickHandler);
|
|
821
|
-
floatingMessage === null || floatingMessage === void 0 ? void 0 : floatingMessage.dispose();
|
|
822
|
-
keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.cancel();
|
|
823
|
-
_this._commandLine.clear();
|
|
824
|
-
};
|
|
825
|
-
keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.promise.then(function (keyword) {
|
|
826
|
-
if (settled)
|
|
827
|
-
return;
|
|
828
|
-
if (!keyword) {
|
|
1113
|
+
cleanup();
|
|
1114
|
+
reject(new AcEdKeywordInputError(keyword));
|
|
1115
|
+
});
|
|
1116
|
+
/** Mouse click → try select entity */
|
|
1117
|
+
var clickHandler = function (e) {
|
|
1118
|
+
if (e.button === 2) {
|
|
1119
|
+
if (_this.shouldUseRightClickEnter() && options.allowNone) {
|
|
1120
|
+
e.preventDefault();
|
|
829
1121
|
cleanup();
|
|
830
|
-
|
|
831
|
-
return;
|
|
1122
|
+
resolve(null);
|
|
832
1123
|
}
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
if (e.button !== 0)
|
|
1127
|
+
return;
|
|
1128
|
+
var pos = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
|
|
1129
|
+
var picked = _this.view.pick(pos, undefined, true);
|
|
1130
|
+
// Clicked empty space
|
|
1131
|
+
if (picked.length == 0) {
|
|
1132
|
+
_this._commandLine.showMessage(options.rejectMessage, 'warning');
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
var entity = _this.getEntityById(picked[0].id);
|
|
1136
|
+
if (!entity) {
|
|
1137
|
+
_this._commandLine.showMessage(options.rejectMessage, 'warning');
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
if (!options.allowObjectOnLockedLayer &&
|
|
1141
|
+
_this.isEntityOnLockedLayer(entity)) {
|
|
1142
|
+
_this._commandLine.showMessage(options.rejectMessage, 'warning');
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
if (!_this.isEntityClassAllowed(entity, options)) {
|
|
1146
|
+
_this._commandLine.showMessage(options.rejectMessage, 'warning');
|
|
1147
|
+
return;
|
|
1148
|
+
}
|
|
1149
|
+
pickedPoint = { x: pos.x, y: pos.y, z: 0 };
|
|
1150
|
+
cleanup();
|
|
1151
|
+
resolve(picked[0].id);
|
|
1152
|
+
};
|
|
1153
|
+
/** Keyboard handling */
|
|
1154
|
+
var keyHandler = function (e) {
|
|
1155
|
+
if (e.key === 'Escape') {
|
|
833
1156
|
cleanup();
|
|
834
|
-
reject(new
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
var pos = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
|
|
839
|
-
var picked = _this.view.pick(pos);
|
|
840
|
-
// Clicked empty space
|
|
841
|
-
if (picked.length == 0) {
|
|
842
|
-
// this.view.showMessage(options.rejectMessage)
|
|
843
|
-
return;
|
|
844
|
-
}
|
|
845
|
-
// Locked layer
|
|
846
|
-
// if (picked.locked && !options.allowObjectOnLockedLayer) {
|
|
847
|
-
// this.view.showMessage(options.rejectMessage)
|
|
848
|
-
// return
|
|
849
|
-
// }
|
|
850
|
-
// Class filter
|
|
851
|
-
// if (!options.isClassAllowed(picked.className)) {
|
|
852
|
-
// this.view.showMessage(options.rejectMessage)
|
|
853
|
-
// return
|
|
854
|
-
// }
|
|
1157
|
+
reject(new Error('cancelled'));
|
|
1158
|
+
return;
|
|
1159
|
+
}
|
|
1160
|
+
if (e.key === 'Enter' && options.allowNone) {
|
|
855
1161
|
cleanup();
|
|
856
|
-
resolve(
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
_this.view.canvas.addEventListener('mousedown', clickHandler);
|
|
872
|
-
})];
|
|
873
|
-
case 1:
|
|
874
|
-
value = _a.sent();
|
|
875
|
-
return [2 /*return*/, new AcEdPromptEntityResult(AcEdPromptStatus.OK, value || undefined)];
|
|
876
|
-
case 2:
|
|
877
|
-
error_8 = _a.sent();
|
|
878
|
-
if (this.isPromptCancelled(error_8)) {
|
|
879
|
-
return [2 /*return*/, new AcEdPromptEntityResult(AcEdPromptStatus.Cancel)];
|
|
880
|
-
}
|
|
881
|
-
if (this.isPromptKeyword(error_8)) {
|
|
882
|
-
result = new AcEdPromptEntityResult(AcEdPromptStatus.Keyword);
|
|
883
|
-
result.stringResult = error_8.keyword;
|
|
884
|
-
return [2 /*return*/, result];
|
|
885
|
-
}
|
|
886
|
-
throw error_8;
|
|
887
|
-
case 3: return [2 /*return*/];
|
|
888
|
-
}
|
|
1162
|
+
resolve(null);
|
|
1163
|
+
}
|
|
1164
|
+
};
|
|
1165
|
+
var contextMenuHandler = function (e) {
|
|
1166
|
+
if (_this.shouldUseRightClickEnter()) {
|
|
1167
|
+
e.preventDefault();
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
|
+
document.addEventListener('keydown', keyHandler);
|
|
1171
|
+
_this.view.canvas.addEventListener('mousedown', clickHandler);
|
|
1172
|
+
_this.view.canvas.addEventListener('contextmenu', contextMenuHandler);
|
|
1173
|
+
});
|
|
1174
|
+
}, function (value) {
|
|
1175
|
+
return new AcEdPromptEntityResult(AcEdPromptStatus.OK, value || undefined, pickedPoint);
|
|
1176
|
+
}, function (status) { return new AcEdPromptEntityResult(status); }, { none: false })];
|
|
889
1177
|
});
|
|
890
1178
|
});
|
|
891
1179
|
};
|
|
@@ -893,76 +1181,88 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
893
1181
|
* Prompt the user to specify a rectangular box by selecting two corners.
|
|
894
1182
|
* Each corner may be specified by clicking on the canvas or typing "x,y".
|
|
895
1183
|
* A live HTML overlay rectangle previews the box as the user moves the mouse.
|
|
1184
|
+
*
|
|
1185
|
+
* The box prompt is implemented as two chained point prompts. Keywords from
|
|
1186
|
+
* the original box prompt are copied into each corner prompt so the caller
|
|
1187
|
+
* sees a consistent interaction model across both stages.
|
|
1188
|
+
*
|
|
1189
|
+
* @param options - Box prompt options controlling corner messages, preview behavior, and keywords
|
|
1190
|
+
* @returns A prompt result containing the final 2D box, cancel status, or keyword
|
|
896
1191
|
*/
|
|
897
1192
|
AcEdInputManager.prototype.getBox = function (options) {
|
|
898
1193
|
return __awaiter(this, void 0, void 0, function () {
|
|
899
|
-
var message1, options1, p1Result, p1, cwcsP1_1, previewEl_1, cleanup, drawPreview, message2, options2, p2, box, error_9;
|
|
900
1194
|
var _this = this;
|
|
901
1195
|
return __generator(this, function (_a) {
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
throw error_9;
|
|
958
|
-
case 4: return [2 /*return*/];
|
|
959
|
-
}
|
|
1196
|
+
return [2 /*return*/, this.executePrompt(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1197
|
+
var message1, options1, p1Result, p1, cwcsP1, previewEl, cleanup, drawPreview, message2, options2, p2, box;
|
|
1198
|
+
var _this = this;
|
|
1199
|
+
return __generator(this, function (_a) {
|
|
1200
|
+
switch (_a.label) {
|
|
1201
|
+
case 0:
|
|
1202
|
+
message1 = options.firstCornerMessage ||
|
|
1203
|
+
AcApI18n.t('main.inputManager.firstCorner');
|
|
1204
|
+
options1 = new AcEdPromptPointOptions(message1);
|
|
1205
|
+
this.copyKeywords(options, options1);
|
|
1206
|
+
options1.useDashedLine = options.useDashedLine;
|
|
1207
|
+
options1.useBasePoint = options.useBasePoint;
|
|
1208
|
+
options1.disableOSnap = options.disableOSnap;
|
|
1209
|
+
return [4 /*yield*/, this.getPoint(options1)];
|
|
1210
|
+
case 1:
|
|
1211
|
+
p1Result = _a.sent();
|
|
1212
|
+
if (p1Result.status !== AcEdPromptStatus.OK) {
|
|
1213
|
+
return [2 /*return*/, new AcEdPromptBoxResult(p1Result.status, undefined, p1Result.stringResult)];
|
|
1214
|
+
}
|
|
1215
|
+
p1 = p1Result.value;
|
|
1216
|
+
cwcsP1 = this.view.worldToScreen(p1);
|
|
1217
|
+
previewEl = document.createElement('div');
|
|
1218
|
+
previewEl.className = 'ml-jig-preview-rect';
|
|
1219
|
+
this.view.container.appendChild(previewEl);
|
|
1220
|
+
cleanup = function () {
|
|
1221
|
+
previewEl.remove();
|
|
1222
|
+
};
|
|
1223
|
+
drawPreview = function (pos) {
|
|
1224
|
+
var cwcsP2 = _this.view.worldToScreen(pos);
|
|
1225
|
+
var left = Math.min(cwcsP2.x, cwcsP1.x);
|
|
1226
|
+
var top = Math.min(cwcsP2.y, cwcsP1.y);
|
|
1227
|
+
var width = Math.abs(cwcsP2.x - cwcsP1.x);
|
|
1228
|
+
var height = Math.abs(cwcsP2.y - cwcsP1.y);
|
|
1229
|
+
Object.assign(previewEl.style, {
|
|
1230
|
+
left: "".concat(left, "px"),
|
|
1231
|
+
top: "".concat(top, "px"),
|
|
1232
|
+
width: "".concat(width, "px"),
|
|
1233
|
+
height: "".concat(height, "px")
|
|
1234
|
+
});
|
|
1235
|
+
};
|
|
1236
|
+
message2 = options.secondCornerMessage ||
|
|
1237
|
+
AcApI18n.t('main.inputManager.secondCorner');
|
|
1238
|
+
options2 = new AcEdPromptPointOptions(message2);
|
|
1239
|
+
this.copyKeywords(options, options2);
|
|
1240
|
+
options2.useDashedLine = options.useDashedLine;
|
|
1241
|
+
options2.useBasePoint = options.useBasePoint;
|
|
1242
|
+
options2.disableOSnap = options.disableOSnap;
|
|
1243
|
+
return [4 /*yield*/, this.getPointInternal(options2, cleanup, drawPreview)];
|
|
1244
|
+
case 2:
|
|
1245
|
+
p2 = _a.sent();
|
|
1246
|
+
box = new AcGeBox2d().expandByPoint(p1).expandByPoint(p2);
|
|
1247
|
+
return [2 /*return*/, new AcEdPromptBoxResult(AcEdPromptStatus.OK, box)];
|
|
1248
|
+
}
|
|
1249
|
+
});
|
|
1250
|
+
}); }, function (value) { return value; }, function (status) { return new AcEdPromptBoxResult(status); })];
|
|
960
1251
|
});
|
|
961
1252
|
});
|
|
962
1253
|
};
|
|
963
1254
|
/**
|
|
964
1255
|
* Shared point input logic used by getPoint() and getBox(). Accepts "x,y"
|
|
965
1256
|
* typed input OR mouse click.
|
|
1257
|
+
*
|
|
1258
|
+
* This helper optionally wires extra cleanup and preview callbacks so
|
|
1259
|
+
* higher-level workflows can overlay additional temporary graphics while
|
|
1260
|
+
* reusing the same point acquisition behavior.
|
|
1261
|
+
*
|
|
1262
|
+
* @param options - Point prompt options controlling the interaction
|
|
1263
|
+
* @param cleanup - Optional callback invoked when the point prompt ends
|
|
1264
|
+
* @param drawPreview - Optional callback invoked as the cursor moves for live preview rendering
|
|
1265
|
+
* @returns A promise that resolves to the chosen point
|
|
966
1266
|
*/
|
|
967
1267
|
AcEdInputManager.prototype.getPointInternal = function (options, cleanup, drawPreview) {
|
|
968
1268
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -987,6 +1287,7 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
987
1287
|
return [2 /*return*/, this.makeFloatingInputPromise({
|
|
988
1288
|
inputCount: 2,
|
|
989
1289
|
promptOptions: options,
|
|
1290
|
+
disableOSnap: options.disableOSnap,
|
|
990
1291
|
cleanup: cleanup,
|
|
991
1292
|
handler: handler,
|
|
992
1293
|
getDynamicValue: getDynamicValue,
|
|
@@ -998,11 +1299,27 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
998
1299
|
/**
|
|
999
1300
|
* Attempts to consume one scripted input and parse it as a point.
|
|
1000
1301
|
* Supported forms: "x,y", "x,y,z", or "x y".
|
|
1302
|
+
*
|
|
1303
|
+
* Successful scripted points also update `lastPoint` so subsequent prompts
|
|
1304
|
+
* that rely on prior geometric context behave the same way as with manual
|
|
1305
|
+
* point picking.
|
|
1306
|
+
*
|
|
1307
|
+
* @param options - Point prompt options used to validate the scripted coordinates
|
|
1308
|
+
* @returns Parsed point value, or `undefined` when no scripted token is queued
|
|
1309
|
+
* @throws Error if a queued scripted token cannot be parsed as a valid point
|
|
1001
1310
|
*/
|
|
1002
1311
|
AcEdInputManager.prototype.tryGetScriptedPoint = function (options) {
|
|
1003
1312
|
var token = this.dequeueScriptInput();
|
|
1004
1313
|
if (token === undefined)
|
|
1005
1314
|
return undefined;
|
|
1315
|
+
var trimmed = token.trim();
|
|
1316
|
+
if (!trimmed && options.allowNone) {
|
|
1317
|
+
throw new AcEdNoneInputError();
|
|
1318
|
+
}
|
|
1319
|
+
var keyword = options.keywords.findByName(trimmed);
|
|
1320
|
+
if (keyword) {
|
|
1321
|
+
throw new AcEdKeywordInputError(keyword.globalName);
|
|
1322
|
+
}
|
|
1006
1323
|
var parsed = this.splitScriptedPoint(token);
|
|
1007
1324
|
if (!parsed) {
|
|
1008
1325
|
throw new Error("Invalid point input '".concat(token, "'"));
|
|
@@ -1016,6 +1333,16 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
1016
1333
|
};
|
|
1017
1334
|
/**
|
|
1018
1335
|
* Attempts to consume one scripted input and parse it with the supplied handler.
|
|
1336
|
+
*
|
|
1337
|
+
* Scripted input is used to emulate command-line entry in automated or
|
|
1338
|
+
* replayed workflows. This helper keeps the parsing path consistent with
|
|
1339
|
+
* interactive input by delegating to the same handler implementation used by
|
|
1340
|
+
* the floating-input UI.
|
|
1341
|
+
*
|
|
1342
|
+
* @typeParam T - Parsed value type
|
|
1343
|
+
* @param handler - Input handler used to parse the queued token
|
|
1344
|
+
* @returns Parsed value, or `undefined` when no scripted token is available
|
|
1345
|
+
* @throws Error if a queued token exists but fails validation
|
|
1019
1346
|
*/
|
|
1020
1347
|
AcEdInputManager.prototype.tryGetScriptedValue = function (handler) {
|
|
1021
1348
|
var token = this.dequeueScriptInput();
|
|
@@ -1027,14 +1354,39 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
1027
1354
|
}
|
|
1028
1355
|
return value;
|
|
1029
1356
|
};
|
|
1357
|
+
/**
|
|
1358
|
+
* Attempts to consume one scripted numeric token.
|
|
1359
|
+
*
|
|
1360
|
+
* This is a thin specialization of {@link tryGetScriptedValue} that narrows
|
|
1361
|
+
* the accepted handler types to those used by numeric-style prompts.
|
|
1362
|
+
*
|
|
1363
|
+
* @param handler - Numeric handler used to parse the queued token
|
|
1364
|
+
* @returns Parsed numeric value, or `undefined` when no scripted token is queued
|
|
1365
|
+
*/
|
|
1030
1366
|
AcEdInputManager.prototype.tryGetScriptedNumber = function (handler) {
|
|
1031
1367
|
return this.tryGetScriptedValue(handler);
|
|
1032
1368
|
};
|
|
1369
|
+
/**
|
|
1370
|
+
* Removes and returns the next queued scripted input token.
|
|
1371
|
+
*
|
|
1372
|
+
* @returns The next scripted token, or `undefined` when the queue is empty
|
|
1373
|
+
*/
|
|
1033
1374
|
AcEdInputManager.prototype.dequeueScriptInput = function () {
|
|
1034
1375
|
if (!this._scriptInputs.length)
|
|
1035
1376
|
return undefined;
|
|
1036
1377
|
return this._scriptInputs.shift();
|
|
1037
1378
|
};
|
|
1379
|
+
/**
|
|
1380
|
+
* Splits a scripted point token into x/y coordinate components.
|
|
1381
|
+
*
|
|
1382
|
+
* The accepted formats intentionally mirror common CAD command-line point
|
|
1383
|
+
* entry conventions, including comma-separated coordinates and whitespace-
|
|
1384
|
+
* separated coordinates. An optional third `z` component is tolerated for
|
|
1385
|
+
* compatibility, but only the `x` and `y` values are used by 2D prompts.
|
|
1386
|
+
*
|
|
1387
|
+
* @param token - Raw scripted point token
|
|
1388
|
+
* @returns Extracted x/y string pair, or `undefined` if the token is malformed
|
|
1389
|
+
*/
|
|
1038
1390
|
AcEdInputManager.prototype.splitScriptedPoint = function (token) {
|
|
1039
1391
|
var trimmed = token.trim();
|
|
1040
1392
|
if (!trimmed)
|
|
@@ -1052,9 +1404,70 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
1052
1404
|
return undefined;
|
|
1053
1405
|
return { x: parts[0], y: parts[1] };
|
|
1054
1406
|
};
|
|
1407
|
+
/**
|
|
1408
|
+
* Returns whether an unknown error value represents prompt cancellation.
|
|
1409
|
+
*
|
|
1410
|
+
* Prompt flows normalize cancellation to a regular `Error` with the message
|
|
1411
|
+
* `'cancelled'`. This helper keeps the outer result-conversion code concise
|
|
1412
|
+
* and consistent across prompt types.
|
|
1413
|
+
*
|
|
1414
|
+
* @param error - Unknown error value thrown from an input workflow
|
|
1415
|
+
* @returns `true` if the error represents prompt cancellation
|
|
1416
|
+
*/
|
|
1055
1417
|
AcEdInputManager.prototype.isPromptCancelled = function (error) {
|
|
1056
1418
|
return error instanceof Error && error.message === 'cancelled';
|
|
1057
1419
|
};
|
|
1420
|
+
/**
|
|
1421
|
+
* Returns whether an unknown error value represents PromptStatus.None.
|
|
1422
|
+
*
|
|
1423
|
+
* @param error - Unknown error value thrown from an input workflow
|
|
1424
|
+
* @returns `true` if the error represents "no input" confirmation
|
|
1425
|
+
*/
|
|
1426
|
+
AcEdInputManager.prototype.isPromptNone = function (error) {
|
|
1427
|
+
return error instanceof AcEdNoneInputError;
|
|
1428
|
+
};
|
|
1429
|
+
/**
|
|
1430
|
+
* Reads SHORTCUTMENU value from current working database.
|
|
1431
|
+
*
|
|
1432
|
+
* @returns Normalized 0..3 shortcut-menu mode
|
|
1433
|
+
*/
|
|
1434
|
+
AcEdInputManager.prototype.getShortcutMenuMode = function () {
|
|
1435
|
+
var db = acdbHostApplicationServices().workingDatabase;
|
|
1436
|
+
var raw = AcDbSysVarManager.instance().getVar(AcDbSystemVariables.SHORTCUTMENU, db);
|
|
1437
|
+
var value = Math.trunc(Number(raw));
|
|
1438
|
+
if (Number.isNaN(value))
|
|
1439
|
+
return 0;
|
|
1440
|
+
var normalized = value & 0x3;
|
|
1441
|
+
return normalized;
|
|
1442
|
+
};
|
|
1443
|
+
/**
|
|
1444
|
+
* Resolves right-click behavior for current prompt session.
|
|
1445
|
+
*
|
|
1446
|
+
* SHORTCUTMENU:
|
|
1447
|
+
* 0 => always Enter
|
|
1448
|
+
* 1 => Enter in command, menu when idle
|
|
1449
|
+
* 2 => menu in command
|
|
1450
|
+
* 3 => always menu
|
|
1451
|
+
*/
|
|
1452
|
+
AcEdInputManager.prototype.shouldUseRightClickEnter = function () {
|
|
1453
|
+
var mode = this.getShortcutMenuMode();
|
|
1454
|
+
if (mode === 0)
|
|
1455
|
+
return true;
|
|
1456
|
+
if (mode === 1)
|
|
1457
|
+
return this.active;
|
|
1458
|
+
return false;
|
|
1459
|
+
};
|
|
1460
|
+
/**
|
|
1461
|
+
* Synchronizes the stored modifier-key snapshot with a DOM keyboard event.
|
|
1462
|
+
*
|
|
1463
|
+
* Floating preview rendering depends on modifier state for behaviors such as
|
|
1464
|
+
* temporary mode switches. This helper updates the cached modifier snapshot
|
|
1465
|
+
* and reports whether anything actually changed so callers can avoid
|
|
1466
|
+
* unnecessary preview refreshes.
|
|
1467
|
+
*
|
|
1468
|
+
* @param e - Keyboard-like event carrying modifier-key flags
|
|
1469
|
+
* @returns `true` if any modifier flag changed; otherwise `false`
|
|
1470
|
+
*/
|
|
1058
1471
|
AcEdInputManager.prototype.updateModifierStateFromEvent = function (e) {
|
|
1059
1472
|
var next = {
|
|
1060
1473
|
ctrlKey: !!e.ctrlKey,
|
|
@@ -1072,6 +1485,16 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
1072
1485
|
}
|
|
1073
1486
|
return changed;
|
|
1074
1487
|
};
|
|
1488
|
+
/**
|
|
1489
|
+
* Handles the sticky Ctrl toggle used by certain jig interactions.
|
|
1490
|
+
*
|
|
1491
|
+
* Instead of tracking Ctrl as a purely held modifier, some commands treat a
|
|
1492
|
+
* Ctrl key press as a persistent toggle. This helper flips that toggle on the
|
|
1493
|
+
* first non-repeating keydown event for the Control key.
|
|
1494
|
+
*
|
|
1495
|
+
* @param e - Keyboard event to inspect
|
|
1496
|
+
* @returns `true` if the toggle state changed and previews should refresh
|
|
1497
|
+
*/
|
|
1075
1498
|
AcEdInputManager.prototype.handleCtrlToggleKey = function (e) {
|
|
1076
1499
|
if (e.key !== 'Control' || e.repeat)
|
|
1077
1500
|
return false;
|
|
@@ -1081,29 +1504,51 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
1081
1504
|
return true;
|
|
1082
1505
|
};
|
|
1083
1506
|
/**
|
|
1084
|
-
*
|
|
1507
|
+
* Extracts cross-prompt defaults from a prompt options object.
|
|
1085
1508
|
*
|
|
1086
|
-
*
|
|
1087
|
-
*
|
|
1088
|
-
*
|
|
1509
|
+
* Not every prompt type exposes the same optional properties, but the
|
|
1510
|
+
* floating-input pipeline needs a normalized shape for values such as base
|
|
1511
|
+
* point, dashed-baseline behavior, jig, and base angle. This helper performs
|
|
1512
|
+
* those property-existence checks in one place.
|
|
1513
|
+
*
|
|
1514
|
+
* @typeParam T - Value type produced by the prompt
|
|
1515
|
+
* @param options - Prompt options to normalize
|
|
1516
|
+
* @returns A normalized object containing only the floating-input defaults it understands
|
|
1089
1517
|
*/
|
|
1090
1518
|
AcEdInputManager.prototype.resolvePromptDefaults = function (options) {
|
|
1091
1519
|
var hasBasePoint = 'basePoint' in options;
|
|
1092
1520
|
var hasUseBasePoint = 'useBasePoint' in options;
|
|
1093
1521
|
var hasUseDashedLine = 'useDashedLine' in options;
|
|
1522
|
+
var hasBaseAngle = 'baseAngle' in options;
|
|
1094
1523
|
var basePoint = hasBasePoint && options.basePoint
|
|
1095
1524
|
? options.basePoint
|
|
1096
1525
|
: undefined;
|
|
1097
1526
|
var useBasePoint = hasUseBasePoint ? options.useBasePoint : false;
|
|
1098
1527
|
var showBaseLineOnly = hasUseDashedLine ? !options.useDashedLine : false;
|
|
1528
|
+
var baseAngle = hasBaseAngle ? options.baseAngle : undefined;
|
|
1099
1529
|
return {
|
|
1100
1530
|
message: options.message,
|
|
1101
1531
|
jig: options.jig,
|
|
1102
1532
|
basePoint: basePoint,
|
|
1103
1533
|
useBasePoint: useBasePoint,
|
|
1104
|
-
showBaseLineOnly: showBaseLineOnly
|
|
1534
|
+
showBaseLineOnly: showBaseLineOnly,
|
|
1535
|
+
baseAngle: baseAngle
|
|
1105
1536
|
};
|
|
1106
1537
|
};
|
|
1538
|
+
/**
|
|
1539
|
+
* Runs a floating-input prompt and resolves it to a parsed value.
|
|
1540
|
+
*
|
|
1541
|
+
* This is the core interaction primitive used by most non-selection prompts.
|
|
1542
|
+
* It wires together command-line keyword handling, floating input creation,
|
|
1543
|
+
* validation, preview refreshes, jig updates, cancellation handling, and
|
|
1544
|
+
* cleanup. The method guarantees that temporary UI and event listeners are
|
|
1545
|
+
* torn down no matter how the prompt completes.
|
|
1546
|
+
*
|
|
1547
|
+
* @typeParam T - Value type produced by the prompt
|
|
1548
|
+
* @param options - Configuration describing how the floating prompt should parse,
|
|
1549
|
+
* validate, preview, and commit its value
|
|
1550
|
+
* @returns A promise that resolves with the committed value or rejects on cancel/keyword
|
|
1551
|
+
*/
|
|
1107
1552
|
AcEdInputManager.prototype.makeFloatingInputPromise = function (options) {
|
|
1108
1553
|
return __awaiter(this, void 0, void 0, function () {
|
|
1109
1554
|
var _this = this;
|
|
@@ -1134,6 +1579,10 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
1134
1579
|
if (!keywordSession) {
|
|
1135
1580
|
_this._commandLine.setPrompt(commandLineMessage);
|
|
1136
1581
|
}
|
|
1582
|
+
var allowNone = 'allowNone' in options.promptOptions
|
|
1583
|
+
? options.promptOptions.allowNone
|
|
1584
|
+
: false;
|
|
1585
|
+
var defaultBehavior = _this.resolvePromptDefaultValue(options.promptOptions);
|
|
1137
1586
|
var floatingInput = new AcEdFloatingInput(_this.view, {
|
|
1138
1587
|
parent: _this.view.canvas,
|
|
1139
1588
|
inputCount: options.inputCount,
|
|
@@ -1141,7 +1590,11 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
1141
1590
|
disableOSnap: options.disableOSnap,
|
|
1142
1591
|
showBaseLineOnly: promptDefaults.showBaseLineOnly,
|
|
1143
1592
|
basePoint: basePoint,
|
|
1593
|
+
baseAngle: promptDefaults.baseAngle,
|
|
1144
1594
|
allowPrompt: options.allowPrompt !== false,
|
|
1595
|
+
allowNone: allowNone,
|
|
1596
|
+
useDefaultValue: defaultBehavior.useDefaultValue,
|
|
1597
|
+
defaultValue: defaultBehavior.defaultValue,
|
|
1145
1598
|
validate: validate,
|
|
1146
1599
|
getDynamicValue: options.getDynamicValue,
|
|
1147
1600
|
drawPreview: function (pos) {
|
|
@@ -1167,7 +1620,8 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
1167
1620
|
}
|
|
1168
1621
|
return result;
|
|
1169
1622
|
},
|
|
1170
|
-
onCancel: function () { return rejector(); }
|
|
1623
|
+
onCancel: function () { return rejector(); },
|
|
1624
|
+
onNone: function () { return noneRejector(); }
|
|
1171
1625
|
});
|
|
1172
1626
|
var cleanup = function () {
|
|
1173
1627
|
var _a, _b;
|
|
@@ -1181,6 +1635,7 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
1181
1635
|
document.removeEventListener('keydown', escHandler);
|
|
1182
1636
|
document.removeEventListener('keydown', modifierHandler);
|
|
1183
1637
|
document.removeEventListener('keyup', modifierHandler);
|
|
1638
|
+
_this.view.canvas.removeEventListener('contextmenu', contextMenuHandler);
|
|
1184
1639
|
floatingInput.dispose();
|
|
1185
1640
|
keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.cancel();
|
|
1186
1641
|
_this._commandLine.clear();
|
|
@@ -1193,6 +1648,9 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
1193
1648
|
cleanup();
|
|
1194
1649
|
reject(err !== null && err !== void 0 ? err : new Error('cancelled'));
|
|
1195
1650
|
};
|
|
1651
|
+
var noneRejector = function () {
|
|
1652
|
+
rejector(new AcEdNoneInputError());
|
|
1653
|
+
};
|
|
1196
1654
|
var keywordRejector = function (keyword) {
|
|
1197
1655
|
rejector(new AcEdKeywordInputError(keyword));
|
|
1198
1656
|
};
|
|
@@ -1208,9 +1666,16 @@ var AcEdInputManager = /** @class */ (function () {
|
|
|
1208
1666
|
floatingInput.requestPreviewRefresh();
|
|
1209
1667
|
}
|
|
1210
1668
|
};
|
|
1669
|
+
var contextMenuHandler = function (e) {
|
|
1670
|
+
if (!_this.shouldUseRightClickEnter())
|
|
1671
|
+
return;
|
|
1672
|
+
e.preventDefault();
|
|
1673
|
+
noneRejector();
|
|
1674
|
+
};
|
|
1211
1675
|
document.addEventListener('keydown', escHandler);
|
|
1212
1676
|
document.addEventListener('keydown', modifierHandler);
|
|
1213
1677
|
document.addEventListener('keyup', modifierHandler);
|
|
1678
|
+
_this.view.canvas.addEventListener('contextmenu', contextMenuHandler);
|
|
1214
1679
|
// showAt() expects viewport coordinates; curMousePos is canvas-local.
|
|
1215
1680
|
floatingInput.showAt(_this.view.canvasToViewport(_this.view.curMousePos));
|
|
1216
1681
|
keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.promise.then(function (keyword) {
|