@mlightcad/cad-simple-viewer 1.4.11 → 1.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/dist/index.js +20139 -12511
  2. package/dist/index.umd.cjs +102 -94
  3. package/dist/libredwg-parser-worker.js +6958 -12596
  4. package/lib/app/AcApAnnotation.d.ts.map +1 -1
  5. package/lib/app/AcApAnnotation.js +3 -3
  6. package/lib/app/AcApAnnotation.js.map +1 -1
  7. package/lib/app/AcApDocManager.d.ts +61 -4
  8. package/lib/app/AcApDocManager.d.ts.map +1 -1
  9. package/lib/app/AcApDocManager.js +162 -29
  10. package/lib/app/AcApDocManager.js.map +1 -1
  11. package/lib/app/AcApDocument.d.ts +6 -0
  12. package/lib/app/AcApDocument.d.ts.map +1 -1
  13. package/lib/app/AcApDocument.js +12 -0
  14. package/lib/app/AcApDocument.js.map +1 -1
  15. package/lib/app/AcApProgress.d.ts.map +1 -1
  16. package/lib/app/AcApProgress.js +3 -3
  17. package/lib/app/AcApProgress.js.map +1 -1
  18. package/lib/app/AcApSettingManager.d.ts.map +1 -1
  19. package/lib/app/AcApSettingManager.js +3 -1
  20. package/lib/app/AcApSettingManager.js.map +1 -1
  21. package/lib/app/AcDbOpenDatabaseOptions.d.ts.map +1 -1
  22. package/lib/command/AcApArcCmd.d.ts +140 -0
  23. package/lib/command/AcApArcCmd.d.ts.map +1 -0
  24. package/lib/command/AcApArcCmd.js +1009 -0
  25. package/lib/command/AcApArcCmd.js.map +1 -0
  26. package/lib/command/AcApCircleCmd.d.ts +59 -0
  27. package/lib/command/AcApCircleCmd.d.ts.map +1 -1
  28. package/lib/command/AcApCircleCmd.js +490 -13
  29. package/lib/command/AcApCircleCmd.js.map +1 -1
  30. package/lib/command/AcApClearMeasurementsCmd.d.ts +1 -1
  31. package/lib/command/AcApClearMeasurementsCmd.d.ts.map +1 -1
  32. package/lib/command/AcApClearMeasurementsCmd.js +2 -4
  33. package/lib/command/AcApClearMeasurementsCmd.js.map +1 -1
  34. package/lib/command/AcApConvertToDxfCmd.d.ts +9 -0
  35. package/lib/command/AcApConvertToDxfCmd.d.ts.map +1 -0
  36. package/lib/command/{AcApZoomToBoxCmd.js → AcApConvertToDxfCmd.js} +14 -40
  37. package/lib/command/AcApConvertToDxfCmd.js.map +1 -0
  38. package/lib/command/AcApConvertToPngCmd.d.ts +35 -0
  39. package/lib/command/AcApConvertToPngCmd.d.ts.map +1 -0
  40. package/lib/command/AcApConvertToPngCmd.js +127 -0
  41. package/lib/command/AcApConvertToPngCmd.js.map +1 -0
  42. package/lib/command/AcApDimLinearCmd.d.ts.map +1 -1
  43. package/lib/command/AcApDimLinearCmd.js +14 -5
  44. package/lib/command/AcApDimLinearCmd.js.map +1 -1
  45. package/lib/command/AcApDxfConvertor.d.ts +12 -0
  46. package/lib/command/AcApDxfConvertor.d.ts.map +1 -0
  47. package/lib/command/AcApDxfConvertor.js +37 -0
  48. package/lib/command/AcApDxfConvertor.js.map +1 -0
  49. package/lib/command/AcApEllipseCmd.d.ts +87 -0
  50. package/lib/command/AcApEllipseCmd.d.ts.map +1 -0
  51. package/lib/command/AcApEllipseCmd.js +583 -0
  52. package/lib/command/AcApEllipseCmd.js.map +1 -0
  53. package/lib/command/AcApEraseCmd.d.ts.map +1 -1
  54. package/lib/command/AcApEraseCmd.js +10 -6
  55. package/lib/command/AcApEraseCmd.js.map +1 -1
  56. package/lib/command/AcApHatchCmd.d.ts +210 -0
  57. package/lib/command/AcApHatchCmd.d.ts.map +1 -0
  58. package/lib/command/AcApHatchCmd.js +808 -0
  59. package/lib/command/AcApHatchCmd.js.map +1 -0
  60. package/lib/command/AcApLayerCmd.d.ts +217 -0
  61. package/lib/command/AcApLayerCmd.d.ts.map +1 -0
  62. package/lib/command/AcApLayerCmd.js +768 -0
  63. package/lib/command/AcApLayerCmd.js.map +1 -0
  64. package/lib/command/AcApLineCmd.d.ts +36 -1
  65. package/lib/command/AcApLineCmd.d.ts.map +1 -1
  66. package/lib/command/AcApLineCmd.js +159 -16
  67. package/lib/command/AcApLineCmd.js.map +1 -1
  68. package/lib/command/AcApMTextCmd.d.ts.map +1 -1
  69. package/lib/command/AcApMTextCmd.js +6 -3
  70. package/lib/command/AcApMTextCmd.js.map +1 -1
  71. package/lib/command/AcApMeasureAngleCmd.d.ts.map +1 -1
  72. package/lib/command/AcApMeasureAngleCmd.js +134 -123
  73. package/lib/command/AcApMeasureAngleCmd.js.map +1 -1
  74. package/lib/command/AcApMeasureArcCmd.d.ts.map +1 -1
  75. package/lib/command/AcApMeasureArcCmd.js +165 -147
  76. package/lib/command/AcApMeasureArcCmd.js.map +1 -1
  77. package/lib/command/AcApMeasureAreaCmd.d.ts.map +1 -1
  78. package/lib/command/AcApMeasureAreaCmd.js +186 -175
  79. package/lib/command/AcApMeasureAreaCmd.js.map +1 -1
  80. package/lib/command/AcApMeasureDistanceCmd.d.ts.map +1 -1
  81. package/lib/command/AcApMeasureDistanceCmd.js +51 -39
  82. package/lib/command/AcApMeasureDistanceCmd.js.map +1 -1
  83. package/lib/command/AcApMoveCmd.d.ts +16 -0
  84. package/lib/command/AcApMoveCmd.d.ts.map +1 -0
  85. package/lib/command/AcApMoveCmd.js +278 -0
  86. package/lib/command/AcApMoveCmd.js.map +1 -0
  87. package/lib/command/AcApPngConvertor.d.ts +95 -0
  88. package/lib/command/AcApPngConvertor.d.ts.map +1 -0
  89. package/lib/command/AcApPngConvertor.js +205 -0
  90. package/lib/command/AcApPngConvertor.js.map +1 -0
  91. package/lib/command/AcApPolygonCmd.d.ts +69 -0
  92. package/lib/command/AcApPolygonCmd.d.ts.map +1 -0
  93. package/lib/command/AcApPolygonCmd.js +422 -0
  94. package/lib/command/AcApPolygonCmd.js.map +1 -0
  95. package/lib/command/AcApPolylineCmd.d.ts +71 -0
  96. package/lib/command/AcApPolylineCmd.d.ts.map +1 -0
  97. package/lib/command/AcApPolylineCmd.js +569 -0
  98. package/lib/command/AcApPolylineCmd.js.map +1 -0
  99. package/lib/command/AcApRectCmd.d.ts +149 -4
  100. package/lib/command/AcApRectCmd.d.ts.map +1 -1
  101. package/lib/command/AcApRectCmd.js +717 -29
  102. package/lib/command/AcApRectCmd.js.map +1 -1
  103. package/lib/command/AcApRevCircleCmd.d.ts +8 -0
  104. package/lib/command/AcApRevCircleCmd.d.ts.map +1 -1
  105. package/lib/command/AcApRevCircleCmd.js +30 -6
  106. package/lib/command/AcApRevCircleCmd.js.map +1 -1
  107. package/lib/command/AcApRevCloudCmd.d.ts.map +1 -1
  108. package/lib/command/AcApRevCloudCmd.js +10 -4
  109. package/lib/command/AcApRevCloudCmd.js.map +1 -1
  110. package/lib/command/AcApRevRectCmd.d.ts +8 -0
  111. package/lib/command/AcApRevRectCmd.d.ts.map +1 -1
  112. package/lib/command/AcApRevRectCmd.js +78 -6
  113. package/lib/command/AcApRevRectCmd.js.map +1 -1
  114. package/lib/command/AcApSketchCmd.d.ts.map +1 -1
  115. package/lib/command/AcApSketchCmd.js +11 -7
  116. package/lib/command/AcApSketchCmd.js.map +1 -1
  117. package/lib/command/AcApSplineCmd.d.ts +85 -0
  118. package/lib/command/AcApSplineCmd.d.ts.map +1 -0
  119. package/lib/command/AcApSplineCmd.js +620 -0
  120. package/lib/command/AcApSplineCmd.js.map +1 -0
  121. package/lib/command/AcApSysVarCmd.d.ts.map +1 -1
  122. package/lib/command/AcApSysVarCmd.js +6 -3
  123. package/lib/command/AcApSysVarCmd.js.map +1 -1
  124. package/lib/command/AcApZoomCmd.d.ts +91 -20
  125. package/lib/command/AcApZoomCmd.d.ts.map +1 -1
  126. package/lib/command/AcApZoomCmd.js +288 -23
  127. package/lib/command/AcApZoomCmd.js.map +1 -1
  128. package/lib/command/index.d.ts +12 -1
  129. package/lib/command/index.d.ts.map +1 -1
  130. package/lib/command/index.js +12 -1
  131. package/lib/command/index.js.map +1 -1
  132. package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -1
  133. package/lib/editor/command/AcEdCommandIterator.js.map +1 -1
  134. package/lib/editor/command/AcEdCommandStack.d.ts +54 -1
  135. package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -1
  136. package/lib/editor/command/AcEdCommandStack.js +207 -25
  137. package/lib/editor/command/AcEdCommandStack.js.map +1 -1
  138. package/lib/editor/global/AcEdUiTheme.d.ts +4 -0
  139. package/lib/editor/global/AcEdUiTheme.d.ts.map +1 -0
  140. package/lib/editor/global/AcEdUiTheme.js +44 -0
  141. package/lib/editor/global/AcEdUiTheme.js.map +1 -0
  142. package/lib/editor/global/index.d.ts +1 -0
  143. package/lib/editor/global/index.d.ts.map +1 -1
  144. package/lib/editor/global/index.js +1 -0
  145. package/lib/editor/global/index.js.map +1 -1
  146. package/lib/editor/input/AcEdCursorManager.d.ts +10 -0
  147. package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
  148. package/lib/editor/input/AcEdCursorManager.js +24 -4
  149. package/lib/editor/input/AcEdCursorManager.js.map +1 -1
  150. package/lib/editor/input/AcEdInputModifiers.d.ts +39 -0
  151. package/lib/editor/input/AcEdInputModifiers.d.ts.map +1 -0
  152. package/lib/editor/input/AcEdInputModifiers.js +2 -0
  153. package/lib/editor/input/AcEdInputModifiers.js.map +1 -0
  154. package/lib/editor/input/AcEdInputToggles.d.ts +24 -0
  155. package/lib/editor/input/AcEdInputToggles.d.ts.map +1 -0
  156. package/lib/editor/input/AcEdInputToggles.js +2 -0
  157. package/lib/editor/input/AcEdInputToggles.js.map +1 -0
  158. package/lib/editor/input/AcEdPromptStateMachine.d.ts +110 -0
  159. package/lib/editor/input/AcEdPromptStateMachine.d.ts.map +1 -0
  160. package/lib/editor/input/AcEdPromptStateMachine.js +147 -0
  161. package/lib/editor/input/AcEdPromptStateMachine.js.map +1 -0
  162. package/lib/editor/input/AcEdSelectionFilter.d.ts +79 -0
  163. package/lib/editor/input/AcEdSelectionFilter.d.ts.map +1 -0
  164. package/lib/editor/input/AcEdSelectionFilter.js +231 -0
  165. package/lib/editor/input/AcEdSelectionFilter.js.map +1 -0
  166. package/lib/editor/input/AcEditor.d.ts +77 -10
  167. package/lib/editor/input/AcEditor.d.ts.map +1 -1
  168. package/lib/editor/input/AcEditor.js +162 -1
  169. package/lib/editor/input/AcEditor.js.map +1 -1
  170. package/lib/editor/input/index.d.ts +4 -0
  171. package/lib/editor/input/index.d.ts.map +1 -1
  172. package/lib/editor/input/index.js +4 -0
  173. package/lib/editor/input/index.js.map +1 -1
  174. package/lib/editor/input/marker/AcEdMarker.d.ts.map +1 -1
  175. package/lib/editor/input/marker/AcEdMarker.js +3 -3
  176. package/lib/editor/input/marker/AcEdMarker.js.map +1 -1
  177. package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts +47 -0
  178. package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts.map +1 -1
  179. package/lib/editor/input/prompt/AcEdKeywordCollection.js +30 -4
  180. package/lib/editor/input/prompt/AcEdKeywordCollection.js.map +1 -1
  181. package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts +8 -1
  182. package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts.map +1 -1
  183. package/lib/editor/input/prompt/AcEdPromptAngleOptions.js +19 -2
  184. package/lib/editor/input/prompt/AcEdPromptAngleOptions.js.map +1 -1
  185. package/lib/editor/input/prompt/AcEdPromptBoxResult.d.ts +12 -0
  186. package/lib/editor/input/prompt/AcEdPromptBoxResult.d.ts.map +1 -0
  187. package/lib/editor/input/prompt/AcEdPromptBoxResult.js +30 -0
  188. package/lib/editor/input/prompt/AcEdPromptBoxResult.js.map +1 -0
  189. package/lib/editor/input/prompt/AcEdPromptDoubleResult.d.ts +9 -0
  190. package/lib/editor/input/prompt/AcEdPromptDoubleResult.d.ts.map +1 -0
  191. package/lib/editor/input/prompt/AcEdPromptDoubleResult.js +28 -0
  192. package/lib/editor/input/prompt/AcEdPromptDoubleResult.js.map +1 -0
  193. package/lib/editor/input/prompt/AcEdPromptEntityOptions.d.ts +18 -1
  194. package/lib/editor/input/prompt/AcEdPromptEntityOptions.d.ts.map +1 -1
  195. package/lib/editor/input/prompt/AcEdPromptEntityOptions.js +32 -5
  196. package/lib/editor/input/prompt/AcEdPromptEntityOptions.js.map +1 -1
  197. package/lib/editor/input/prompt/AcEdPromptEntityResult.d.ts +14 -0
  198. package/lib/editor/input/prompt/AcEdPromptEntityResult.d.ts.map +1 -0
  199. package/lib/editor/input/prompt/AcEdPromptEntityResult.js +31 -0
  200. package/lib/editor/input/prompt/AcEdPromptEntityResult.js.map +1 -0
  201. package/lib/editor/input/prompt/AcEdPromptIntegerResult.d.ts +9 -0
  202. package/lib/editor/input/prompt/AcEdPromptIntegerResult.d.ts.map +1 -0
  203. package/lib/editor/input/prompt/AcEdPromptIntegerResult.js +28 -0
  204. package/lib/editor/input/prompt/AcEdPromptIntegerResult.js.map +1 -0
  205. package/lib/editor/input/prompt/AcEdPromptKeywordOptions.d.ts +1 -1
  206. package/lib/editor/input/prompt/AcEdPromptKeywordOptions.d.ts.map +1 -1
  207. package/lib/editor/input/prompt/AcEdPromptKeywordOptions.js +2 -2
  208. package/lib/editor/input/prompt/AcEdPromptKeywordOptions.js.map +1 -1
  209. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts +1 -1
  210. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts.map +1 -1
  211. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js +2 -2
  212. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js.map +1 -1
  213. package/lib/editor/input/prompt/AcEdPromptOptions.d.ts +9 -3
  214. package/lib/editor/input/prompt/AcEdPromptOptions.d.ts.map +1 -1
  215. package/lib/editor/input/prompt/AcEdPromptOptions.js +22 -4
  216. package/lib/editor/input/prompt/AcEdPromptOptions.js.map +1 -1
  217. package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts +1 -1
  218. package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts.map +1 -1
  219. package/lib/editor/input/prompt/AcEdPromptPointOptions.js +2 -2
  220. package/lib/editor/input/prompt/AcEdPromptPointOptions.js.map +1 -1
  221. package/lib/editor/input/prompt/AcEdPromptPointResult.d.ts +3 -3
  222. package/lib/editor/input/prompt/AcEdPromptSelectionOptions.d.ts +1 -1
  223. package/lib/editor/input/prompt/AcEdPromptSelectionOptions.d.ts.map +1 -1
  224. package/lib/editor/input/prompt/AcEdPromptSelectionOptions.js +2 -2
  225. package/lib/editor/input/prompt/AcEdPromptSelectionOptions.js.map +1 -1
  226. package/lib/editor/input/prompt/AcEdPromptSelectionResult.d.ts +12 -0
  227. package/lib/editor/input/prompt/AcEdPromptSelectionResult.d.ts.map +1 -0
  228. package/lib/editor/input/prompt/AcEdPromptSelectionResult.js +30 -0
  229. package/lib/editor/input/prompt/AcEdPromptSelectionResult.js.map +1 -0
  230. package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts +1 -1
  231. package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts.map +1 -1
  232. package/lib/editor/input/prompt/AcEdPromptStringOptions.js +2 -2
  233. package/lib/editor/input/prompt/AcEdPromptStringOptions.js.map +1 -1
  234. package/lib/editor/input/prompt/index.d.ts +9 -0
  235. package/lib/editor/input/prompt/index.d.ts.map +1 -1
  236. package/lib/editor/input/prompt/index.js +9 -0
  237. package/lib/editor/input/prompt/index.js.map +1 -1
  238. package/lib/editor/input/session/AcEdKeywordSession.d.ts +67 -1
  239. package/lib/editor/input/session/AcEdKeywordSession.d.ts.map +1 -1
  240. package/lib/editor/input/session/AcEdKeywordSession.js +78 -1
  241. package/lib/editor/input/session/AcEdKeywordSession.js.map +1 -1
  242. package/lib/editor/input/ui/AcEdCommandLine.d.ts +27 -1
  243. package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
  244. package/lib/editor/input/ui/AcEdCommandLine.js +75 -10
  245. package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
  246. package/lib/editor/input/ui/AcEdFloatingInput.d.ts +24 -1
  247. package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -1
  248. package/lib/editor/input/ui/AcEdFloatingInput.js +147 -27
  249. package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -1
  250. package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts +2 -0
  251. package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts.map +1 -1
  252. package/lib/editor/input/ui/AcEdFloatingInputBox.js +4 -0
  253. package/lib/editor/input/ui/AcEdFloatingInputBox.js.map +1 -1
  254. package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts +30 -1
  255. package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts.map +1 -1
  256. package/lib/editor/input/ui/AcEdFloatingInputBoxes.js +46 -15
  257. package/lib/editor/input/ui/AcEdFloatingInputBoxes.js.map +1 -1
  258. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +33 -0
  259. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -1
  260. package/lib/editor/input/ui/AcEdFloatingMessage.d.ts +12 -0
  261. package/lib/editor/input/ui/AcEdFloatingMessage.d.ts.map +1 -1
  262. package/lib/editor/input/ui/AcEdFloatingMessage.js +61 -2
  263. package/lib/editor/input/ui/AcEdFloatingMessage.js.map +1 -1
  264. package/lib/editor/input/ui/AcEdInputManager.d.ts +403 -29
  265. package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
  266. package/lib/editor/input/ui/AcEdInputManager.js +1313 -414
  267. package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
  268. package/lib/editor/input/ui/AcEdRubberBand.d.ts +15 -1
  269. package/lib/editor/input/ui/AcEdRubberBand.d.ts.map +1 -1
  270. package/lib/editor/input/ui/AcEdRubberBand.js +43 -11
  271. package/lib/editor/input/ui/AcEdRubberBand.js.map +1 -1
  272. package/lib/editor/view/AcEdBaseView.d.ts +66 -0
  273. package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
  274. package/lib/editor/view/AcEdBaseView.js +170 -0
  275. package/lib/editor/view/AcEdBaseView.js.map +1 -1
  276. package/lib/editor/view/AcEdSpatialQueryResult.d.ts.map +1 -1
  277. package/lib/i18n/en/command.d.ts +36 -3
  278. package/lib/i18n/en/command.d.ts.map +1 -1
  279. package/lib/i18n/en/command.js +36 -3
  280. package/lib/i18n/en/command.js.map +1 -1
  281. package/lib/i18n/en/jig.d.ts +553 -0
  282. package/lib/i18n/en/jig.d.ts.map +1 -1
  283. package/lib/i18n/en/jig.js +557 -4
  284. package/lib/i18n/en/jig.js.map +1 -1
  285. package/lib/i18n/zh/command.d.ts +36 -3
  286. package/lib/i18n/zh/command.d.ts.map +1 -1
  287. package/lib/i18n/zh/command.js +36 -3
  288. package/lib/i18n/zh/command.js.map +1 -1
  289. package/lib/i18n/zh/jig.d.ts +553 -0
  290. package/lib/i18n/zh/jig.d.ts.map +1 -1
  291. package/lib/i18n/zh/jig.js +557 -4
  292. package/lib/i18n/zh/jig.js.map +1 -1
  293. package/lib/plugin/AcApPluginManager.d.ts.map +1 -1
  294. package/lib/plugin/AcApPluginManager.js.map +1 -1
  295. package/lib/util/AcApMeasurementElementGenerator.d.ts +36 -0
  296. package/lib/util/AcApMeasurementElementGenerator.d.ts.map +1 -0
  297. package/lib/util/AcApMeasurementElementGenerator.js +92 -0
  298. package/lib/util/AcApMeasurementElementGenerator.js.map +1 -0
  299. package/lib/util/index.d.ts +1 -1
  300. package/lib/util/index.d.ts.map +1 -1
  301. package/lib/util/index.js +1 -1
  302. package/lib/util/index.js.map +1 -1
  303. package/lib/view/AcTrLayer.d.ts.map +1 -1
  304. package/lib/view/AcTrLayer.js +5 -3
  305. package/lib/view/AcTrLayer.js.map +1 -1
  306. package/lib/view/AcTrLayoutView.d.ts +6 -0
  307. package/lib/view/AcTrLayoutView.d.ts.map +1 -1
  308. package/lib/view/AcTrLayoutView.js +20 -0
  309. package/lib/view/AcTrLayoutView.js.map +1 -1
  310. package/lib/view/AcTrView2d.d.ts +0 -1
  311. package/lib/view/AcTrView2d.d.ts.map +1 -1
  312. package/lib/view/AcTrView2d.js +103 -50
  313. package/lib/view/AcTrView2d.js.map +1 -1
  314. package/package.json +15 -13
  315. package/lib/command/AcApZoomToBoxCmd.d.ts +0 -29
  316. package/lib/command/AcApZoomToBoxCmd.d.ts.map +0 -1
  317. package/lib/command/AcApZoomToBoxCmd.js.map +0 -1
  318. package/lib/util/AcApMeasurementUtils.d.ts +0 -12
  319. package/lib/util/AcApMeasurementUtils.d.ts.map +0 -1
  320. package/lib/util/AcApMeasurementUtils.js +0 -36
  321. package/lib/util/AcApMeasurementUtils.js.map +0 -1
@@ -1,3 +1,18 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
1
16
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
17
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
18
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -70,15 +85,47 @@ var __values = (this && this.__values) || function(o) {
70
85
  };
71
86
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
72
87
  };
73
- import { AcGeBox2d } from '@mlightcad/data-model';
74
- import { AcApSettingManager } from '../../../app';
88
+ import { acdbHostApplicationServices, AcDbSystemVariables, AcDbSysVarManager, AcGeBox2d } from '@mlightcad/data-model';
89
+ import { AcApDocManager, AcApSettingManager } from '../../../app';
75
90
  import { AcApI18n } from '../../../i18n';
91
+ import { AcEdSelectionSet } from '../AcEdSelectionSet';
76
92
  import { AcEdAngleHandler, AcEdDistanceHandler, AcEdDoubleHandler, AcEdIntegerHandler, AcEdPointHandler, AcEdStringHandler } from '../handler';
77
93
  import { AcEdKeywordHandler } from '../handler/AcEdKeywordHandler';
78
- import { AcEdPromptPointOptions } from '../prompt';
94
+ import { AcEdPromptBoxResult, AcEdPromptDoubleResult, AcEdPromptEntityResult, AcEdPromptIntegerResult, AcEdPromptKeywordOptions, AcEdPromptPointOptions, AcEdPromptPointResult, AcEdPromptResult, AcEdPromptSelectionResult, AcEdPromptStatus } from '../prompt';
79
95
  import { AcEdCommandLine } from './AcEdCommandLine';
80
96
  import { AcEdFloatingInput } from './AcEdFloatingInput';
81
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
+ */
105
+ var AcEdKeywordInputError = /** @class */ (function (_super) {
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
+ */
112
+ function AcEdKeywordInputError(keyword) {
113
+ var _this = _super.call(this, 'keyword') || this;
114
+ _this.keyword = keyword;
115
+ return _this;
116
+ }
117
+ return AcEdKeywordInputError;
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));
82
129
  /**
83
130
  * A fully type-safe TypeScript class providing CAD-style interactive user input
84
131
  * using floating HTML input boxes and mouse events. Supports collecting points,
@@ -98,11 +145,25 @@ var AcEdInputManager = /** @class */ (function () {
98
145
  this.lastPoint = null;
99
146
  /** Buffered command-line style inputs (each item is one Enter-confirmed value). */
100
147
  this._scriptInputs = [];
148
+ /** Current modifier key state during input sessions. */
149
+ this._modifierState = {
150
+ ctrlKey: false,
151
+ shiftKey: false,
152
+ altKey: false,
153
+ metaKey: false
154
+ };
155
+ /** Toggle-style Ctrl flip state (press Ctrl once to flip arc direction). */
156
+ this._ctrlArcFlip = false;
101
157
  /**
102
158
  * The flag to indicate whether it is currently in an “input acquisition” mode (e.g., point
103
159
  * selection, distance/angle prompt, string prompt, etc.),
104
160
  */
105
161
  this.active = false;
162
+ /**
163
+ * True only when the current input session explicitly expects entity selection
164
+ * (getEntity/getSelection). Used to gate view-level selection behavior.
165
+ */
166
+ this.entitySelectionActive = false;
106
167
  this.view = view;
107
168
  this.injectCSS();
108
169
  // Newly added UI overlays (command line, previews) are container-local.
@@ -129,6 +190,40 @@ var AcEdInputManager = /** @class */ (function () {
129
190
  enumerable: false,
130
191
  configurable: true
131
192
  });
193
+ Object.defineProperty(AcEdInputManager.prototype, "isEntitySelectionActive", {
194
+ /**
195
+ * Whether current input session allows entity selection in the view.
196
+ */
197
+ get: function () {
198
+ return this.entitySelectionActive;
199
+ },
200
+ enumerable: false,
201
+ configurable: true
202
+ });
203
+ Object.defineProperty(AcEdInputManager.prototype, "modifiers", {
204
+ /**
205
+ * Current modifier key state (Ctrl/Shift/Alt/Meta) during input sessions.
206
+ */
207
+ get: function () {
208
+ return this._modifierState;
209
+ },
210
+ enumerable: false,
211
+ configurable: true
212
+ });
213
+ Object.defineProperty(AcEdInputManager.prototype, "toggles", {
214
+ /**
215
+ * Toggle-style input states (press once to flip, persists after keyup).
216
+ */
217
+ get: function () {
218
+ return { ctrlArcFlip: this._ctrlArcFlip };
219
+ },
220
+ enumerable: false,
221
+ configurable: true
222
+ });
223
+ /** Reset toggle-style inputs to their default state. */
224
+ AcEdInputManager.prototype.resetToggles = function () {
225
+ this._ctrlArcFlip = false;
226
+ };
132
227
  /**
133
228
  * Queue scripted inputs for subsequent getXXX calls.
134
229
  * One array item equals one Enter-confirmed value.
@@ -152,7 +247,7 @@ var AcEdInputManager = /** @class */ (function () {
152
247
  return;
153
248
  AcEdInputManager.stylesInjected = true;
154
249
  var style = document.createElement('style');
155
- style.textContent = "\n .ml-jig-preview-rect {\n position: absolute;\n border: 1px dashed var(--line-color, #0f0);\n background: rgba(0, 255, 0, 0.04);\n pointer-events: none;\n z-index: 9999;\n }\n .ml-jig-preview-line {\n position: absolute;\n height: 1px;\n background: var(--line-color, #0f0);\n transform-origin: 0 0;\n pointer-events: none;\n z-index: 9999;\n }\n ";
250
+ style.textContent = "\n .ml-jig-preview-rect {\n position: absolute;\n border: 1px dashed var(--line-color, var(--ml-ui-canvas-line, #0f0));\n background: var(--ml-ui-canvas-fill-mix, var(--ml-ui-canvas-fill, rgba(64, 158, 255, 0.12)));\n pointer-events: none;\n z-index: 9999;\n }\n .ml-jig-preview-line {\n position: absolute;\n height: 1px;\n background: var(--line-color, var(--ml-ui-canvas-line, #0f0));\n transform-origin: 0 0;\n pointer-events: none;\n z-index: 9999;\n }\n ";
156
251
  document.head.appendChild(style);
157
252
  };
158
253
  /**
@@ -172,19 +267,308 @@ var AcEdInputManager = /** @class */ (function () {
172
267
  }
173
268
  };
174
269
  /**
175
- * Public point input API.
270
+ * Returns whether the supplied prompt defines any keywords.
271
+ *
272
+ * Keyword-aware prompts need extra command-line wiring so textual input can
273
+ * be interpreted as keyword picks instead of free-form values. This helper
274
+ * centralizes the check and gracefully handles prompts that expose no keyword
275
+ * collection.
276
+ *
277
+ * @param options - Prompt options to inspect
278
+ * @returns `true` when at least one keyword is registered on the prompt
176
279
  */
177
- AcEdInputManager.prototype.getPoint = function (options) {
178
- var scriptedValue = this.tryGetScriptedPoint(options);
179
- if (scriptedValue != null) {
180
- return Promise.resolve(scriptedValue);
280
+ AcEdInputManager.prototype.hasKeywords = function (options) {
281
+ var _a, _b;
282
+ var keywords = (_b = (_a = options.keywords) === null || _a === void 0 ? void 0 : _a.toArray()) !== null && _b !== void 0 ? _b : [];
283
+ return keywords.length > 0;
284
+ };
285
+ /**
286
+ * Builds a keyword-only prompt options object from a general prompt.
287
+ *
288
+ * Several input flows support optional keywords in parallel with their main
289
+ * acquisition mode. Rather than duplicating keyword definitions manually, the
290
+ * original prompt's keyword metadata is cloned into a dedicated
291
+ * `AcEdPromptKeywordOptions` instance that can be passed to the command-line
292
+ * keyword session.
293
+ *
294
+ * @typeParam T - Value type produced by the source prompt
295
+ * @param options - Source prompt whose keyword definitions should be copied
296
+ * @returns A keyword prompt configured with the same message and keyword set
297
+ */
298
+ AcEdInputManager.prototype.buildKeywordOptions = function (options) {
299
+ var _a, _b;
300
+ var keywordOptions = new AcEdPromptKeywordOptions(options.message);
301
+ keywordOptions.appendKeywordsToMessage = options.appendKeywordsToMessage;
302
+ var keywords = (_b = (_a = options.keywords) === null || _a === void 0 ? void 0 : _a.toArray()) !== null && _b !== void 0 ? _b : [];
303
+ keywords.forEach(function (kw) {
304
+ var added = keywordOptions.keywords.add(kw.displayName, kw.globalName, kw.localName, kw.enabled, kw.visible);
305
+ if (options.keywords.default === kw) {
306
+ keywordOptions.keywords.default = added;
307
+ }
308
+ });
309
+ return keywordOptions;
310
+ };
311
+ /**
312
+ * Copies keyword definitions from one prompt options object to another.
313
+ *
314
+ * This is primarily used by composite prompts such as `getBox()`, which break
315
+ * a higher-level workflow into multiple sub-prompts while preserving the same
316
+ * keyword vocabulary and default keyword behavior across each stage.
317
+ *
318
+ * @param source - Prompt options providing the keyword definitions
319
+ * @param target - Prompt options receiving the cloned keyword definitions
320
+ */
321
+ AcEdInputManager.prototype.copyKeywords = function (source, target) {
322
+ var _a, _b;
323
+ target.appendKeywordsToMessage = source.appendKeywordsToMessage;
324
+ var keywords = (_b = (_a = source.keywords) === null || _a === void 0 ? void 0 : _a.toArray()) !== null && _b !== void 0 ? _b : [];
325
+ keywords.forEach(function (kw) {
326
+ var added = target.keywords.add(kw.displayName, kw.globalName, kw.localName, kw.enabled, kw.visible);
327
+ if (source.keywords.default === kw) {
328
+ target.keywords.default = added;
329
+ }
330
+ });
331
+ };
332
+ /**
333
+ * Resolves a picked object id back to its database entity instance.
334
+ *
335
+ * View-level picking only returns lightweight hit-test data such as object
336
+ * ids and bounding information. Prompt validation, however, needs access to
337
+ * the backing `AcDbEntity` so it can inspect runtime metadata like the entity
338
+ * type and layer.
339
+ *
340
+ * @param objectId - Object id returned by the spatial pick query
341
+ * @returns The matching database entity, or `undefined` if it can no longer be found
342
+ */
343
+ AcEdInputManager.prototype.getEntityById = function (objectId) {
344
+ return AcApDocManager.instance.curDocument.database.tables.blockTable.getEntityById(objectId);
345
+ };
346
+ /**
347
+ * Returns whether the specified entity belongs to a locked layer.
348
+ *
349
+ * The entity itself only stores its layer name, so this helper resolves the
350
+ * layer record from the current drawing database and inspects its lock state.
351
+ * Missing layer records are treated as unlocked to avoid rejecting input due
352
+ * to incomplete metadata.
353
+ *
354
+ * @param entity - Entity being evaluated for prompt selection
355
+ * @returns `true` if the entity's layer exists and is locked; otherwise `false`
356
+ */
357
+ AcEdInputManager.prototype.isEntityOnLockedLayer = function (entity) {
358
+ var _a;
359
+ var layerName = entity.layer;
360
+ if (!layerName) {
361
+ return false;
362
+ }
363
+ return !!((_a = AcApDocManager.instance.curDocument.database.tables.layerTable.getAt(layerName)) === null || _a === void 0 ? void 0 : _a.isLocked);
364
+ };
365
+ /**
366
+ * Checks whether a picked entity satisfies the prompt's allowed-class filter.
367
+ *
368
+ * Different parts of the stack expose the entity type in slightly different
369
+ * forms. The data-model layer provides a short CAD type name through
370
+ * `entity.type` (for example `Line`), while runtime inspection exposes the
371
+ * TypeScript constructor name (for example `AcDbLine`). To maximize
372
+ * compatibility with existing caller expectations, both forms are tested
373
+ * against the prompt's allow-list.
374
+ *
375
+ * @param entity - Picked entity being validated
376
+ * @param options - Prompt options containing the configured allowed classes
377
+ * @returns `true` when the entity matches at least one allowed class, or when
378
+ * no class restriction has been configured
379
+ */
380
+ AcEdInputManager.prototype.isEntityClassAllowed = function (entity, options) {
381
+ var e_1, _a;
382
+ var _b;
383
+ var candidates = new Set();
384
+ if (entity.type) {
385
+ candidates.add(entity.type);
386
+ }
387
+ var constructorName = (_b = entity.constructor) === null || _b === void 0 ? void 0 : _b.name;
388
+ if (constructorName) {
389
+ candidates.add(constructorName);
390
+ }
391
+ try {
392
+ for (var candidates_1 = __values(candidates), candidates_1_1 = candidates_1.next(); !candidates_1_1.done; candidates_1_1 = candidates_1.next()) {
393
+ var candidate = candidates_1_1.value;
394
+ if (options.isClassAllowed(candidate)) {
395
+ return true;
396
+ }
397
+ }
398
+ }
399
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
400
+ finally {
401
+ try {
402
+ if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
403
+ }
404
+ finally { if (e_1) throw e_1.error; }
405
+ }
406
+ return false;
407
+ };
408
+ /**
409
+ * Starts a command-line keyword session for the given prompt when needed.
410
+ *
411
+ * Many interactive prompts accept both mouse-driven input and typed keywords
412
+ * at the same time. This helper lazily creates the command-line keyword
413
+ * session only when keywords are actually configured, and returns a small
414
+ * control object that lets callers await or cancel that session.
415
+ *
416
+ * @param options - Prompt options that may define keywords
417
+ * @param allowTyping - Whether arbitrary typing is allowed alongside keyword completion
418
+ * @returns An object containing the keyword promise and cancel callback, or
419
+ * `undefined` when the prompt has no keywords
420
+ */
421
+ AcEdInputManager.prototype.startKeywordSession = function (options, allowTyping) {
422
+ var _this = this;
423
+ if (!this.hasKeywords(options))
424
+ return undefined;
425
+ var keywordOptions = this.buildKeywordOptions(options);
426
+ return {
427
+ promise: this._commandLine.getKeywords(keywordOptions, allowTyping),
428
+ cancel: function () { return _this._commandLine.cancelActiveSession(); }
429
+ };
430
+ };
431
+ /**
432
+ * Narrows an unknown error value to the internal keyword control-flow error.
433
+ *
434
+ * Prompt implementations use {@link AcEdKeywordInputError} as a private
435
+ * mechanism for bubbling a keyword pick out of deeply nested async UI flows.
436
+ * This type guard keeps the outer prompt wrappers readable while preserving
437
+ * strong typing for the extracted keyword token.
438
+ *
439
+ * @param error - Unknown error value thrown from an input workflow
440
+ * @returns `true` if the error represents a keyword selection
441
+ */
442
+ AcEdInputManager.prototype.isPromptKeyword = function (error) {
443
+ return error instanceof AcEdKeywordInputError;
444
+ };
445
+ /**
446
+ * Converts internal prompt control-flow errors to typed prompt results.
447
+ *
448
+ * @typeParam T - Prompt result type to construct
449
+ * @param error - Unknown error thrown from prompt workflow
450
+ * @param handlers - Result factories for mapped prompt statuses
451
+ * @returns Mapped prompt result when recognized; otherwise `undefined`
452
+ */
453
+ AcEdInputManager.prototype.mapPromptError = function (error, handlers) {
454
+ if (handlers.none && this.isPromptNone(error)) {
455
+ return handlers.none();
456
+ }
457
+ if (handlers.cancel && this.isPromptCancelled(error)) {
458
+ return handlers.cancel();
459
+ }
460
+ if (handlers.keyword && this.isPromptKeyword(error)) {
461
+ return handlers.keyword(error.keyword);
462
+ }
463
+ return undefined;
464
+ };
465
+ /**
466
+ * Attaches keyword text to a prompt result and returns it.
467
+ */
468
+ AcEdInputManager.prototype.withKeywordResult = function (result, keyword) {
469
+ result.stringResult = keyword;
470
+ return result;
471
+ };
472
+ /**
473
+ * Maps internal control-flow errors to prompt results by status constructor.
474
+ *
475
+ * @typeParam T - Prompt result type
476
+ * @param error - Unknown error thrown from prompt workflow
477
+ * @param create - Factory creating a result from target status
478
+ * @param options - Toggles for supported mapped statuses
479
+ */
480
+ AcEdInputManager.prototype.mapPromptErrorToResult = function (error, create, options) {
481
+ var _this = this;
482
+ var _a, _b, _c;
483
+ var includeNone = (_a = options === null || options === void 0 ? void 0 : options.none) !== null && _a !== void 0 ? _a : true;
484
+ var includeCancel = (_b = options === null || options === void 0 ? void 0 : options.cancel) !== null && _b !== void 0 ? _b : true;
485
+ var includeKeyword = (_c = options === null || options === void 0 ? void 0 : options.keyword) !== null && _c !== void 0 ? _c : true;
486
+ return this.mapPromptError(error, {
487
+ none: includeNone ? function () { return create(AcEdPromptStatus.None); } : undefined,
488
+ cancel: includeCancel ? function () { return create(AcEdPromptStatus.Cancel); } : undefined,
489
+ keyword: includeKeyword
490
+ ? function (keyword) {
491
+ return _this.withKeywordResult(create(AcEdPromptStatus.Keyword), keyword);
492
+ }
493
+ : undefined
494
+ });
495
+ };
496
+ /**
497
+ * Executes prompt workflow with centralized try/catch mapping.
498
+ *
499
+ * @typeParam T - Raw successful value from prompt workflow
500
+ * @typeParam R - Prompt result type
501
+ * @param run - Async prompt workflow that may throw control-flow errors
502
+ * @param onOk - Maps successful workflow value to result object
503
+ * @param create - Creates a result object from mapped prompt status
504
+ * @param options - Toggles for supported mapped statuses
505
+ */
506
+ AcEdInputManager.prototype.executePrompt = function (run, onOk, create, options) {
507
+ return __awaiter(this, void 0, void 0, function () {
508
+ var value, error_1, mapped;
509
+ return __generator(this, function (_a) {
510
+ switch (_a.label) {
511
+ case 0:
512
+ _a.trys.push([0, 2, , 3]);
513
+ return [4 /*yield*/, run()];
514
+ case 1:
515
+ value = _a.sent();
516
+ return [2 /*return*/, onOk(value)];
517
+ case 2:
518
+ error_1 = _a.sent();
519
+ mapped = this.mapPromptErrorToResult(error_1, create, options);
520
+ if (mapped)
521
+ return [2 /*return*/, mapped];
522
+ throw error_1;
523
+ case 3: return [2 /*return*/];
524
+ }
525
+ });
526
+ });
527
+ };
528
+ /**
529
+ * Extracts default-value behavior from prompt options when supported.
530
+ */
531
+ AcEdInputManager.prototype.resolvePromptDefaultValue = function (promptOptions) {
532
+ if ('useDefaultValue' in promptOptions &&
533
+ 'defaultValue' in promptOptions &&
534
+ promptOptions.useDefaultValue) {
535
+ return {
536
+ useDefaultValue: true,
537
+ defaultValue: promptOptions.defaultValue
538
+ };
181
539
  }
182
- return this.getPointInternal(options);
540
+ return { useDefaultValue: false };
183
541
  };
184
542
  /**
185
- * Prompt the user to type a numeric value. If integerOnly is true, integers
186
- * are enforced. The input is validated and the box will be marked invalid if
187
- * the typed value does not conform, allowing the user to retype.
543
+ * Prompts the user to specify a point.
544
+ *
545
+ * The point may be supplied by clicking in the view, typing coordinates into
546
+ * the floating input, or consuming a queued scripted input token. Keywords are
547
+ * also supported when configured on the prompt options.
548
+ *
549
+ * @param options - Point prompt options controlling messaging, base-point
550
+ * behavior, jig integration, and keywords
551
+ * @returns A prompt result containing the picked point, cancel status, or keyword
552
+ */
553
+ AcEdInputManager.prototype.getPoint = function (options) {
554
+ return __awaiter(this, void 0, void 0, function () {
555
+ var _this = this;
556
+ return __generator(this, function (_a) {
557
+ return [2 /*return*/, this.executePrompt(function () { return _this.getPointInternal(options); }, function (value) { return new AcEdPromptPointResult(AcEdPromptStatus.OK, value); }, function (status) { return new AcEdPromptPointResult(status); })];
558
+ });
559
+ });
560
+ };
561
+ /**
562
+ * Prompts the user for a purely typed numeric value through floating input.
563
+ *
564
+ * This helper is shared by distance, angle, double, and integer prompts when
565
+ * no mouse-driven geometric reference is needed. Validation is delegated to
566
+ * the supplied handler so the floating UI can mark invalid values and keep
567
+ * the prompt alive until the user enters an acceptable number.
568
+ *
569
+ * @param options - Numeric prompt options describing the message and keyword set
570
+ * @param handler - Parser/validator responsible for converting raw text into a number
571
+ * @returns A promise that resolves to the parsed numeric value
188
572
  */
189
573
  AcEdInputManager.prototype.getNumberTyped = function (options, handler) {
190
574
  var getDynamicValue = function () {
@@ -194,141 +578,245 @@ var AcEdInputManager = /** @class */ (function () {
194
578
  };
195
579
  };
196
580
  return this.makeFloatingInputPromise({
197
- message: options.message,
198
581
  inputCount: 1,
199
- jig: options.jig,
200
- showBaseLineOnly: false,
201
- useBasePoint: false,
582
+ promptOptions: options,
202
583
  handler: handler,
203
584
  getDynamicValue: getDynamicValue
204
585
  });
205
586
  };
206
- /** Request a distance (number) from the user. */
587
+ /**
588
+ * Prompts the user to specify a distance value.
589
+ *
590
+ * When a base point is available, the floating input previews the live
591
+ * distance from that reference point to the current cursor. Otherwise, the
592
+ * method falls back to typed numeric entry only. Scripted inputs and keywords
593
+ * are supported as well.
594
+ *
595
+ * @param options - Distance prompt options controlling base-point behavior and messaging
596
+ * @returns A prompt result containing the resolved distance, cancel status, or keyword
597
+ */
207
598
  AcEdInputManager.prototype.getDistance = function (options) {
208
- var _this = this;
209
- var scriptedValue = this.tryGetScriptedNumber(new AcEdDistanceHandler(options));
210
- if (scriptedValue != null) {
211
- return Promise.resolve(scriptedValue);
212
- }
213
- // If no base point defined → fall back to typed numeric input
214
- if (!this.lastPoint) {
215
- // fallback to normal numeric input
216
- return this.getNumberTyped(options, new AcEdDistanceHandler(options));
217
- }
218
- var getDynamicValue = function (pos) {
219
- var dx = pos.x - _this.lastPoint.x;
220
- var dy = pos.y - _this.lastPoint.y;
221
- var dist = Math.sqrt(dx * dx + dy * dy);
222
- return {
223
- value: dist,
224
- raw: { x: _this.formatNumber(dist, 'distance') }
225
- };
226
- };
227
- var handler = new AcEdDistanceHandler(options);
228
- return this.makeFloatingInputPromise({
229
- message: options.message,
230
- inputCount: 1,
231
- jig: options.jig,
232
- showBaseLineOnly: !options.useDashedLine,
233
- useBasePoint: true,
234
- basePoint: options.basePoint,
235
- handler: handler,
236
- getDynamicValue: getDynamicValue
599
+ return __awaiter(this, void 0, void 0, function () {
600
+ var handler, scriptedValue;
601
+ var _this = this;
602
+ return __generator(this, function (_a) {
603
+ handler = new AcEdDistanceHandler(options);
604
+ scriptedValue = this.tryGetScriptedNumber(handler);
605
+ if (scriptedValue != null) {
606
+ return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, scriptedValue)];
607
+ }
608
+ return [2 /*return*/, this.executePrompt(function () { return __awaiter(_this, void 0, void 0, function () {
609
+ var getDynamicValue;
610
+ var _this = this;
611
+ return __generator(this, function (_a) {
612
+ switch (_a.label) {
613
+ case 0:
614
+ if (!!this.lastPoint) return [3 /*break*/, 2];
615
+ return [4 /*yield*/, this.getNumberTyped(options, handler)];
616
+ case 1: return [2 /*return*/, _a.sent()];
617
+ case 2:
618
+ getDynamicValue = function (pos) {
619
+ var dx = pos.x - _this.lastPoint.x;
620
+ var dy = pos.y - _this.lastPoint.y;
621
+ var dist = Math.sqrt(dx * dx + dy * dy);
622
+ return {
623
+ value: dist,
624
+ raw: { x: _this.formatNumber(dist, 'distance') }
625
+ };
626
+ };
627
+ return [4 /*yield*/, this.makeFloatingInputPromise({
628
+ inputCount: 1,
629
+ promptOptions: options,
630
+ handler: handler,
631
+ getDynamicValue: getDynamicValue
632
+ })];
633
+ case 3: return [2 /*return*/, _a.sent()];
634
+ }
635
+ });
636
+ }); }, function (value) { return new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value); }, function (status) { return new AcEdPromptDoubleResult(status); })];
637
+ });
237
638
  });
238
639
  };
239
- /** Request an angle in degrees from the user. */
640
+ /**
641
+ * Prompts the user to specify an angle in degrees.
642
+ *
643
+ * If a base point is available, the cursor position is converted into a live
644
+ * angular preview relative to that point and the optional prompt base angle.
645
+ * Without a geometric reference, the method accepts typed numeric input only.
646
+ *
647
+ * @param options - Angle prompt options controlling base point, base angle, and messaging
648
+ * @returns A prompt result containing the resolved angle, cancel status, or keyword
649
+ */
240
650
  AcEdInputManager.prototype.getAngle = function (options) {
241
- var _this = this;
242
- var scriptedValue = this.tryGetScriptedNumber(new AcEdAngleHandler(options));
243
- if (scriptedValue != null) {
244
- return Promise.resolve(scriptedValue);
245
- }
246
- var getDynamicValue = function (pos) {
247
- var dx = pos.x - _this.lastPoint.x;
248
- var dy = pos.y - _this.lastPoint.y;
249
- var angleRad = Math.atan2(dy, dx);
250
- var angleDeg = (angleRad * 180) / Math.PI;
251
- return {
252
- value: angleDeg,
253
- raw: { x: _this.formatNumber(angleDeg, 'angle') }
254
- };
255
- };
256
- var handler = new AcEdAngleHandler(options);
257
- return this.makeFloatingInputPromise({
258
- message: options.message,
259
- inputCount: 1,
260
- jig: options.jig,
261
- showBaseLineOnly: !options.useDashedLine,
262
- useBasePoint: true,
263
- basePoint: options.basePoint,
264
- handler: handler,
265
- getDynamicValue: getDynamicValue
651
+ return __awaiter(this, void 0, void 0, function () {
652
+ var handler, scriptedValue, basePoint, getDynamicValue;
653
+ var _this = this;
654
+ return __generator(this, function (_a) {
655
+ handler = new AcEdAngleHandler(options);
656
+ scriptedValue = this.tryGetScriptedNumber(handler);
657
+ if (scriptedValue != null) {
658
+ return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, scriptedValue)];
659
+ }
660
+ basePoint = options.useBasePoint && options.basePoint
661
+ ? options.basePoint
662
+ : this.lastPoint;
663
+ // No reference point available: fallback to typed angle input only.
664
+ if (!basePoint) {
665
+ 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); })];
666
+ }
667
+ getDynamicValue = function (pos) {
668
+ var dx = pos.x - basePoint.x;
669
+ var dy = pos.y - basePoint.y;
670
+ var rawAngleRad = Math.atan2(dy, dx);
671
+ var baseAngleRad = (options.baseAngle * Math.PI) / 180;
672
+ var angleRad = rawAngleRad - baseAngleRad;
673
+ while (angleRad <= -Math.PI)
674
+ angleRad += Math.PI * 2;
675
+ while (angleRad > Math.PI)
676
+ angleRad -= Math.PI * 2;
677
+ var angleDeg = (angleRad * 180) / Math.PI;
678
+ return {
679
+ value: angleDeg,
680
+ raw: { x: _this.formatNumber(angleDeg, 'angle') }
681
+ };
682
+ };
683
+ return [2 /*return*/, this.executePrompt(function () {
684
+ return _this.makeFloatingInputPromise({
685
+ inputCount: 1,
686
+ promptOptions: options,
687
+ handler: handler,
688
+ getDynamicValue: getDynamicValue
689
+ });
690
+ }, function (value) { return new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value); }, function (status) { return new AcEdPromptDoubleResult(status); })];
691
+ });
266
692
  });
267
693
  };
268
- /** Request a double/float from the user. */
694
+ /**
695
+ * Prompts the user for a floating-point number.
696
+ *
697
+ * This is the generic free-form numeric entry path used when no geometric
698
+ * interpretation such as distance or angle is required.
699
+ *
700
+ * @param options - Double prompt options controlling validation and messaging
701
+ * @returns A prompt result containing the parsed number, cancel status, or keyword
702
+ */
269
703
  AcEdInputManager.prototype.getDouble = function (options) {
270
- var scriptedValue = this.tryGetScriptedNumber(new AcEdDoubleHandler(options));
271
- if (scriptedValue != null) {
272
- return Promise.resolve(scriptedValue);
273
- }
274
- return this.getNumberTyped(options, new AcEdDoubleHandler(options));
704
+ return __awaiter(this, void 0, void 0, function () {
705
+ var handler, scriptedValue;
706
+ var _this = this;
707
+ return __generator(this, function (_a) {
708
+ handler = new AcEdDoubleHandler(options);
709
+ scriptedValue = this.tryGetScriptedNumber(handler);
710
+ if (scriptedValue != null) {
711
+ return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, scriptedValue)];
712
+ }
713
+ 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); })];
714
+ });
715
+ });
275
716
  };
276
- /** Request an integer from the user. */
717
+ /**
718
+ * Prompts the user for an integer value.
719
+ *
720
+ * The supplied integer handler enforces integer-only parsing for both typed
721
+ * input and scripted command input.
722
+ *
723
+ * @param options - Integer prompt options controlling validation and messaging
724
+ * @returns A prompt result containing the parsed integer, cancel status, or keyword
725
+ */
277
726
  AcEdInputManager.prototype.getInteger = function (options) {
278
- var scriptedValue = this.tryGetScriptedNumber(new AcEdIntegerHandler(options));
279
- if (scriptedValue != null) {
280
- return Promise.resolve(scriptedValue);
281
- }
282
- return this.getNumberTyped(options, new AcEdIntegerHandler(options));
727
+ return __awaiter(this, void 0, void 0, function () {
728
+ var scriptedValue;
729
+ var _this = this;
730
+ return __generator(this, function (_a) {
731
+ scriptedValue = this.tryGetScriptedNumber(new AcEdIntegerHandler(options));
732
+ if (scriptedValue != null) {
733
+ return [2 /*return*/, new AcEdPromptIntegerResult(AcEdPromptStatus.OK, scriptedValue)];
734
+ }
735
+ 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); })];
736
+ });
737
+ });
283
738
  };
284
739
  /**
285
- * Prompt the user to type an arbitrary string. Resolved when Enter is pressed.
740
+ * Prompts the user to type an arbitrary string.
741
+ *
742
+ * The value is collected through the shared floating-input pipeline so it can
743
+ * participate in the same cancellation, keyword, and scripted-input behavior
744
+ * as the other prompt types.
745
+ *
746
+ * @param options - String prompt options controlling the prompt message and keywords
747
+ * @returns A prompt result containing the entered string, cancel status, or keyword
286
748
  */
287
749
  AcEdInputManager.prototype.getString = function (options) {
288
- var scriptedValue = this.tryGetScriptedValue(new AcEdStringHandler(options));
289
- if (scriptedValue != null) {
290
- return Promise.resolve(scriptedValue);
291
- }
292
- var getDynamicValue = function () {
293
- return {
294
- value: '',
295
- raw: { x: '' }
296
- };
297
- };
298
- var handler = new AcEdStringHandler(options);
299
- return this.makeFloatingInputPromise({
300
- message: options.message,
301
- inputCount: 1,
302
- jig: options.jig,
303
- showBaseLineOnly: false,
304
- useBasePoint: false,
305
- handler: handler,
306
- getDynamicValue: getDynamicValue
750
+ return __awaiter(this, void 0, void 0, function () {
751
+ var scriptedValue;
752
+ var _this = this;
753
+ return __generator(this, function (_a) {
754
+ scriptedValue = this.tryGetScriptedValue(new AcEdStringHandler(options));
755
+ if (scriptedValue != null) {
756
+ return [2 /*return*/, new AcEdPromptResult(AcEdPromptStatus.OK, scriptedValue)];
757
+ }
758
+ return [2 /*return*/, this.executePrompt(function () { return __awaiter(_this, void 0, void 0, function () {
759
+ var getDynamicValue, handler;
760
+ return __generator(this, function (_a) {
761
+ switch (_a.label) {
762
+ case 0:
763
+ getDynamicValue = function () {
764
+ return {
765
+ value: '',
766
+ raw: { x: '' }
767
+ };
768
+ };
769
+ handler = new AcEdStringHandler(options);
770
+ return [4 /*yield*/, this.makeFloatingInputPromise({
771
+ inputCount: 1,
772
+ promptOptions: options,
773
+ handler: handler,
774
+ getDynamicValue: getDynamicValue
775
+ })];
776
+ case 1: return [2 /*return*/, _a.sent()];
777
+ }
778
+ });
779
+ }); }, function (value) { return new AcEdPromptResult(AcEdPromptStatus.OK, value); }, function (status) { return new AcEdPromptResult(status); })];
780
+ });
307
781
  });
308
782
  };
309
783
  /**
310
- * Prompt the user to type a keyword. Resolved when Enter is pressed.
784
+ * Prompts the user to enter one of the configured keywords.
785
+ *
786
+ * Unlike the mixed-mode keyword sessions used by other prompt types, this
787
+ * method runs a dedicated keyword prompt and returns the chosen keyword as the
788
+ * result value.
789
+ *
790
+ * @param options - Keyword prompt options describing the allowed keywords
791
+ * @returns A prompt result containing the chosen keyword or cancel status
311
792
  */
312
793
  AcEdInputManager.prototype.getKeywords = function (options) {
313
- var scriptedValue = this.tryGetScriptedValue(new AcEdKeywordHandler(options));
314
- if (scriptedValue != null) {
315
- return Promise.resolve(scriptedValue);
316
- }
317
- var getDynamicValue = function () {
318
- return {
319
- value: '',
320
- raw: { x: '' }
321
- };
322
- };
323
- var handler = new AcEdKeywordHandler(options);
324
- return this.makeFloatingInputPromise({
325
- message: options.message,
326
- inputCount: 1,
327
- jig: options.jig,
328
- showBaseLineOnly: false,
329
- useBasePoint: false,
330
- handler: handler,
331
- getDynamicValue: getDynamicValue
794
+ return __awaiter(this, void 0, void 0, function () {
795
+ var scriptedValue;
796
+ var _this = this;
797
+ return __generator(this, function (_a) {
798
+ scriptedValue = this.tryGetScriptedValue(new AcEdKeywordHandler(options));
799
+ if (scriptedValue != null) {
800
+ return [2 /*return*/, new AcEdPromptResult(AcEdPromptStatus.OK, scriptedValue)];
801
+ }
802
+ return [2 /*return*/, this.executePrompt(function () { return __awaiter(_this, void 0, void 0, function () {
803
+ var result;
804
+ return __generator(this, function (_a) {
805
+ switch (_a.label) {
806
+ case 0: return [4 /*yield*/, this._commandLine.getKeywords(options, true)];
807
+ case 1:
808
+ result = _a.sent();
809
+ if (!result) {
810
+ if (options.allowNone) {
811
+ throw new AcEdNoneInputError();
812
+ }
813
+ throw new Error('cancelled');
814
+ }
815
+ return [2 /*return*/, result];
816
+ }
817
+ });
818
+ }); }, function (value) { return new AcEdPromptResult(AcEdPromptStatus.OK, value); }, function (status) { return new AcEdPromptResult(status); }, { keyword: false })];
819
+ });
332
820
  });
333
821
  };
334
822
  /**
@@ -337,8 +825,9 @@ var AcEdInputManager = /** @class */ (function () {
337
825
  * This method supports two selection modes:
338
826
  *
339
827
  * - **Click selection**: Clicking on an entity selects the entity under the cursor.
340
- * - **Box selection**: Dragging the mouse to let the user specify a rectangular window,
341
- * and all entities intersecting that box are selected.
828
+ * - **Box selection**:
829
+ * - left-to-right drag: window selection (entities fully inside the box)
830
+ * - right-to-left drag: crossing selection (entities intersecting the box)
342
831
  *
343
832
  * The selection operation behaves similarly to AutoCAD's
344
833
  * `Editor.GetSelection()` API:
@@ -362,268 +851,445 @@ var AcEdInputManager = /** @class */ (function () {
362
851
  return __awaiter(this, void 0, void 0, function () {
363
852
  var _this = this;
364
853
  return __generator(this, function (_a) {
365
- return [2 /*return*/, new Promise(function (resolve, reject) {
366
- _this.active = true;
367
- _this._commandLine.setPrompt(options.message);
368
- var floatingMessage = new AcEdFloatingMessage(_this.view, {
369
- parent: _this.view.canvas,
370
- message: options.message
371
- });
372
- var selected = new Set();
373
- var startWcs = null;
374
- var previewEl = null;
375
- var cleanup = function () {
376
- _this.active = false;
377
- floatingMessage.dispose();
378
- previewEl === null || previewEl === void 0 ? void 0 : previewEl.remove();
379
- _this._commandLine.clear();
380
- document.removeEventListener('keydown', keyHandler);
381
- _this.view.canvas.removeEventListener('mousedown', mouseDown);
382
- _this.view.canvas.removeEventListener('mousemove', mouseMove);
383
- _this.view.canvas.removeEventListener('mouseup', mouseUp);
384
- };
385
- /** ---------- Keyboard ---------- */
386
- var keyHandler = function (e) {
387
- if (e.key === 'Escape') {
388
- cleanup();
389
- reject(new Error('cancelled'));
390
- return;
854
+ return [2 /*return*/, this.executePrompt(function () {
855
+ return new Promise(function (resolve, reject) {
856
+ _this.active = true;
857
+ _this.entitySelectionActive = true;
858
+ var keywordSession = _this.startKeywordSession(options, true);
859
+ if (!keywordSession) {
860
+ _this._commandLine.setPrompt(options.message);
391
861
  }
392
- if (e.key === 'Enter') {
862
+ var floatingMessage = new AcEdFloatingMessage(_this.view, {
863
+ parent: _this.view.canvas,
864
+ message: options.message
865
+ });
866
+ var selected = new Set();
867
+ var startWcs = null;
868
+ var startCanvas = null;
869
+ var previewEl = null;
870
+ var settled = false;
871
+ var cleanup = function () {
872
+ if (settled)
873
+ return;
874
+ settled = true;
875
+ _this.active = false;
876
+ _this.entitySelectionActive = false;
877
+ floatingMessage === null || floatingMessage === void 0 ? void 0 : floatingMessage.dispose();
878
+ previewEl === null || previewEl === void 0 ? void 0 : previewEl.remove();
879
+ keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.cancel();
880
+ _this._commandLine.clear();
881
+ document.removeEventListener('keydown', keyHandler);
882
+ _this.view.canvas.removeEventListener('mousedown', mouseDown);
883
+ _this.view.canvas.removeEventListener('mousemove', mouseMove);
884
+ _this.view.canvas.removeEventListener('mouseup', mouseUp);
885
+ _this.view.canvas.removeEventListener('contextmenu', contextMenuHandler);
886
+ };
887
+ keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.promise.then(function (keyword) {
888
+ if (settled)
889
+ return;
890
+ if (!keyword) {
891
+ cleanup();
892
+ reject(new Error('cancelled'));
893
+ return;
894
+ }
393
895
  cleanup();
394
- resolve(__spreadArray([], __read(selected), false));
395
- }
396
- };
397
- /** ---------- Mouse ---------- */
398
- var mouseDown = function (e) {
399
- startWcs = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
400
- previewEl = document.createElement('div');
401
- previewEl.className = 'ml-jig-preview-rect';
402
- _this.view.container.appendChild(previewEl);
403
- };
404
- var mouseMove = function (e) {
405
- if (!startWcs || !previewEl)
406
- return;
407
- var curWcs = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
408
- var p1 = _this.view.worldToScreen(startWcs);
409
- var p2 = _this.view.worldToScreen(curWcs);
410
- var left = Math.min(p1.x, p2.x);
411
- var top = Math.min(p1.y, p2.y);
412
- var width = Math.abs(p1.x - p2.x);
413
- var height = Math.abs(p1.y - p2.y);
414
- Object.assign(previewEl.style, {
415
- left: "".concat(left, "px"),
416
- top: "".concat(top, "px"),
417
- width: "".concat(width, "px"),
418
- height: "".concat(height, "px")
896
+ reject(new AcEdKeywordInputError(keyword));
419
897
  });
420
- };
421
- var mouseUp = function (e) {
422
- var e_1, _a;
423
- if (!startWcs)
424
- return;
425
- var endWcs = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
426
- previewEl === null || previewEl === void 0 ? void 0 : previewEl.remove();
427
- previewEl = null;
428
- // Click selection
429
- var dist = Math.hypot(endWcs.x - startWcs.x, endWcs.y - startWcs.y);
430
- if (dist < 2) {
431
- var picked = _this.view.pick(endWcs);
432
- if (picked.length > 0) {
433
- selected.add(picked[0].id);
434
- if (options.singleOnly) {
898
+ /** ---------- Keyboard ---------- */
899
+ var keyHandler = function (e) {
900
+ if (e.key === 'Escape') {
901
+ cleanup();
902
+ reject(new Error('cancelled'));
903
+ return;
904
+ }
905
+ if (e.key === 'Enter') {
906
+ cleanup();
907
+ resolve(__spreadArray([], __read(selected), false));
908
+ }
909
+ };
910
+ /** ---------- Mouse ---------- */
911
+ var contextMenuHandler = function (e) {
912
+ if (_this.shouldUseRightClickEnter()) {
913
+ e.preventDefault();
914
+ }
915
+ };
916
+ var mouseDown = function (e) {
917
+ if (e.button === 2) {
918
+ if (_this.shouldUseRightClickEnter()) {
919
+ e.preventDefault();
435
920
  cleanup();
436
921
  resolve(__spreadArray([], __read(selected), false));
437
922
  }
923
+ return;
438
924
  }
439
- }
440
- else {
441
- // Box selection
442
- var box = new AcGeBox2d()
443
- .expandByPoint(startWcs)
444
- .expandByPoint(endWcs);
445
- _this.view.selectByBox(box);
925
+ if (e.button !== 0)
926
+ return;
927
+ startCanvas = _this.view.viewportToCanvas({
928
+ x: e.clientX,
929
+ y: e.clientY
930
+ });
931
+ startWcs = _this.view.screenToWorld(startCanvas);
932
+ previewEl = document.createElement('div');
933
+ previewEl.className = 'ml-jig-preview-rect';
934
+ _this.view.container.appendChild(previewEl);
935
+ };
936
+ var mouseMove = function (e) {
937
+ if (e.buttons !== 1)
938
+ return;
939
+ if (!startWcs || !previewEl || !startCanvas)
940
+ return;
941
+ var curWcs = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
942
+ var curCanvas = _this.view.viewportToCanvas({
943
+ x: e.clientX,
944
+ y: e.clientY
945
+ });
946
+ var p1 = _this.view.worldToScreen(startWcs);
947
+ var p2 = _this.view.worldToScreen(curWcs);
948
+ var left = Math.min(p1.x, p2.x);
949
+ var top = Math.min(p1.y, p2.y);
950
+ var width = Math.abs(p1.x - p2.x);
951
+ var height = Math.abs(p1.y - p2.y);
952
+ var mode = _this.view.getSelectionMode(startCanvas, curCanvas);
953
+ var action = _this.view.getSelectionActionFromEvent(e, 'add');
954
+ var style = _this.view.getSelectionPreviewStyle(mode, action);
955
+ Object.assign(previewEl.style, {
956
+ left: "".concat(left, "px"),
957
+ top: "".concat(top, "px"),
958
+ width: "".concat(width, "px"),
959
+ height: "".concat(height, "px"),
960
+ borderStyle: style.borderStyle,
961
+ background: style.background
962
+ });
963
+ previewEl.style.setProperty('--line-color', style.lineColor);
964
+ };
965
+ var mouseUp = function (e) {
966
+ var e_2, _a;
967
+ if (e.button !== 0)
968
+ return;
969
+ if (!startWcs || !startCanvas)
970
+ return;
971
+ var endWcs = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
972
+ var endCanvas = _this.view.viewportToCanvas({
973
+ x: e.clientX,
974
+ y: e.clientY
975
+ });
976
+ previewEl === null || previewEl === void 0 ? void 0 : previewEl.remove();
977
+ previewEl = null;
978
+ // Click selection
979
+ var action = _this.view.getSelectionActionFromEvent(e, 'add');
980
+ if (_this.view.isSelectionClick(startCanvas, endCanvas)) {
981
+ var picked = _this.view.pick(endWcs);
982
+ if (picked.length > 0) {
983
+ _this.view.applySelection([picked[0].id], action);
984
+ }
985
+ else if (action === 'replace') {
986
+ _this.view.selectionSet.clear();
987
+ }
988
+ }
989
+ else {
990
+ // Box selection
991
+ var box = new AcGeBox2d()
992
+ .expandByPoint(startWcs)
993
+ .expandByPoint(endWcs);
994
+ var mode = _this.view.getSelectionMode(startCanvas, endCanvas);
995
+ _this.view.selectByBoxWithMode(box, mode, action);
996
+ }
997
+ selected.clear();
446
998
  try {
447
999
  for (var _b = __values(_this.view.selectionSet.ids), _c = _b.next(); !_c.done; _c = _b.next()) {
448
1000
  var id = _c.value;
449
1001
  selected.add(id);
450
- if (options.singleOnly)
451
- break;
452
1002
  }
453
1003
  }
454
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1004
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
455
1005
  finally {
456
1006
  try {
457
1007
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
458
1008
  }
459
- finally { if (e_1) throw e_1.error; }
1009
+ finally { if (e_2) throw e_2.error; }
460
1010
  }
461
- }
462
- startWcs = null;
463
- };
464
- /** ---------- Attach ---------- */
465
- document.addEventListener('keydown', keyHandler);
466
- _this.view.canvas.addEventListener('mousedown', mouseDown);
467
- _this.view.canvas.addEventListener('mousemove', mouseMove);
468
- _this.view.canvas.addEventListener('mouseup', mouseUp);
469
- })];
1011
+ if (options.singleOnly && action !== 'remove') {
1012
+ if (selected.size > 0) {
1013
+ cleanup();
1014
+ resolve(__spreadArray([], __read(selected), false));
1015
+ }
1016
+ }
1017
+ startWcs = null;
1018
+ startCanvas = null;
1019
+ };
1020
+ document.addEventListener('keydown', keyHandler);
1021
+ _this.view.canvas.addEventListener('mousedown', mouseDown);
1022
+ _this.view.canvas.addEventListener('mousemove', mouseMove);
1023
+ _this.view.canvas.addEventListener('mouseup', mouseUp);
1024
+ _this.view.canvas.addEventListener('contextmenu', contextMenuHandler);
1025
+ });
1026
+ }, function (value) {
1027
+ return new AcEdPromptSelectionResult(AcEdPromptStatus.OK, new AcEdSelectionSet(value));
1028
+ }, function (status) { return new AcEdPromptSelectionResult(status); }, { none: false })];
470
1029
  });
471
1030
  });
472
1031
  };
473
1032
  /**
474
1033
  * Prompts the user to select a single entity.
475
- * Similar to Editor.GetEntity() in AutoCAD.
1034
+ *
1035
+ * Selection is performed by clicking in the view and validating the first
1036
+ * hit-tested entity under the cursor. The picked entity may be rejected when
1037
+ * it belongs to a locked layer or does not satisfy the prompt's allowed-class
1038
+ * filter, in which case the rejection message is shown and the prompt remains
1039
+ * active. Keywords and `AllowNone` behavior are also supported.
1040
+ *
1041
+ * @param options - Entity prompt options controlling filtering, messaging, and keywords
1042
+ * @returns A prompt result containing the selected entity id, picked point,
1043
+ * cancel status, or keyword
476
1044
  */
477
1045
  AcEdInputManager.prototype.getEntity = function (options) {
478
- var _this = this;
479
- return new Promise(function (resolve, reject) {
480
- _this.active = true;
481
- var floatingMessage = new AcEdFloatingMessage(_this.view, {
482
- parent: _this.view.canvas,
483
- message: options.message
1046
+ return __awaiter(this, void 0, void 0, function () {
1047
+ var pickedPoint;
1048
+ var _this = this;
1049
+ return __generator(this, function (_a) {
1050
+ return [2 /*return*/, this.executePrompt(function () {
1051
+ return new Promise(function (resolve, reject) {
1052
+ _this.active = true;
1053
+ _this.entitySelectionActive = true;
1054
+ var keywordSession = _this.startKeywordSession(options, true);
1055
+ var floatingMessage = new AcEdFloatingMessage(_this.view, {
1056
+ parent: _this.view.canvas,
1057
+ message: options.message
1058
+ });
1059
+ if (!keywordSession) {
1060
+ _this._commandLine.setPrompt(options.message);
1061
+ }
1062
+ var settled = false;
1063
+ var cleanup = function () {
1064
+ var _a;
1065
+ if (settled)
1066
+ return;
1067
+ settled = true;
1068
+ _this.active = false;
1069
+ _this.entitySelectionActive = false;
1070
+ (_a = options.jig) === null || _a === void 0 ? void 0 : _a.end();
1071
+ document.removeEventListener('keydown', keyHandler);
1072
+ _this.view.canvas.removeEventListener('mousedown', clickHandler);
1073
+ _this.view.canvas.removeEventListener('contextmenu', contextMenuHandler);
1074
+ floatingMessage === null || floatingMessage === void 0 ? void 0 : floatingMessage.dispose();
1075
+ keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.cancel();
1076
+ _this._commandLine.clear();
1077
+ };
1078
+ keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.promise.then(function (keyword) {
1079
+ if (settled)
1080
+ return;
1081
+ if (!keyword) {
1082
+ cleanup();
1083
+ reject(new Error('cancelled'));
1084
+ return;
1085
+ }
1086
+ cleanup();
1087
+ reject(new AcEdKeywordInputError(keyword));
1088
+ });
1089
+ /** Mouse click → try select entity */
1090
+ var clickHandler = function (e) {
1091
+ if (e.button === 2) {
1092
+ if (_this.shouldUseRightClickEnter() && options.allowNone) {
1093
+ e.preventDefault();
1094
+ cleanup();
1095
+ resolve(null);
1096
+ }
1097
+ return;
1098
+ }
1099
+ if (e.button !== 0)
1100
+ return;
1101
+ var pos = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
1102
+ var picked = _this.view.pick(pos, undefined, true);
1103
+ // Clicked empty space
1104
+ if (picked.length == 0) {
1105
+ _this._commandLine.showError(options.rejectMessage);
1106
+ return;
1107
+ }
1108
+ var entity = _this.getEntityById(picked[0].id);
1109
+ if (!entity) {
1110
+ _this._commandLine.showError(options.rejectMessage);
1111
+ return;
1112
+ }
1113
+ if (!options.allowObjectOnLockedLayer &&
1114
+ _this.isEntityOnLockedLayer(entity)) {
1115
+ _this._commandLine.showError(options.rejectMessage);
1116
+ return;
1117
+ }
1118
+ if (!_this.isEntityClassAllowed(entity, options)) {
1119
+ _this._commandLine.showError(options.rejectMessage);
1120
+ return;
1121
+ }
1122
+ pickedPoint = { x: pos.x, y: pos.y, z: 0 };
1123
+ cleanup();
1124
+ resolve(picked[0].id);
1125
+ };
1126
+ /** Keyboard handling */
1127
+ var keyHandler = function (e) {
1128
+ if (e.key === 'Escape') {
1129
+ cleanup();
1130
+ reject(new Error('cancelled'));
1131
+ return;
1132
+ }
1133
+ if (e.key === 'Enter' && options.allowNone) {
1134
+ cleanup();
1135
+ resolve(null);
1136
+ }
1137
+ };
1138
+ var contextMenuHandler = function (e) {
1139
+ if (_this.shouldUseRightClickEnter()) {
1140
+ e.preventDefault();
1141
+ }
1142
+ };
1143
+ document.addEventListener('keydown', keyHandler);
1144
+ _this.view.canvas.addEventListener('mousedown', clickHandler);
1145
+ _this.view.canvas.addEventListener('contextmenu', contextMenuHandler);
1146
+ });
1147
+ }, function (value) {
1148
+ return new AcEdPromptEntityResult(AcEdPromptStatus.OK, value || undefined, pickedPoint);
1149
+ }, function (status) { return new AcEdPromptEntityResult(status); }, { none: false })];
484
1150
  });
485
- _this._commandLine.setPrompt(options.message);
486
- var cleanup = function () {
487
- var _a;
488
- _this.active = false;
489
- (_a = options.jig) === null || _a === void 0 ? void 0 : _a.end();
490
- document.removeEventListener('keydown', keyHandler);
491
- _this.view.canvas.removeEventListener('mousedown', clickHandler);
492
- floatingMessage.dispose();
493
- _this._commandLine.clear();
494
- };
495
- /** Mouse click → try select entity */
496
- var clickHandler = function (e) {
497
- var pos = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
498
- var picked = _this.view.pick(pos);
499
- // Clicked empty space
500
- if (picked.length == 0) {
501
- // this.view.showMessage(options.rejectMessage)
502
- return;
503
- }
504
- // Locked layer
505
- // if (picked.locked && !options.allowObjectOnLockedLayer) {
506
- // this.view.showMessage(options.rejectMessage)
507
- // return
508
- // }
509
- // Class filter
510
- // if (!options.isClassAllowed(picked.className)) {
511
- // this.view.showMessage(options.rejectMessage)
512
- // return
513
- // }
514
- cleanup();
515
- resolve(picked[0].id);
516
- };
517
- /** Keyboard handling */
518
- var keyHandler = function (e) {
519
- if (e.key === 'Escape') {
520
- cleanup();
521
- reject(new Error('cancelled'));
522
- return;
523
- }
524
- if (e.key === 'Enter' && options.allowNone) {
525
- cleanup();
526
- resolve(null);
527
- }
528
- };
529
- document.addEventListener('keydown', keyHandler);
530
- _this.view.canvas.addEventListener('mousedown', clickHandler);
531
1151
  });
532
1152
  };
533
1153
  /**
534
1154
  * Prompt the user to specify a rectangular box by selecting two corners.
535
1155
  * Each corner may be specified by clicking on the canvas or typing "x,y".
536
1156
  * A live HTML overlay rectangle previews the box as the user moves the mouse.
1157
+ *
1158
+ * The box prompt is implemented as two chained point prompts. Keywords from
1159
+ * the original box prompt are copied into each corner prompt so the caller
1160
+ * sees a consistent interaction model across both stages.
1161
+ *
1162
+ * @param options - Box prompt options controlling corner messages, preview behavior, and keywords
1163
+ * @returns A prompt result containing the final 2D box, cancel status, or keyword
537
1164
  */
538
1165
  AcEdInputManager.prototype.getBox = function (options) {
539
1166
  return __awaiter(this, void 0, void 0, function () {
540
- var message1, options1, p1, cwcsP1, previewEl, cleanup, drawPreview, message2, options2, p2;
541
1167
  var _this = this;
542
1168
  return __generator(this, function (_a) {
543
- switch (_a.label) {
544
- case 0:
545
- message1 = options.firstCornerMessage || AcApI18n.t('main.inputManager.firstCorner');
546
- options1 = new AcEdPromptPointOptions(message1);
547
- options1.useDashedLine = options.useDashedLine;
548
- options1.useBasePoint = options.useBasePoint;
549
- return [4 /*yield*/, this.getPoint(options1)];
550
- case 1:
551
- p1 = _a.sent();
552
- cwcsP1 = this.view.worldToScreen(p1);
553
- previewEl = document.createElement('div');
554
- previewEl.className = 'ml-jig-preview-rect';
555
- this.view.container.appendChild(previewEl);
556
- cleanup = function () {
557
- previewEl.remove();
558
- };
559
- drawPreview = function (pos) {
560
- var cwcsP2 = _this.view.worldToScreen(pos);
561
- var left = Math.min(cwcsP2.x, cwcsP1.x);
562
- var top = Math.min(cwcsP2.y, cwcsP1.y);
563
- var width = Math.abs(cwcsP2.x - cwcsP1.x);
564
- var height = Math.abs(cwcsP2.y - cwcsP1.y);
565
- Object.assign(previewEl.style, {
566
- left: "".concat(left, "px"),
567
- top: "".concat(top, "px"),
568
- width: "".concat(width, "px"),
569
- height: "".concat(height, "px")
570
- });
571
- };
572
- message2 = options.secondCornerMessage ||
573
- AcApI18n.t('main.inputManager.secondCorner');
574
- options2 = new AcEdPromptPointOptions(message2);
575
- options2.useDashedLine = options.useDashedLine;
576
- options2.useBasePoint = options.useBasePoint;
577
- return [4 /*yield*/, this.getPointInternal(options2, cleanup, drawPreview)];
578
- case 2:
579
- p2 = _a.sent();
580
- return [2 /*return*/, new AcGeBox2d().expandByPoint(p1).expandByPoint(p2)];
581
- }
1169
+ return [2 /*return*/, this.executePrompt(function () { return __awaiter(_this, void 0, void 0, function () {
1170
+ var message1, options1, p1Result, p1, cwcsP1, previewEl, cleanup, drawPreview, message2, options2, p2, box;
1171
+ var _this = this;
1172
+ return __generator(this, function (_a) {
1173
+ switch (_a.label) {
1174
+ case 0:
1175
+ message1 = options.firstCornerMessage ||
1176
+ AcApI18n.t('main.inputManager.firstCorner');
1177
+ options1 = new AcEdPromptPointOptions(message1);
1178
+ this.copyKeywords(options, options1);
1179
+ options1.useDashedLine = options.useDashedLine;
1180
+ options1.useBasePoint = options.useBasePoint;
1181
+ return [4 /*yield*/, this.getPoint(options1)];
1182
+ case 1:
1183
+ p1Result = _a.sent();
1184
+ if (p1Result.status !== AcEdPromptStatus.OK) {
1185
+ return [2 /*return*/, new AcEdPromptBoxResult(p1Result.status, undefined, p1Result.stringResult)];
1186
+ }
1187
+ p1 = p1Result.value;
1188
+ cwcsP1 = this.view.worldToScreen(p1);
1189
+ previewEl = document.createElement('div');
1190
+ previewEl.className = 'ml-jig-preview-rect';
1191
+ this.view.container.appendChild(previewEl);
1192
+ cleanup = function () {
1193
+ previewEl.remove();
1194
+ };
1195
+ drawPreview = function (pos) {
1196
+ var cwcsP2 = _this.view.worldToScreen(pos);
1197
+ var left = Math.min(cwcsP2.x, cwcsP1.x);
1198
+ var top = Math.min(cwcsP2.y, cwcsP1.y);
1199
+ var width = Math.abs(cwcsP2.x - cwcsP1.x);
1200
+ var height = Math.abs(cwcsP2.y - cwcsP1.y);
1201
+ Object.assign(previewEl.style, {
1202
+ left: "".concat(left, "px"),
1203
+ top: "".concat(top, "px"),
1204
+ width: "".concat(width, "px"),
1205
+ height: "".concat(height, "px")
1206
+ });
1207
+ };
1208
+ message2 = options.secondCornerMessage ||
1209
+ AcApI18n.t('main.inputManager.secondCorner');
1210
+ options2 = new AcEdPromptPointOptions(message2);
1211
+ this.copyKeywords(options, options2);
1212
+ options2.useDashedLine = options.useDashedLine;
1213
+ options2.useBasePoint = options.useBasePoint;
1214
+ return [4 /*yield*/, this.getPointInternal(options2, cleanup, drawPreview)];
1215
+ case 2:
1216
+ p2 = _a.sent();
1217
+ box = new AcGeBox2d().expandByPoint(p1).expandByPoint(p2);
1218
+ return [2 /*return*/, new AcEdPromptBoxResult(AcEdPromptStatus.OK, box)];
1219
+ }
1220
+ });
1221
+ }); }, function (value) { return value; }, function (status) { return new AcEdPromptBoxResult(status); })];
582
1222
  });
583
1223
  });
584
1224
  };
585
1225
  /**
586
1226
  * Shared point input logic used by getPoint() and getBox(). Accepts "x,y"
587
1227
  * typed input OR mouse click.
1228
+ *
1229
+ * This helper optionally wires extra cleanup and preview callbacks so
1230
+ * higher-level workflows can overlay additional temporary graphics while
1231
+ * reusing the same point acquisition behavior.
1232
+ *
1233
+ * @param options - Point prompt options controlling the interaction
1234
+ * @param cleanup - Optional callback invoked when the point prompt ends
1235
+ * @param drawPreview - Optional callback invoked as the cursor moves for live preview rendering
1236
+ * @returns A promise that resolves to the chosen point
588
1237
  */
589
1238
  AcEdInputManager.prototype.getPointInternal = function (options, cleanup, drawPreview) {
590
- var _this = this;
591
- var scriptedValue = this.tryGetScriptedPoint(options);
592
- if (scriptedValue != null) {
593
- cleanup === null || cleanup === void 0 ? void 0 : cleanup();
594
- return Promise.resolve(scriptedValue);
595
- }
596
- var getDynamicValue = function (pos) {
597
- return {
598
- value: { x: pos.x, y: pos.y, z: 0 },
599
- raw: {
600
- x: _this.formatNumber(pos.x, 'point'),
601
- y: _this.formatNumber(pos.y, 'point')
1239
+ return __awaiter(this, void 0, void 0, function () {
1240
+ var scriptedValue, getDynamicValue, handler;
1241
+ var _this = this;
1242
+ return __generator(this, function (_a) {
1243
+ scriptedValue = this.tryGetScriptedPoint(options);
1244
+ if (scriptedValue != null) {
1245
+ cleanup === null || cleanup === void 0 ? void 0 : cleanup();
1246
+ return [2 /*return*/, Promise.resolve(scriptedValue)];
602
1247
  }
603
- };
604
- };
605
- var handler = new AcEdPointHandler(options);
606
- return this.makeFloatingInputPromise({
607
- message: options.message,
608
- inputCount: 2,
609
- jig: options.jig,
610
- showBaseLineOnly: !options.useDashedLine,
611
- useBasePoint: options.useBasePoint,
612
- basePoint: options.basePoint,
613
- cleanup: cleanup,
614
- handler: handler,
615
- getDynamicValue: getDynamicValue,
616
- drawPreview: drawPreview
1248
+ getDynamicValue = function (pos) {
1249
+ return {
1250
+ value: { x: pos.x, y: pos.y, z: 0 },
1251
+ raw: {
1252
+ x: _this.formatNumber(pos.x, 'point'),
1253
+ y: _this.formatNumber(pos.y, 'point')
1254
+ }
1255
+ };
1256
+ };
1257
+ handler = new AcEdPointHandler(options);
1258
+ return [2 /*return*/, this.makeFloatingInputPromise({
1259
+ inputCount: 2,
1260
+ promptOptions: options,
1261
+ cleanup: cleanup,
1262
+ handler: handler,
1263
+ getDynamicValue: getDynamicValue,
1264
+ drawPreview: drawPreview
1265
+ })];
1266
+ });
617
1267
  });
618
1268
  };
619
1269
  /**
620
1270
  * Attempts to consume one scripted input and parse it as a point.
621
1271
  * Supported forms: "x,y", "x,y,z", or "x y".
1272
+ *
1273
+ * Successful scripted points also update `lastPoint` so subsequent prompts
1274
+ * that rely on prior geometric context behave the same way as with manual
1275
+ * point picking.
1276
+ *
1277
+ * @param options - Point prompt options used to validate the scripted coordinates
1278
+ * @returns Parsed point value, or `undefined` when no scripted token is queued
1279
+ * @throws Error if a queued scripted token cannot be parsed as a valid point
622
1280
  */
623
1281
  AcEdInputManager.prototype.tryGetScriptedPoint = function (options) {
624
1282
  var token = this.dequeueScriptInput();
625
1283
  if (token === undefined)
626
1284
  return undefined;
1285
+ var trimmed = token.trim();
1286
+ if (!trimmed && options.allowNone) {
1287
+ throw new AcEdNoneInputError();
1288
+ }
1289
+ var keyword = options.keywords.findByName(trimmed);
1290
+ if (keyword) {
1291
+ throw new AcEdKeywordInputError(keyword.globalName);
1292
+ }
627
1293
  var parsed = this.splitScriptedPoint(token);
628
1294
  if (!parsed) {
629
1295
  throw new Error("Invalid point input '".concat(token, "'"));
@@ -637,6 +1303,16 @@ var AcEdInputManager = /** @class */ (function () {
637
1303
  };
638
1304
  /**
639
1305
  * Attempts to consume one scripted input and parse it with the supplied handler.
1306
+ *
1307
+ * Scripted input is used to emulate command-line entry in automated or
1308
+ * replayed workflows. This helper keeps the parsing path consistent with
1309
+ * interactive input by delegating to the same handler implementation used by
1310
+ * the floating-input UI.
1311
+ *
1312
+ * @typeParam T - Parsed value type
1313
+ * @param handler - Input handler used to parse the queued token
1314
+ * @returns Parsed value, or `undefined` when no scripted token is available
1315
+ * @throws Error if a queued token exists but fails validation
640
1316
  */
641
1317
  AcEdInputManager.prototype.tryGetScriptedValue = function (handler) {
642
1318
  var token = this.dequeueScriptInput();
@@ -648,14 +1324,39 @@ var AcEdInputManager = /** @class */ (function () {
648
1324
  }
649
1325
  return value;
650
1326
  };
1327
+ /**
1328
+ * Attempts to consume one scripted numeric token.
1329
+ *
1330
+ * This is a thin specialization of {@link tryGetScriptedValue} that narrows
1331
+ * the accepted handler types to those used by numeric-style prompts.
1332
+ *
1333
+ * @param handler - Numeric handler used to parse the queued token
1334
+ * @returns Parsed numeric value, or `undefined` when no scripted token is queued
1335
+ */
651
1336
  AcEdInputManager.prototype.tryGetScriptedNumber = function (handler) {
652
1337
  return this.tryGetScriptedValue(handler);
653
1338
  };
1339
+ /**
1340
+ * Removes and returns the next queued scripted input token.
1341
+ *
1342
+ * @returns The next scripted token, or `undefined` when the queue is empty
1343
+ */
654
1344
  AcEdInputManager.prototype.dequeueScriptInput = function () {
655
1345
  if (!this._scriptInputs.length)
656
1346
  return undefined;
657
1347
  return this._scriptInputs.shift();
658
1348
  };
1349
+ /**
1350
+ * Splits a scripted point token into x/y coordinate components.
1351
+ *
1352
+ * The accepted formats intentionally mirror common CAD command-line point
1353
+ * entry conventions, including comma-separated coordinates and whitespace-
1354
+ * separated coordinates. An optional third `z` component is tolerated for
1355
+ * compatibility, but only the `x` and `y` values are used by 2D prompts.
1356
+ *
1357
+ * @param token - Raw scripted point token
1358
+ * @returns Extracted x/y string pair, or `undefined` if the token is malformed
1359
+ */
659
1360
  AcEdInputManager.prototype.splitScriptedPoint = function (token) {
660
1361
  var trimmed = token.trim();
661
1362
  if (!trimmed)
@@ -674,92 +1375,290 @@ var AcEdInputManager = /** @class */ (function () {
674
1375
  return { x: parts[0], y: parts[1] };
675
1376
  };
676
1377
  /**
677
- * Creates a promise for floating input that will be resolved or rejected by user input.
1378
+ * Returns whether an unknown error value represents prompt cancellation.
678
1379
  *
679
- * This method centralizes the lifecycle of an interactive input operation,
680
- * including handling the Escape key to cancel, resolving with user-provided
681
- * values, and guaranteeing cleanup of UI elements and event handlers.
1380
+ * Prompt flows normalize cancellation to a regular `Error` with the message
1381
+ * `'cancelled'`. This helper keeps the outer result-conversion code concise
1382
+ * and consistent across prompt types.
1383
+ *
1384
+ * @param error - Unknown error value thrown from an input workflow
1385
+ * @returns `true` if the error represents prompt cancellation
1386
+ */
1387
+ AcEdInputManager.prototype.isPromptCancelled = function (error) {
1388
+ return error instanceof Error && error.message === 'cancelled';
1389
+ };
1390
+ /**
1391
+ * Returns whether an unknown error value represents PromptStatus.None.
1392
+ *
1393
+ * @param error - Unknown error value thrown from an input workflow
1394
+ * @returns `true` if the error represents "no input" confirmation
1395
+ */
1396
+ AcEdInputManager.prototype.isPromptNone = function (error) {
1397
+ return error instanceof AcEdNoneInputError;
1398
+ };
1399
+ /**
1400
+ * Reads SHORTCUTMENU value from current working database.
1401
+ *
1402
+ * @returns Normalized 0..3 shortcut-menu mode
1403
+ */
1404
+ AcEdInputManager.prototype.getShortcutMenuMode = function () {
1405
+ var db = acdbHostApplicationServices().workingDatabase;
1406
+ var raw = AcDbSysVarManager.instance().getVar(AcDbSystemVariables.SHORTCUTMENU, db);
1407
+ var value = Math.trunc(Number(raw));
1408
+ if (Number.isNaN(value))
1409
+ return 0;
1410
+ var normalized = value & 0x3;
1411
+ return normalized;
1412
+ };
1413
+ /**
1414
+ * Resolves right-click behavior for current prompt session.
1415
+ *
1416
+ * SHORTCUTMENU:
1417
+ * 0 => always Enter
1418
+ * 1 => Enter in command, menu when idle
1419
+ * 2 => menu in command
1420
+ * 3 => always menu
1421
+ */
1422
+ AcEdInputManager.prototype.shouldUseRightClickEnter = function () {
1423
+ var mode = this.getShortcutMenuMode();
1424
+ if (mode === 0)
1425
+ return true;
1426
+ if (mode === 1)
1427
+ return this.active;
1428
+ return false;
1429
+ };
1430
+ /**
1431
+ * Synchronizes the stored modifier-key snapshot with a DOM keyboard event.
1432
+ *
1433
+ * Floating preview rendering depends on modifier state for behaviors such as
1434
+ * temporary mode switches. This helper updates the cached modifier snapshot
1435
+ * and reports whether anything actually changed so callers can avoid
1436
+ * unnecessary preview refreshes.
1437
+ *
1438
+ * @param e - Keyboard-like event carrying modifier-key flags
1439
+ * @returns `true` if any modifier flag changed; otherwise `false`
1440
+ */
1441
+ AcEdInputManager.prototype.updateModifierStateFromEvent = function (e) {
1442
+ var next = {
1443
+ ctrlKey: !!e.ctrlKey,
1444
+ shiftKey: !!e.shiftKey,
1445
+ altKey: !!e.altKey,
1446
+ metaKey: !!e.metaKey
1447
+ };
1448
+ var prev = this._modifierState;
1449
+ var changed = prev.ctrlKey !== next.ctrlKey ||
1450
+ prev.shiftKey !== next.shiftKey ||
1451
+ prev.altKey !== next.altKey ||
1452
+ prev.metaKey !== next.metaKey;
1453
+ if (changed) {
1454
+ this._modifierState = next;
1455
+ }
1456
+ return changed;
1457
+ };
1458
+ /**
1459
+ * Handles the sticky Ctrl toggle used by certain jig interactions.
1460
+ *
1461
+ * Instead of tracking Ctrl as a purely held modifier, some commands treat a
1462
+ * Ctrl key press as a persistent toggle. This helper flips that toggle on the
1463
+ * first non-repeating keydown event for the Control key.
1464
+ *
1465
+ * @param e - Keyboard event to inspect
1466
+ * @returns `true` if the toggle state changed and previews should refresh
1467
+ */
1468
+ AcEdInputManager.prototype.handleCtrlToggleKey = function (e) {
1469
+ if (e.key !== 'Control' || e.repeat)
1470
+ return false;
1471
+ if (e.type !== 'keydown')
1472
+ return false;
1473
+ this._ctrlArcFlip = !this._ctrlArcFlip;
1474
+ return true;
1475
+ };
1476
+ /**
1477
+ * Extracts cross-prompt defaults from a prompt options object.
1478
+ *
1479
+ * Not every prompt type exposes the same optional properties, but the
1480
+ * floating-input pipeline needs a normalized shape for values such as base
1481
+ * point, dashed-baseline behavior, jig, and base angle. This helper performs
1482
+ * those property-existence checks in one place.
1483
+ *
1484
+ * @typeParam T - Value type produced by the prompt
1485
+ * @param options - Prompt options to normalize
1486
+ * @returns A normalized object containing only the floating-input defaults it understands
1487
+ */
1488
+ AcEdInputManager.prototype.resolvePromptDefaults = function (options) {
1489
+ var hasBasePoint = 'basePoint' in options;
1490
+ var hasUseBasePoint = 'useBasePoint' in options;
1491
+ var hasUseDashedLine = 'useDashedLine' in options;
1492
+ var hasBaseAngle = 'baseAngle' in options;
1493
+ var basePoint = hasBasePoint && options.basePoint
1494
+ ? options.basePoint
1495
+ : undefined;
1496
+ var useBasePoint = hasUseBasePoint ? options.useBasePoint : false;
1497
+ var showBaseLineOnly = hasUseDashedLine ? !options.useDashedLine : false;
1498
+ var baseAngle = hasBaseAngle ? options.baseAngle : undefined;
1499
+ return {
1500
+ message: options.message,
1501
+ jig: options.jig,
1502
+ basePoint: basePoint,
1503
+ useBasePoint: useBasePoint,
1504
+ showBaseLineOnly: showBaseLineOnly,
1505
+ baseAngle: baseAngle
1506
+ };
1507
+ };
1508
+ /**
1509
+ * Runs a floating-input prompt and resolves it to a parsed value.
1510
+ *
1511
+ * This is the core interaction primitive used by most non-selection prompts.
1512
+ * It wires together command-line keyword handling, floating input creation,
1513
+ * validation, preview refreshes, jig updates, cancellation handling, and
1514
+ * cleanup. The method guarantees that temporary UI and event listeners are
1515
+ * torn down no matter how the prompt completes.
1516
+ *
1517
+ * @typeParam T - Value type produced by the prompt
1518
+ * @param options - Configuration describing how the floating prompt should parse,
1519
+ * validate, preview, and commit its value
1520
+ * @returns A promise that resolves with the committed value or rejects on cancel/keyword
682
1521
  */
683
1522
  AcEdInputManager.prototype.makeFloatingInputPromise = function (options) {
684
- var _this = this;
685
- return new Promise(function (resolve, reject) {
686
- _this.active = true;
687
- var validate = function (raw) {
688
- var value = options.handler.parse(raw.x, raw.y);
689
- return {
690
- isValid: value != null,
691
- value: value !== null && value !== void 0 ? value : undefined
692
- };
693
- };
694
- var basePoint = undefined;
695
- if (options.useBasePoint) {
696
- if (options.basePoint) {
697
- basePoint = options.basePoint;
698
- }
699
- else if (_this.lastPoint) {
700
- basePoint = { x: _this.lastPoint.x, y: _this.lastPoint.y };
701
- }
702
- }
703
- _this._commandLine.setPrompt(options.message);
704
- var floatingInput = new AcEdFloatingInput(_this.view, {
705
- parent: _this.view.canvas,
706
- inputCount: options.inputCount,
707
- message: options.message,
708
- disableOSnap: options.disableOSnap,
709
- showBaseLineOnly: options.showBaseLineOnly,
710
- basePoint: basePoint,
711
- validate: validate,
712
- getDynamicValue: options.getDynamicValue,
713
- drawPreview: function (pos) {
714
- var _a;
715
- if (options.jig) {
716
- var defaults = options.getDynamicValue(pos);
717
- options.jig.update(defaults.value);
718
- options.jig.render();
719
- }
720
- (_a = options.drawPreview) === null || _a === void 0 ? void 0 : _a.call(options, pos);
721
- },
722
- onCommit: function (val) {
723
- var result = false;
724
- if (!options.onCommit || options.onCommit(val)) {
725
- resolver(val);
726
- result = true;
727
- }
728
- if (floatingInput.lastPoint) {
729
- _this.lastPoint = {
730
- x: floatingInput.lastPoint.x,
731
- y: floatingInput.lastPoint.y
1523
+ return __awaiter(this, void 0, void 0, function () {
1524
+ var _this = this;
1525
+ return __generator(this, function (_a) {
1526
+ return [2 /*return*/, new Promise(function (resolve, reject) {
1527
+ _this.active = true;
1528
+ _this.entitySelectionActive = false;
1529
+ var settled = false;
1530
+ var validate = function (raw) {
1531
+ var value = options.handler.parse(raw.x, raw.y);
1532
+ return {
1533
+ isValid: value != null,
1534
+ value: value !== null && value !== void 0 ? value : undefined
1535
+ };
732
1536
  };
733
- }
734
- return result;
735
- },
736
- onCancel: function () { return rejector(); }
1537
+ var promptDefaults = _this.resolvePromptDefaults(options.promptOptions);
1538
+ var keywordSession = _this.startKeywordSession(options.promptOptions, true);
1539
+ var basePoint = undefined;
1540
+ if (promptDefaults.useBasePoint) {
1541
+ if (promptDefaults.basePoint) {
1542
+ basePoint = promptDefaults.basePoint;
1543
+ }
1544
+ else if (_this.lastPoint) {
1545
+ basePoint = { x: _this.lastPoint.x, y: _this.lastPoint.y };
1546
+ }
1547
+ }
1548
+ var commandLineMessage = promptDefaults.message;
1549
+ if (!keywordSession) {
1550
+ _this._commandLine.setPrompt(commandLineMessage);
1551
+ }
1552
+ var allowNone = 'allowNone' in options.promptOptions
1553
+ ? options.promptOptions.allowNone
1554
+ : false;
1555
+ var defaultBehavior = _this.resolvePromptDefaultValue(options.promptOptions);
1556
+ var floatingInput = new AcEdFloatingInput(_this.view, {
1557
+ parent: _this.view.canvas,
1558
+ inputCount: options.inputCount,
1559
+ message: promptDefaults.message,
1560
+ disableOSnap: options.disableOSnap,
1561
+ showBaseLineOnly: promptDefaults.showBaseLineOnly,
1562
+ basePoint: basePoint,
1563
+ baseAngle: promptDefaults.baseAngle,
1564
+ allowPrompt: options.allowPrompt !== false,
1565
+ allowNone: allowNone,
1566
+ useDefaultValue: defaultBehavior.useDefaultValue,
1567
+ defaultValue: defaultBehavior.defaultValue,
1568
+ validate: validate,
1569
+ getDynamicValue: options.getDynamicValue,
1570
+ drawPreview: function (pos) {
1571
+ var _a;
1572
+ if (promptDefaults.jig) {
1573
+ var defaults = options.getDynamicValue(pos);
1574
+ promptDefaults.jig.update(defaults.value);
1575
+ promptDefaults.jig.render();
1576
+ }
1577
+ (_a = options.drawPreview) === null || _a === void 0 ? void 0 : _a.call(options, pos);
1578
+ },
1579
+ onCommit: function (val) {
1580
+ var result = false;
1581
+ if (!options.onCommit || options.onCommit(val)) {
1582
+ resolver(val);
1583
+ result = true;
1584
+ }
1585
+ if (floatingInput.lastPoint) {
1586
+ _this.lastPoint = {
1587
+ x: floatingInput.lastPoint.x,
1588
+ y: floatingInput.lastPoint.y
1589
+ };
1590
+ }
1591
+ return result;
1592
+ },
1593
+ onCancel: function () { return rejector(); },
1594
+ onNone: function () { return noneRejector(); }
1595
+ });
1596
+ var cleanup = function () {
1597
+ var _a, _b;
1598
+ if (settled)
1599
+ return;
1600
+ settled = true;
1601
+ _this.active = false;
1602
+ _this.entitySelectionActive = false;
1603
+ (_a = options.cleanup) === null || _a === void 0 ? void 0 : _a.call(options);
1604
+ (_b = promptDefaults.jig) === null || _b === void 0 ? void 0 : _b.end();
1605
+ document.removeEventListener('keydown', escHandler);
1606
+ document.removeEventListener('keydown', modifierHandler);
1607
+ document.removeEventListener('keyup', modifierHandler);
1608
+ _this.view.canvas.removeEventListener('contextmenu', contextMenuHandler);
1609
+ floatingInput.dispose();
1610
+ keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.cancel();
1611
+ _this._commandLine.clear();
1612
+ };
1613
+ var resolver = function (value) {
1614
+ cleanup();
1615
+ resolve(value);
1616
+ };
1617
+ var rejector = function (err) {
1618
+ cleanup();
1619
+ reject(err !== null && err !== void 0 ? err : new Error('cancelled'));
1620
+ };
1621
+ var noneRejector = function () {
1622
+ rejector(new AcEdNoneInputError());
1623
+ };
1624
+ var keywordRejector = function (keyword) {
1625
+ rejector(new AcEdKeywordInputError(keyword));
1626
+ };
1627
+ var escHandler = function (e) {
1628
+ if (e.key === 'Escape') {
1629
+ rejector();
1630
+ }
1631
+ };
1632
+ var modifierHandler = function (e) {
1633
+ var toggled = _this.handleCtrlToggleKey(e);
1634
+ var changed = _this.updateModifierStateFromEvent(e);
1635
+ if (toggled || changed) {
1636
+ floatingInput.requestPreviewRefresh();
1637
+ }
1638
+ };
1639
+ var contextMenuHandler = function (e) {
1640
+ if (!_this.shouldUseRightClickEnter())
1641
+ return;
1642
+ e.preventDefault();
1643
+ noneRejector();
1644
+ };
1645
+ document.addEventListener('keydown', escHandler);
1646
+ document.addEventListener('keydown', modifierHandler);
1647
+ document.addEventListener('keyup', modifierHandler);
1648
+ _this.view.canvas.addEventListener('contextmenu', contextMenuHandler);
1649
+ // showAt() expects viewport coordinates; curMousePos is canvas-local.
1650
+ floatingInput.showAt(_this.view.canvasToViewport(_this.view.curMousePos));
1651
+ keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.promise.then(function (keyword) {
1652
+ if (settled)
1653
+ return;
1654
+ if (!keyword) {
1655
+ rejector();
1656
+ return;
1657
+ }
1658
+ keywordRejector(keyword);
1659
+ });
1660
+ })];
737
1661
  });
738
- var cleanup = function () {
739
- var _a, _b;
740
- _this.active = false;
741
- (_a = options.cleanup) === null || _a === void 0 ? void 0 : _a.call(options);
742
- (_b = options.jig) === null || _b === void 0 ? void 0 : _b.end();
743
- document.removeEventListener('keydown', escHandler);
744
- floatingInput.dispose();
745
- _this._commandLine.clear();
746
- };
747
- var resolver = function (value) {
748
- cleanup();
749
- resolve(value);
750
- };
751
- var rejector = function () {
752
- cleanup();
753
- reject(new Error('cancelled'));
754
- };
755
- var escHandler = function (e) {
756
- if (e.key === 'Escape') {
757
- rejector();
758
- }
759
- };
760
- document.addEventListener('keydown', escHandler);
761
- // showAt() expects viewport coordinates; curMousePos is canvas-local.
762
- floatingInput.showAt(_this.view.canvasToViewport(_this.view.curMousePos));
763
1662
  });
764
1663
  };
765
1664
  /** Inject styles only once */