@mlightcad/cad-simple-viewer 1.4.10 → 1.4.12

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 (309) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +88 -88
  3. package/dist/index.js +21257 -14069
  4. package/dist/index.umd.cjs +201 -76
  5. package/dist/libredwg-parser-worker.js +6604 -12157
  6. package/dist/mtext-renderer-worker.js +28725 -28097
  7. package/lib/app/AcApAnnotation.d.ts.map +1 -1
  8. package/lib/app/AcApAnnotation.js +3 -3
  9. package/lib/app/AcApAnnotation.js.map +1 -1
  10. package/lib/app/AcApContext.d.ts.map +1 -1
  11. package/lib/app/AcApContext.js +3 -3
  12. package/lib/app/AcApContext.js.map +1 -1
  13. package/lib/app/AcApDocManager.d.ts +24 -1
  14. package/lib/app/AcApDocManager.d.ts.map +1 -1
  15. package/lib/app/AcApDocManager.js +67 -12
  16. package/lib/app/AcApDocManager.js.map +1 -1
  17. package/lib/app/AcApDocument.d.ts +6 -0
  18. package/lib/app/AcApDocument.d.ts.map +1 -1
  19. package/lib/app/AcApDocument.js +14 -2
  20. package/lib/app/AcApDocument.js.map +1 -1
  21. package/lib/app/AcApProgress.d.ts.map +1 -1
  22. package/lib/app/AcApProgress.js +3 -3
  23. package/lib/app/AcApProgress.js.map +1 -1
  24. package/lib/app/AcApSettingManager.d.ts.map +1 -1
  25. package/lib/app/AcApSettingManager.js +3 -1
  26. package/lib/app/AcApSettingManager.js.map +1 -1
  27. package/lib/app/AcDbOpenDatabaseOptions.d.ts.map +1 -1
  28. package/lib/command/AcApArcCmd.d.ts +140 -0
  29. package/lib/command/AcApArcCmd.d.ts.map +1 -0
  30. package/lib/command/AcApArcCmd.js +1009 -0
  31. package/lib/command/AcApArcCmd.js.map +1 -0
  32. package/lib/command/AcApCircleCmd.d.ts.map +1 -1
  33. package/lib/command/AcApCircleCmd.js +10 -4
  34. package/lib/command/AcApCircleCmd.js.map +1 -1
  35. package/lib/command/AcApClearMeasurementsCmd.d.ts +13 -0
  36. package/lib/command/AcApClearMeasurementsCmd.d.ts.map +1 -0
  37. package/lib/command/AcApClearMeasurementsCmd.js +84 -0
  38. package/lib/command/AcApClearMeasurementsCmd.js.map +1 -0
  39. package/lib/command/AcApConvertToDxfCmd.d.ts +9 -0
  40. package/lib/command/AcApConvertToDxfCmd.d.ts.map +1 -0
  41. package/lib/command/AcApConvertToDxfCmd.js +75 -0
  42. package/lib/command/AcApConvertToDxfCmd.js.map +1 -0
  43. package/lib/command/AcApDimLinearCmd.d.ts.map +1 -1
  44. package/lib/command/AcApDimLinearCmd.js +14 -5
  45. package/lib/command/AcApDimLinearCmd.js.map +1 -1
  46. package/lib/command/AcApDxfConvertor.d.ts +12 -0
  47. package/lib/command/AcApDxfConvertor.d.ts.map +1 -0
  48. package/lib/command/AcApDxfConvertor.js +37 -0
  49. package/lib/command/AcApDxfConvertor.js.map +1 -0
  50. package/lib/command/AcApEraseCmd.d.ts.map +1 -1
  51. package/lib/command/AcApEraseCmd.js +10 -6
  52. package/lib/command/AcApEraseCmd.js.map +1 -1
  53. package/lib/command/AcApLineCmd.d.ts.map +1 -1
  54. package/lib/command/AcApLineCmd.js +10 -4
  55. package/lib/command/AcApLineCmd.js.map +1 -1
  56. package/lib/command/AcApLogCmd.js +3 -3
  57. package/lib/command/AcApLogCmd.js.map +1 -1
  58. package/lib/command/AcApMTextCmd.d.ts +12 -0
  59. package/lib/command/AcApMTextCmd.d.ts.map +1 -0
  60. package/lib/command/AcApMTextCmd.js +123 -0
  61. package/lib/command/AcApMTextCmd.js.map +1 -0
  62. package/lib/command/AcApMeasureAngleCmd.d.ts +15 -0
  63. package/lib/command/AcApMeasureAngleCmd.d.ts.map +1 -0
  64. package/lib/command/AcApMeasureAngleCmd.js +369 -0
  65. package/lib/command/AcApMeasureAngleCmd.js.map +1 -0
  66. package/lib/command/AcApMeasureArcCmd.d.ts +25 -0
  67. package/lib/command/AcApMeasureArcCmd.d.ts.map +1 -0
  68. package/lib/command/AcApMeasureArcCmd.js +429 -0
  69. package/lib/command/AcApMeasureArcCmd.js.map +1 -0
  70. package/lib/command/AcApMeasureAreaCmd.d.ts +21 -0
  71. package/lib/command/AcApMeasureAreaCmd.d.ts.map +1 -0
  72. package/lib/command/AcApMeasureAreaCmd.js +387 -0
  73. package/lib/command/AcApMeasureAreaCmd.js.map +1 -0
  74. package/lib/command/AcApMeasureDistanceCmd.d.ts +34 -0
  75. package/lib/command/AcApMeasureDistanceCmd.d.ts.map +1 -0
  76. package/lib/command/AcApMeasureDistanceCmd.js +191 -0
  77. package/lib/command/AcApMeasureDistanceCmd.js.map +1 -0
  78. package/lib/command/AcApPolylineCmd.d.ts +71 -0
  79. package/lib/command/AcApPolylineCmd.d.ts.map +1 -0
  80. package/lib/command/AcApPolylineCmd.js +569 -0
  81. package/lib/command/AcApPolylineCmd.js.map +1 -0
  82. package/lib/command/AcApRectCmd.d.ts.map +1 -1
  83. package/lib/command/AcApRectCmd.js +10 -4
  84. package/lib/command/AcApRectCmd.js.map +1 -1
  85. package/lib/command/AcApRevCloudCmd.d.ts.map +1 -1
  86. package/lib/command/AcApRevCloudCmd.js +10 -4
  87. package/lib/command/AcApRevCloudCmd.js.map +1 -1
  88. package/lib/command/AcApSketchCmd.d.ts.map +1 -1
  89. package/lib/command/AcApSketchCmd.js +11 -7
  90. package/lib/command/AcApSketchCmd.js.map +1 -1
  91. package/lib/command/AcApSplineCmd.d.ts +20 -0
  92. package/lib/command/AcApSplineCmd.d.ts.map +1 -0
  93. package/lib/command/AcApSplineCmd.js +213 -0
  94. package/lib/command/AcApSplineCmd.js.map +1 -0
  95. package/lib/command/AcApSwitchBgCmd.js +2 -2
  96. package/lib/command/AcApSwitchBgCmd.js.map +1 -1
  97. package/lib/command/AcApSysVarCmd.d.ts.map +1 -1
  98. package/lib/command/AcApSysVarCmd.js +20 -7
  99. package/lib/command/AcApSysVarCmd.js.map +1 -1
  100. package/lib/command/AcApZoomToBoxCmd.d.ts +1 -1
  101. package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -1
  102. package/lib/command/AcApZoomToBoxCmd.js +10 -5
  103. package/lib/command/AcApZoomToBoxCmd.js.map +1 -1
  104. package/lib/command/index.d.ts +11 -0
  105. package/lib/command/index.d.ts.map +1 -1
  106. package/lib/command/index.js +11 -0
  107. package/lib/command/index.js.map +1 -1
  108. package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -1
  109. package/lib/editor/command/AcEdCommandIterator.js.map +1 -1
  110. package/lib/editor/global/AcEdConditionWaiter.d.ts +1 -1
  111. package/lib/editor/global/AcEdConditionWaiter.d.ts.map +1 -1
  112. package/lib/editor/global/AcEdConditionWaiter.js +3 -2
  113. package/lib/editor/global/AcEdConditionWaiter.js.map +1 -1
  114. package/lib/editor/global/AcEdUiTheme.d.ts +4 -0
  115. package/lib/editor/global/AcEdUiTheme.d.ts.map +1 -0
  116. package/lib/editor/global/AcEdUiTheme.js +44 -0
  117. package/lib/editor/global/AcEdUiTheme.js.map +1 -0
  118. package/lib/editor/global/index.d.ts +1 -0
  119. package/lib/editor/global/index.d.ts.map +1 -1
  120. package/lib/editor/global/index.js +1 -0
  121. package/lib/editor/global/index.js.map +1 -1
  122. package/lib/editor/input/AcEdCursorManager.d.ts +10 -0
  123. package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
  124. package/lib/editor/input/AcEdCursorManager.js +26 -6
  125. package/lib/editor/input/AcEdCursorManager.js.map +1 -1
  126. package/lib/editor/input/AcEdInputModifiers.d.ts +39 -0
  127. package/lib/editor/input/AcEdInputModifiers.d.ts.map +1 -0
  128. package/lib/editor/input/AcEdInputModifiers.js +2 -0
  129. package/lib/editor/input/AcEdInputModifiers.js.map +1 -0
  130. package/lib/editor/input/AcEdInputToggles.d.ts +24 -0
  131. package/lib/editor/input/AcEdInputToggles.d.ts.map +1 -0
  132. package/lib/editor/input/AcEdInputToggles.js +2 -0
  133. package/lib/editor/input/AcEdInputToggles.js.map +1 -0
  134. package/lib/editor/input/AcEdPromptStateMachine.d.ts +110 -0
  135. package/lib/editor/input/AcEdPromptStateMachine.d.ts.map +1 -0
  136. package/lib/editor/input/AcEdPromptStateMachine.js +147 -0
  137. package/lib/editor/input/AcEdPromptStateMachine.js.map +1 -0
  138. package/lib/editor/input/AcEditor.d.ts +58 -9
  139. package/lib/editor/input/AcEditor.d.ts.map +1 -1
  140. package/lib/editor/input/AcEditor.js +98 -3
  141. package/lib/editor/input/AcEditor.js.map +1 -1
  142. package/lib/editor/input/index.d.ts +3 -0
  143. package/lib/editor/input/index.d.ts.map +1 -1
  144. package/lib/editor/input/index.js +3 -0
  145. package/lib/editor/input/index.js.map +1 -1
  146. package/lib/editor/input/marker/AcEdMarker.d.ts.map +1 -1
  147. package/lib/editor/input/marker/AcEdMarker.js +3 -3
  148. package/lib/editor/input/marker/AcEdMarker.js.map +1 -1
  149. package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts.map +1 -1
  150. package/lib/editor/input/prompt/AcEdKeywordCollection.js +11 -4
  151. package/lib/editor/input/prompt/AcEdKeywordCollection.js.map +1 -1
  152. package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts +1 -1
  153. package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts.map +1 -1
  154. package/lib/editor/input/prompt/AcEdPromptAngleOptions.js +2 -2
  155. package/lib/editor/input/prompt/AcEdPromptAngleOptions.js.map +1 -1
  156. package/lib/editor/input/prompt/AcEdPromptBoxOptions.d.ts +20 -0
  157. package/lib/editor/input/prompt/AcEdPromptBoxOptions.d.ts.map +1 -0
  158. package/lib/editor/input/prompt/AcEdPromptBoxOptions.js +80 -0
  159. package/lib/editor/input/prompt/AcEdPromptBoxOptions.js.map +1 -0
  160. package/lib/editor/input/prompt/AcEdPromptBoxResult.d.ts +12 -0
  161. package/lib/editor/input/prompt/AcEdPromptBoxResult.d.ts.map +1 -0
  162. package/lib/editor/input/prompt/AcEdPromptBoxResult.js +30 -0
  163. package/lib/editor/input/prompt/AcEdPromptBoxResult.js.map +1 -0
  164. package/lib/editor/input/prompt/AcEdPromptDoubleResult.d.ts +9 -0
  165. package/lib/editor/input/prompt/AcEdPromptDoubleResult.d.ts.map +1 -0
  166. package/lib/editor/input/prompt/AcEdPromptDoubleResult.js +28 -0
  167. package/lib/editor/input/prompt/AcEdPromptDoubleResult.js.map +1 -0
  168. package/lib/editor/input/prompt/AcEdPromptEntityOptions.d.ts +1 -1
  169. package/lib/editor/input/prompt/AcEdPromptEntityOptions.d.ts.map +1 -1
  170. package/lib/editor/input/prompt/AcEdPromptEntityOptions.js +2 -2
  171. package/lib/editor/input/prompt/AcEdPromptEntityOptions.js.map +1 -1
  172. package/lib/editor/input/prompt/AcEdPromptEntityResult.d.ts +14 -0
  173. package/lib/editor/input/prompt/AcEdPromptEntityResult.d.ts.map +1 -0
  174. package/lib/editor/input/prompt/AcEdPromptEntityResult.js +31 -0
  175. package/lib/editor/input/prompt/AcEdPromptEntityResult.js.map +1 -0
  176. package/lib/editor/input/prompt/AcEdPromptIntegerResult.d.ts +9 -0
  177. package/lib/editor/input/prompt/AcEdPromptIntegerResult.d.ts.map +1 -0
  178. package/lib/editor/input/prompt/AcEdPromptIntegerResult.js +28 -0
  179. package/lib/editor/input/prompt/AcEdPromptIntegerResult.js.map +1 -0
  180. package/lib/editor/input/prompt/AcEdPromptKeywordOptions.d.ts +1 -1
  181. package/lib/editor/input/prompt/AcEdPromptKeywordOptions.d.ts.map +1 -1
  182. package/lib/editor/input/prompt/AcEdPromptKeywordOptions.js +2 -2
  183. package/lib/editor/input/prompt/AcEdPromptKeywordOptions.js.map +1 -1
  184. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts +1 -1
  185. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts.map +1 -1
  186. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js +2 -2
  187. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js.map +1 -1
  188. package/lib/editor/input/prompt/AcEdPromptOptions.d.ts +3 -2
  189. package/lib/editor/input/prompt/AcEdPromptOptions.d.ts.map +1 -1
  190. package/lib/editor/input/prompt/AcEdPromptOptions.js +15 -4
  191. package/lib/editor/input/prompt/AcEdPromptOptions.js.map +1 -1
  192. package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts +1 -1
  193. package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts.map +1 -1
  194. package/lib/editor/input/prompt/AcEdPromptPointOptions.js +2 -2
  195. package/lib/editor/input/prompt/AcEdPromptPointOptions.js.map +1 -1
  196. package/lib/editor/input/prompt/AcEdPromptPointResult.d.ts +3 -3
  197. package/lib/editor/input/prompt/AcEdPromptSelectionOptions.d.ts +1 -1
  198. package/lib/editor/input/prompt/AcEdPromptSelectionOptions.d.ts.map +1 -1
  199. package/lib/editor/input/prompt/AcEdPromptSelectionOptions.js +2 -2
  200. package/lib/editor/input/prompt/AcEdPromptSelectionOptions.js.map +1 -1
  201. package/lib/editor/input/prompt/AcEdPromptSelectionResult.d.ts +12 -0
  202. package/lib/editor/input/prompt/AcEdPromptSelectionResult.d.ts.map +1 -0
  203. package/lib/editor/input/prompt/AcEdPromptSelectionResult.js +30 -0
  204. package/lib/editor/input/prompt/AcEdPromptSelectionResult.js.map +1 -0
  205. package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts +1 -1
  206. package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts.map +1 -1
  207. package/lib/editor/input/prompt/AcEdPromptStringOptions.js +2 -2
  208. package/lib/editor/input/prompt/AcEdPromptStringOptions.js.map +1 -1
  209. package/lib/editor/input/prompt/index.d.ts +10 -0
  210. package/lib/editor/input/prompt/index.d.ts.map +1 -1
  211. package/lib/editor/input/prompt/index.js +10 -0
  212. package/lib/editor/input/prompt/index.js.map +1 -1
  213. package/lib/editor/input/session/AcEdKeywordSession.d.ts +2 -1
  214. package/lib/editor/input/session/AcEdKeywordSession.d.ts.map +1 -1
  215. package/lib/editor/input/session/AcEdKeywordSession.js +7 -1
  216. package/lib/editor/input/session/AcEdKeywordSession.js.map +1 -1
  217. package/lib/editor/input/ui/AcEdCommandLine.d.ts +4 -1
  218. package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
  219. package/lib/editor/input/ui/AcEdCommandLine.js +34 -5
  220. package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
  221. package/lib/editor/input/ui/AcEdFloatingInput.d.ts +23 -1
  222. package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -1
  223. package/lib/editor/input/ui/AcEdFloatingInput.js +140 -26
  224. package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -1
  225. package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts +2 -0
  226. package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts.map +1 -1
  227. package/lib/editor/input/ui/AcEdFloatingInputBox.js +4 -0
  228. package/lib/editor/input/ui/AcEdFloatingInputBox.js.map +1 -1
  229. package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts +7 -0
  230. package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts.map +1 -1
  231. package/lib/editor/input/ui/AcEdFloatingInputBoxes.js +14 -6
  232. package/lib/editor/input/ui/AcEdFloatingInputBoxes.js.map +1 -1
  233. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +5 -0
  234. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -1
  235. package/lib/editor/input/ui/AcEdFloatingMessage.d.ts +12 -0
  236. package/lib/editor/input/ui/AcEdFloatingMessage.d.ts.map +1 -1
  237. package/lib/editor/input/ui/AcEdFloatingMessage.js +61 -2
  238. package/lib/editor/input/ui/AcEdFloatingMessage.js.map +1 -1
  239. package/lib/editor/input/ui/AcEdInputManager.d.ts +47 -13
  240. package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
  241. package/lib/editor/input/ui/AcEdInputManager.js +854 -389
  242. package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
  243. package/lib/editor/input/ui/AcEdMTextEditor.d.ts +79 -0
  244. package/lib/editor/input/ui/AcEdMTextEditor.d.ts.map +1 -0
  245. package/lib/editor/input/ui/AcEdMTextEditor.js +157 -0
  246. package/lib/editor/input/ui/AcEdMTextEditor.js.map +1 -0
  247. package/lib/editor/input/ui/AcEdRubberBand.js +1 -1
  248. package/lib/editor/input/ui/AcEdRubberBand.js.map +1 -1
  249. package/lib/editor/input/ui/index.d.ts +2 -0
  250. package/lib/editor/input/ui/index.d.ts.map +1 -1
  251. package/lib/editor/input/ui/index.js +1 -0
  252. package/lib/editor/input/ui/index.js.map +1 -1
  253. package/lib/editor/view/AcEdBaseView.d.ts +81 -0
  254. package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
  255. package/lib/editor/view/AcEdBaseView.js +173 -1
  256. package/lib/editor/view/AcEdBaseView.js.map +1 -1
  257. package/lib/editor/view/AcEdSpatialQueryResult.d.ts.map +1 -1
  258. package/lib/i18n/en/command.d.ts +21 -0
  259. package/lib/i18n/en/command.d.ts.map +1 -1
  260. package/lib/i18n/en/command.js +21 -0
  261. package/lib/i18n/en/command.js.map +1 -1
  262. package/lib/i18n/en/jig.d.ts +131 -0
  263. package/lib/i18n/en/jig.d.ts.map +1 -1
  264. package/lib/i18n/en/jig.js +131 -0
  265. package/lib/i18n/en/jig.js.map +1 -1
  266. package/lib/i18n/zh/command.d.ts +21 -0
  267. package/lib/i18n/zh/command.d.ts.map +1 -1
  268. package/lib/i18n/zh/command.js +21 -0
  269. package/lib/i18n/zh/command.js.map +1 -1
  270. package/lib/i18n/zh/jig.d.ts +131 -0
  271. package/lib/i18n/zh/jig.d.ts.map +1 -1
  272. package/lib/i18n/zh/jig.js +131 -0
  273. package/lib/i18n/zh/jig.js.map +1 -1
  274. package/lib/index.d.ts +2 -0
  275. package/lib/index.d.ts.map +1 -1
  276. package/lib/index.js +1 -0
  277. package/lib/index.js.map +1 -1
  278. package/lib/plugin/AcApPluginExample.d.ts.map +1 -1
  279. package/lib/plugin/AcApPluginExample.js +7 -6
  280. package/lib/plugin/AcApPluginExample.js.map +1 -1
  281. package/lib/plugin/AcApPluginManager.d.ts +4 -4
  282. package/lib/plugin/AcApPluginManager.d.ts.map +1 -1
  283. package/lib/plugin/AcApPluginManager.js +7 -6
  284. package/lib/plugin/AcApPluginManager.js.map +1 -1
  285. package/lib/util/AcApMeasurementElementGenerator.d.ts +36 -0
  286. package/lib/util/AcApMeasurementElementGenerator.d.ts.map +1 -0
  287. package/lib/util/AcApMeasurementElementGenerator.js +92 -0
  288. package/lib/util/AcApMeasurementElementGenerator.js.map +1 -0
  289. package/lib/util/index.d.ts +1 -0
  290. package/lib/util/index.d.ts.map +1 -1
  291. package/lib/util/index.js +1 -0
  292. package/lib/util/index.js.map +1 -1
  293. package/lib/view/AcTrLayout.d.ts +14 -0
  294. package/lib/view/AcTrLayout.d.ts.map +1 -1
  295. package/lib/view/AcTrLayout.js +21 -0
  296. package/lib/view/AcTrLayout.js.map +1 -1
  297. package/lib/view/AcTrLayoutView.d.ts +11 -0
  298. package/lib/view/AcTrLayoutView.d.ts.map +1 -1
  299. package/lib/view/AcTrLayoutView.js +30 -0
  300. package/lib/view/AcTrLayoutView.js.map +1 -1
  301. package/lib/view/AcTrScene.d.ts +7 -1
  302. package/lib/view/AcTrScene.d.ts.map +1 -1
  303. package/lib/view/AcTrScene.js +16 -2
  304. package/lib/view/AcTrScene.js.map +1 -1
  305. package/lib/view/AcTrView2d.d.ts +16 -1
  306. package/lib/view/AcTrView2d.d.ts.map +1 -1
  307. package/lib/view/AcTrView2d.js +145 -56
  308. package/lib/view/AcTrView2d.js.map +1 -1
  309. package/package.json +10 -9
@@ -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) {
@@ -73,12 +88,22 @@ var __values = (this && this.__values) || function(o) {
73
88
  import { AcGeBox2d } from '@mlightcad/data-model';
74
89
  import { 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
+ var AcEdKeywordInputError = /** @class */ (function (_super) {
99
+ __extends(AcEdKeywordInputError, _super);
100
+ function AcEdKeywordInputError(keyword) {
101
+ var _this = _super.call(this, 'keyword') || this;
102
+ _this.keyword = keyword;
103
+ return _this;
104
+ }
105
+ return AcEdKeywordInputError;
106
+ }(Error));
82
107
  /**
83
108
  * A fully type-safe TypeScript class providing CAD-style interactive user input
84
109
  * using floating HTML input boxes and mouse events. Supports collecting points,
@@ -98,11 +123,25 @@ var AcEdInputManager = /** @class */ (function () {
98
123
  this.lastPoint = null;
99
124
  /** Buffered command-line style inputs (each item is one Enter-confirmed value). */
100
125
  this._scriptInputs = [];
126
+ /** Current modifier key state during input sessions. */
127
+ this._modifierState = {
128
+ ctrlKey: false,
129
+ shiftKey: false,
130
+ altKey: false,
131
+ metaKey: false
132
+ };
133
+ /** Toggle-style Ctrl flip state (press Ctrl once to flip arc direction). */
134
+ this._ctrlArcFlip = false;
101
135
  /**
102
136
  * The flag to indicate whether it is currently in an “input acquisition” mode (e.g., point
103
137
  * selection, distance/angle prompt, string prompt, etc.),
104
138
  */
105
139
  this.active = false;
140
+ /**
141
+ * True only when the current input session explicitly expects entity selection
142
+ * (getEntity/getSelection). Used to gate view-level selection behavior.
143
+ */
144
+ this.entitySelectionActive = false;
106
145
  this.view = view;
107
146
  this.injectCSS();
108
147
  // Newly added UI overlays (command line, previews) are container-local.
@@ -129,6 +168,40 @@ var AcEdInputManager = /** @class */ (function () {
129
168
  enumerable: false,
130
169
  configurable: true
131
170
  });
171
+ Object.defineProperty(AcEdInputManager.prototype, "isEntitySelectionActive", {
172
+ /**
173
+ * Whether current input session allows entity selection in the view.
174
+ */
175
+ get: function () {
176
+ return this.entitySelectionActive;
177
+ },
178
+ enumerable: false,
179
+ configurable: true
180
+ });
181
+ Object.defineProperty(AcEdInputManager.prototype, "modifiers", {
182
+ /**
183
+ * Current modifier key state (Ctrl/Shift/Alt/Meta) during input sessions.
184
+ */
185
+ get: function () {
186
+ return this._modifierState;
187
+ },
188
+ enumerable: false,
189
+ configurable: true
190
+ });
191
+ Object.defineProperty(AcEdInputManager.prototype, "toggles", {
192
+ /**
193
+ * Toggle-style input states (press once to flip, persists after keyup).
194
+ */
195
+ get: function () {
196
+ return { ctrlArcFlip: this._ctrlArcFlip };
197
+ },
198
+ enumerable: false,
199
+ configurable: true
200
+ });
201
+ /** Reset toggle-style inputs to their default state. */
202
+ AcEdInputManager.prototype.resetToggles = function () {
203
+ this._ctrlArcFlip = false;
204
+ };
132
205
  /**
133
206
  * Queue scripted inputs for subsequent getXXX calls.
134
207
  * One array item equals one Enter-confirmed value.
@@ -152,7 +225,7 @@ var AcEdInputManager = /** @class */ (function () {
152
225
  return;
153
226
  AcEdInputManager.stylesInjected = true;
154
227
  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 ";
228
+ 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
229
  document.head.appendChild(style);
157
230
  };
158
231
  /**
@@ -171,15 +244,77 @@ var AcEdInputManager = /** @class */ (function () {
171
244
  return value.toFixed(3);
172
245
  }
173
246
  };
247
+ AcEdInputManager.prototype.hasKeywords = function (options) {
248
+ var _a, _b;
249
+ var keywords = (_b = (_a = options.keywords) === null || _a === void 0 ? void 0 : _a.toArray()) !== null && _b !== void 0 ? _b : [];
250
+ return keywords.length > 0;
251
+ };
252
+ AcEdInputManager.prototype.buildKeywordOptions = function (options) {
253
+ var _a, _b;
254
+ var keywordOptions = new AcEdPromptKeywordOptions(options.message);
255
+ keywordOptions.appendKeywordsToMessage = options.appendKeywordsToMessage;
256
+ var keywords = (_b = (_a = options.keywords) === null || _a === void 0 ? void 0 : _a.toArray()) !== null && _b !== void 0 ? _b : [];
257
+ keywords.forEach(function (kw) {
258
+ var added = keywordOptions.keywords.add(kw.displayName, kw.globalName, kw.localName, kw.enabled, kw.visible);
259
+ if (options.keywords.default === kw) {
260
+ keywordOptions.keywords.default = added;
261
+ }
262
+ });
263
+ return keywordOptions;
264
+ };
265
+ AcEdInputManager.prototype.copyKeywords = function (source, target) {
266
+ var _a, _b;
267
+ target.appendKeywordsToMessage = source.appendKeywordsToMessage;
268
+ var keywords = (_b = (_a = source.keywords) === null || _a === void 0 ? void 0 : _a.toArray()) !== null && _b !== void 0 ? _b : [];
269
+ keywords.forEach(function (kw) {
270
+ var added = target.keywords.add(kw.displayName, kw.globalName, kw.localName, kw.enabled, kw.visible);
271
+ if (source.keywords.default === kw) {
272
+ target.keywords.default = added;
273
+ }
274
+ });
275
+ };
276
+ AcEdInputManager.prototype.startKeywordSession = function (options, allowTyping) {
277
+ var _this = this;
278
+ if (!this.hasKeywords(options))
279
+ return undefined;
280
+ var keywordOptions = this.buildKeywordOptions(options);
281
+ return {
282
+ promise: this._commandLine.getKeywords(keywordOptions, allowTyping),
283
+ cancel: function () { return _this._commandLine.cancelActiveSession(); }
284
+ };
285
+ };
286
+ AcEdInputManager.prototype.isPromptKeyword = function (error) {
287
+ return error instanceof AcEdKeywordInputError;
288
+ };
174
289
  /**
175
290
  * Public point input API.
176
291
  */
177
292
  AcEdInputManager.prototype.getPoint = function (options) {
178
- var scriptedValue = this.tryGetScriptedPoint(options);
179
- if (scriptedValue != null) {
180
- return Promise.resolve(scriptedValue);
181
- }
182
- return this.getPointInternal(options);
293
+ return __awaiter(this, void 0, void 0, function () {
294
+ var value, error_1, result;
295
+ return __generator(this, function (_a) {
296
+ switch (_a.label) {
297
+ case 0:
298
+ _a.trys.push([0, 2, , 3]);
299
+ return [4 /*yield*/, this.getPointInternal(options)];
300
+ case 1:
301
+ value = _a.sent();
302
+ return [2 /*return*/, new AcEdPromptPointResult(AcEdPromptStatus.OK, value)];
303
+ case 2:
304
+ error_1 = _a.sent();
305
+ if (this.isPromptCancelled(error_1)) {
306
+ return [2 /*return*/, new AcEdPromptPointResult(AcEdPromptStatus.Cancel)];
307
+ }
308
+ if (this.isPromptKeyword(error_1)) {
309
+ result = new AcEdPromptPointResult(AcEdPromptStatus.Keyword);
310
+ result.stringResult = error_1.keyword;
311
+ return [2 /*return*/, result];
312
+ }
313
+ throw error_1;
314
+ case 3: return [2 /*return*/];
315
+ }
316
+ });
317
+ });
183
318
  };
184
319
  /**
185
320
  * Prompt the user to type a numeric value. If integerOnly is true, integers
@@ -194,141 +329,256 @@ var AcEdInputManager = /** @class */ (function () {
194
329
  };
195
330
  };
196
331
  return this.makeFloatingInputPromise({
197
- message: options.message,
198
332
  inputCount: 1,
199
- jig: options.jig,
200
- showBaseLineOnly: false,
201
- useBasePoint: false,
333
+ promptOptions: options,
202
334
  handler: handler,
203
335
  getDynamicValue: getDynamicValue
204
336
  });
205
337
  };
206
338
  /** Request a distance (number) from the user. */
207
339
  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
340
+ return __awaiter(this, void 0, void 0, function () {
341
+ var handler, scriptedValue, value_1, getDynamicValue, value, error_2, result;
342
+ var _this = this;
343
+ return __generator(this, function (_a) {
344
+ switch (_a.label) {
345
+ case 0:
346
+ handler = new AcEdDistanceHandler(options);
347
+ scriptedValue = this.tryGetScriptedNumber(handler);
348
+ if (scriptedValue != null) {
349
+ return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, scriptedValue)];
350
+ }
351
+ _a.label = 1;
352
+ case 1:
353
+ _a.trys.push([1, 5, , 6]);
354
+ if (!!this.lastPoint) return [3 /*break*/, 3];
355
+ return [4 /*yield*/, this.getNumberTyped(options, handler)];
356
+ case 2:
357
+ value_1 = _a.sent();
358
+ return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value_1)];
359
+ case 3:
360
+ getDynamicValue = function (pos) {
361
+ var dx = pos.x - _this.lastPoint.x;
362
+ var dy = pos.y - _this.lastPoint.y;
363
+ var dist = Math.sqrt(dx * dx + dy * dy);
364
+ return {
365
+ value: dist,
366
+ raw: { x: _this.formatNumber(dist, 'distance') }
367
+ };
368
+ };
369
+ return [4 /*yield*/, this.makeFloatingInputPromise({
370
+ inputCount: 1,
371
+ promptOptions: options,
372
+ handler: handler,
373
+ getDynamicValue: getDynamicValue
374
+ })];
375
+ case 4:
376
+ value = _a.sent();
377
+ return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value)];
378
+ case 5:
379
+ error_2 = _a.sent();
380
+ if (this.isPromptCancelled(error_2)) {
381
+ return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.Cancel)];
382
+ }
383
+ if (this.isPromptKeyword(error_2)) {
384
+ result = new AcEdPromptDoubleResult(AcEdPromptStatus.Keyword);
385
+ result.stringResult = error_2.keyword;
386
+ return [2 /*return*/, result];
387
+ }
388
+ throw error_2;
389
+ case 6: return [2 /*return*/];
390
+ }
391
+ });
237
392
  });
238
393
  };
239
394
  /** Request an angle in degrees from the user. */
240
395
  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
396
+ return __awaiter(this, void 0, void 0, function () {
397
+ var handler, scriptedValue, getDynamicValue, value, error_3, result;
398
+ var _this = this;
399
+ return __generator(this, function (_a) {
400
+ switch (_a.label) {
401
+ case 0:
402
+ handler = new AcEdAngleHandler(options);
403
+ scriptedValue = this.tryGetScriptedNumber(handler);
404
+ if (scriptedValue != null) {
405
+ return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, scriptedValue)];
406
+ }
407
+ getDynamicValue = function (pos) {
408
+ var dx = pos.x - _this.lastPoint.x;
409
+ var dy = pos.y - _this.lastPoint.y;
410
+ var angleRad = Math.atan2(dy, dx);
411
+ var angleDeg = (angleRad * 180) / Math.PI;
412
+ return {
413
+ value: angleDeg,
414
+ raw: { x: _this.formatNumber(angleDeg, 'angle') }
415
+ };
416
+ };
417
+ _a.label = 1;
418
+ case 1:
419
+ _a.trys.push([1, 3, , 4]);
420
+ return [4 /*yield*/, this.makeFloatingInputPromise({
421
+ inputCount: 1,
422
+ promptOptions: options,
423
+ handler: handler,
424
+ getDynamicValue: getDynamicValue
425
+ })];
426
+ case 2:
427
+ value = _a.sent();
428
+ return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value)];
429
+ case 3:
430
+ error_3 = _a.sent();
431
+ if (this.isPromptCancelled(error_3)) {
432
+ return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.Cancel)];
433
+ }
434
+ if (this.isPromptKeyword(error_3)) {
435
+ result = new AcEdPromptDoubleResult(AcEdPromptStatus.Keyword);
436
+ result.stringResult = error_3.keyword;
437
+ return [2 /*return*/, result];
438
+ }
439
+ throw error_3;
440
+ case 4: return [2 /*return*/];
441
+ }
442
+ });
266
443
  });
267
444
  };
268
445
  /** Request a double/float from the user. */
269
446
  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));
447
+ return __awaiter(this, void 0, void 0, function () {
448
+ var handler, scriptedValue, value, error_4, result;
449
+ return __generator(this, function (_a) {
450
+ switch (_a.label) {
451
+ case 0:
452
+ handler = new AcEdDoubleHandler(options);
453
+ scriptedValue = this.tryGetScriptedNumber(handler);
454
+ if (scriptedValue != null) {
455
+ return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, scriptedValue)];
456
+ }
457
+ _a.label = 1;
458
+ case 1:
459
+ _a.trys.push([1, 3, , 4]);
460
+ return [4 /*yield*/, this.getNumberTyped(options, handler)];
461
+ case 2:
462
+ value = _a.sent();
463
+ return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.OK, value)];
464
+ case 3:
465
+ error_4 = _a.sent();
466
+ if (this.isPromptCancelled(error_4)) {
467
+ return [2 /*return*/, new AcEdPromptDoubleResult(AcEdPromptStatus.Cancel)];
468
+ }
469
+ if (this.isPromptKeyword(error_4)) {
470
+ result = new AcEdPromptDoubleResult(AcEdPromptStatus.Keyword);
471
+ result.stringResult = error_4.keyword;
472
+ return [2 /*return*/, result];
473
+ }
474
+ throw error_4;
475
+ case 4: return [2 /*return*/];
476
+ }
477
+ });
478
+ });
275
479
  };
276
480
  /** Request an integer from the user. */
277
481
  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));
482
+ return __awaiter(this, void 0, void 0, function () {
483
+ var scriptedValue, value, error_5, result;
484
+ return __generator(this, function (_a) {
485
+ switch (_a.label) {
486
+ case 0:
487
+ scriptedValue = this.tryGetScriptedNumber(new AcEdIntegerHandler(options));
488
+ if (scriptedValue != null) {
489
+ return [2 /*return*/, new AcEdPromptIntegerResult(AcEdPromptStatus.OK, scriptedValue)];
490
+ }
491
+ _a.label = 1;
492
+ case 1:
493
+ _a.trys.push([1, 3, , 4]);
494
+ return [4 /*yield*/, this.getNumberTyped(options, new AcEdIntegerHandler(options))];
495
+ case 2:
496
+ value = _a.sent();
497
+ return [2 /*return*/, new AcEdPromptIntegerResult(AcEdPromptStatus.OK, value)];
498
+ case 3:
499
+ error_5 = _a.sent();
500
+ if (this.isPromptCancelled(error_5)) {
501
+ return [2 /*return*/, new AcEdPromptIntegerResult(AcEdPromptStatus.Cancel)];
502
+ }
503
+ if (this.isPromptKeyword(error_5)) {
504
+ result = new AcEdPromptIntegerResult(AcEdPromptStatus.Keyword);
505
+ result.stringResult = error_5.keyword;
506
+ return [2 /*return*/, result];
507
+ }
508
+ throw error_5;
509
+ case 4: return [2 /*return*/];
510
+ }
511
+ });
512
+ });
283
513
  };
284
514
  /**
285
515
  * Prompt the user to type an arbitrary string. Resolved when Enter is pressed.
286
516
  */
287
517
  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
518
+ return __awaiter(this, void 0, void 0, function () {
519
+ var scriptedValue, getDynamicValue, handler, value, error_6;
520
+ return __generator(this, function (_a) {
521
+ switch (_a.label) {
522
+ case 0:
523
+ scriptedValue = this.tryGetScriptedValue(new AcEdStringHandler(options));
524
+ if (scriptedValue != null) {
525
+ return [2 /*return*/, new AcEdPromptResult(AcEdPromptStatus.OK, scriptedValue)];
526
+ }
527
+ _a.label = 1;
528
+ case 1:
529
+ _a.trys.push([1, 3, , 4]);
530
+ getDynamicValue = function () {
531
+ return {
532
+ value: '',
533
+ raw: { x: '' }
534
+ };
535
+ };
536
+ handler = new AcEdStringHandler(options);
537
+ return [4 /*yield*/, this.makeFloatingInputPromise({
538
+ inputCount: 1,
539
+ promptOptions: options,
540
+ handler: handler,
541
+ getDynamicValue: getDynamicValue
542
+ })];
543
+ case 2:
544
+ value = _a.sent();
545
+ return [2 /*return*/, new AcEdPromptResult(AcEdPromptStatus.OK, value)];
546
+ case 3:
547
+ error_6 = _a.sent();
548
+ if (this.isPromptCancelled(error_6)) {
549
+ return [2 /*return*/, new AcEdPromptResult(AcEdPromptStatus.Cancel)];
550
+ }
551
+ if (this.isPromptKeyword(error_6)) {
552
+ return [2 /*return*/, new AcEdPromptResult(AcEdPromptStatus.Keyword, error_6.keyword)];
553
+ }
554
+ throw error_6;
555
+ case 4: return [2 /*return*/];
556
+ }
557
+ });
307
558
  });
308
559
  };
309
560
  /**
310
561
  * Prompt the user to type a keyword. Resolved when Enter is pressed.
311
562
  */
312
563
  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
564
+ return __awaiter(this, void 0, void 0, function () {
565
+ var scriptedValue, result;
566
+ return __generator(this, function (_a) {
567
+ switch (_a.label) {
568
+ case 0:
569
+ scriptedValue = this.tryGetScriptedValue(new AcEdKeywordHandler(options));
570
+ if (scriptedValue != null) {
571
+ return [2 /*return*/, Promise.resolve(scriptedValue)];
572
+ }
573
+ return [4 /*yield*/, this._commandLine.getKeywords(options, true)];
574
+ case 1:
575
+ result = _a.sent();
576
+ if (!result) {
577
+ throw new Error('cancelled');
578
+ }
579
+ return [2 /*return*/, result];
580
+ }
581
+ });
332
582
  });
333
583
  };
334
584
  /**
@@ -337,8 +587,9 @@ var AcEdInputManager = /** @class */ (function () {
337
587
  * This method supports two selection modes:
338
588
  *
339
589
  * - **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.
590
+ * - **Box selection**:
591
+ * - left-to-right drag: window selection (entities fully inside the box)
592
+ * - right-to-left drag: crossing selection (entities intersecting the box)
342
593
  *
343
594
  * The selection operation behaves similarly to AutoCAD's
344
595
  * `Editor.GetSelection()` API:
@@ -360,113 +611,176 @@ var AcEdInputManager = /** @class */ (function () {
360
611
  */
361
612
  AcEdInputManager.prototype.getSelection = function (options) {
362
613
  return __awaiter(this, void 0, void 0, function () {
614
+ var value, error_7;
363
615
  var _this = this;
364
616
  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;
391
- }
392
- if (e.key === 'Enter') {
393
- 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")
419
- });
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) {
617
+ switch (_a.label) {
618
+ case 0:
619
+ _a.trys.push([0, 2, , 3]);
620
+ return [4 /*yield*/, new Promise(function (resolve, reject) {
621
+ _this.active = true;
622
+ _this.entitySelectionActive = true;
623
+ var keywordSession = _this.startKeywordSession(options, true);
624
+ if (!keywordSession) {
625
+ _this._commandLine.setPrompt(options.message);
626
+ }
627
+ var floatingMessage = new AcEdFloatingMessage(_this.view, {
628
+ parent: _this.view.canvas,
629
+ message: options.message
630
+ });
631
+ var selected = new Set();
632
+ var startWcs = null;
633
+ var startCanvas = null;
634
+ var previewEl = null;
635
+ var settled = false;
636
+ var cleanup = function () {
637
+ if (settled)
638
+ return;
639
+ settled = true;
640
+ _this.active = false;
641
+ _this.entitySelectionActive = false;
642
+ floatingMessage === null || floatingMessage === void 0 ? void 0 : floatingMessage.dispose();
643
+ previewEl === null || previewEl === void 0 ? void 0 : previewEl.remove();
644
+ keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.cancel();
645
+ _this._commandLine.clear();
646
+ document.removeEventListener('keydown', keyHandler);
647
+ _this.view.canvas.removeEventListener('mousedown', mouseDown);
648
+ _this.view.canvas.removeEventListener('mousemove', mouseMove);
649
+ _this.view.canvas.removeEventListener('mouseup', mouseUp);
650
+ };
651
+ keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.promise.then(function (keyword) {
652
+ if (settled)
653
+ return;
654
+ if (!keyword) {
655
+ cleanup();
656
+ reject(new Error('cancelled'));
657
+ return;
658
+ }
659
+ cleanup();
660
+ reject(new AcEdKeywordInputError(keyword));
661
+ });
662
+ /** ---------- Keyboard ---------- */
663
+ var keyHandler = function (e) {
664
+ if (e.key === 'Escape') {
665
+ cleanup();
666
+ reject(new Error('cancelled'));
667
+ return;
668
+ }
669
+ if (e.key === 'Enter') {
435
670
  cleanup();
436
671
  resolve(__spreadArray([], __read(selected), false));
437
672
  }
438
- }
439
- }
440
- else {
441
- // Box selection
442
- var box = new AcGeBox2d()
443
- .expandByPoint(startWcs)
444
- .expandByPoint(endWcs);
445
- _this.view.selectByBox(box);
446
- try {
447
- for (var _b = __values(_this.view.selectionSet.ids), _c = _b.next(); !_c.done; _c = _b.next()) {
448
- var id = _c.value;
449
- selected.add(id);
450
- if (options.singleOnly)
451
- break;
673
+ };
674
+ /** ---------- Mouse ---------- */
675
+ var mouseDown = function (e) {
676
+ startCanvas = _this.view.viewportToCanvas({
677
+ x: e.clientX,
678
+ y: e.clientY
679
+ });
680
+ startWcs = _this.view.screenToWorld(startCanvas);
681
+ previewEl = document.createElement('div');
682
+ previewEl.className = 'ml-jig-preview-rect';
683
+ _this.view.container.appendChild(previewEl);
684
+ };
685
+ var mouseMove = function (e) {
686
+ if (!startWcs || !previewEl || !startCanvas)
687
+ return;
688
+ var curWcs = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
689
+ var curCanvas = _this.view.viewportToCanvas({
690
+ x: e.clientX,
691
+ y: e.clientY
692
+ });
693
+ var p1 = _this.view.worldToScreen(startWcs);
694
+ var p2 = _this.view.worldToScreen(curWcs);
695
+ var left = Math.min(p1.x, p2.x);
696
+ var top = Math.min(p1.y, p2.y);
697
+ var width = Math.abs(p1.x - p2.x);
698
+ var height = Math.abs(p1.y - p2.y);
699
+ var mode = _this.view.getSelectionMode(startCanvas, curCanvas);
700
+ var action = _this.view.getSelectionActionFromEvent(e, 'add');
701
+ var style = _this.view.getSelectionPreviewStyle(mode, action);
702
+ Object.assign(previewEl.style, {
703
+ left: "".concat(left, "px"),
704
+ top: "".concat(top, "px"),
705
+ width: "".concat(width, "px"),
706
+ height: "".concat(height, "px"),
707
+ borderStyle: style.borderStyle,
708
+ background: style.background
709
+ });
710
+ previewEl.style.setProperty('--line-color', style.lineColor);
711
+ };
712
+ var mouseUp = function (e) {
713
+ var e_1, _a;
714
+ if (!startWcs || !startCanvas)
715
+ return;
716
+ var endWcs = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
717
+ var endCanvas = _this.view.viewportToCanvas({
718
+ x: e.clientX,
719
+ y: e.clientY
720
+ });
721
+ previewEl === null || previewEl === void 0 ? void 0 : previewEl.remove();
722
+ previewEl = null;
723
+ // Click selection
724
+ var action = _this.view.getSelectionActionFromEvent(e, 'add');
725
+ if (_this.view.isSelectionClick(startCanvas, endCanvas)) {
726
+ var picked = _this.view.pick(endWcs);
727
+ if (picked.length > 0) {
728
+ _this.view.applySelection([picked[0].id], action);
729
+ }
730
+ else if (action === 'replace') {
731
+ _this.view.selectionSet.clear();
732
+ }
452
733
  }
453
- }
454
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
455
- finally {
734
+ else {
735
+ // Box selection
736
+ var box = new AcGeBox2d()
737
+ .expandByPoint(startWcs)
738
+ .expandByPoint(endWcs);
739
+ var mode = _this.view.getSelectionMode(startCanvas, endCanvas);
740
+ _this.view.selectByBoxWithMode(box, mode, action);
741
+ }
742
+ selected.clear();
456
743
  try {
457
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
744
+ for (var _b = __values(_this.view.selectionSet.ids), _c = _b.next(); !_c.done; _c = _b.next()) {
745
+ var id = _c.value;
746
+ selected.add(id);
747
+ }
458
748
  }
459
- finally { if (e_1) throw e_1.error; }
460
- }
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
- })];
749
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
750
+ finally {
751
+ try {
752
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
753
+ }
754
+ finally { if (e_1) throw e_1.error; }
755
+ }
756
+ if (options.singleOnly && action !== 'remove') {
757
+ if (selected.size > 0) {
758
+ cleanup();
759
+ resolve(__spreadArray([], __read(selected), false));
760
+ }
761
+ }
762
+ startWcs = null;
763
+ startCanvas = null;
764
+ };
765
+ document.addEventListener('keydown', keyHandler);
766
+ _this.view.canvas.addEventListener('mousedown', mouseDown);
767
+ _this.view.canvas.addEventListener('mousemove', mouseMove);
768
+ _this.view.canvas.addEventListener('mouseup', mouseUp);
769
+ })];
770
+ case 1:
771
+ value = _a.sent();
772
+ return [2 /*return*/, new AcEdPromptSelectionResult(AcEdPromptStatus.OK, new AcEdSelectionSet(value))];
773
+ case 2:
774
+ error_7 = _a.sent();
775
+ if (this.isPromptCancelled(error_7)) {
776
+ return [2 /*return*/, new AcEdPromptSelectionResult(AcEdPromptStatus.Cancel)];
777
+ }
778
+ if (this.isPromptKeyword(error_7)) {
779
+ return [2 /*return*/, new AcEdPromptSelectionResult(AcEdPromptStatus.Keyword, undefined, error_7.keyword)];
780
+ }
781
+ throw error_7;
782
+ case 3: return [2 /*return*/];
783
+ }
470
784
  });
471
785
  });
472
786
  };
@@ -475,59 +789,104 @@ var AcEdInputManager = /** @class */ (function () {
475
789
  * Similar to Editor.GetEntity() in AutoCAD.
476
790
  */
477
791
  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
484
- });
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);
792
+ return __awaiter(this, void 0, void 0, function () {
793
+ var value, error_8, result;
794
+ var _this = this;
795
+ return __generator(this, function (_a) {
796
+ switch (_a.label) {
797
+ case 0:
798
+ _a.trys.push([0, 2, , 3]);
799
+ return [4 /*yield*/, new Promise(function (resolve, reject) {
800
+ _this.active = true;
801
+ _this.entitySelectionActive = true;
802
+ var keywordSession = _this.startKeywordSession(options, true);
803
+ var floatingMessage = new AcEdFloatingMessage(_this.view, {
804
+ parent: _this.view.canvas,
805
+ message: options.message
806
+ });
807
+ if (!keywordSession) {
808
+ _this._commandLine.setPrompt(options.message);
809
+ }
810
+ var settled = false;
811
+ var cleanup = function () {
812
+ var _a;
813
+ if (settled)
814
+ return;
815
+ settled = true;
816
+ _this.active = false;
817
+ _this.entitySelectionActive = false;
818
+ (_a = options.jig) === null || _a === void 0 ? void 0 : _a.end();
819
+ document.removeEventListener('keydown', keyHandler);
820
+ _this.view.canvas.removeEventListener('mousedown', clickHandler);
821
+ floatingMessage === null || floatingMessage === void 0 ? void 0 : floatingMessage.dispose();
822
+ keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.cancel();
823
+ _this._commandLine.clear();
824
+ };
825
+ keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.promise.then(function (keyword) {
826
+ if (settled)
827
+ return;
828
+ if (!keyword) {
829
+ cleanup();
830
+ reject(new Error('cancelled'));
831
+ return;
832
+ }
833
+ cleanup();
834
+ reject(new AcEdKeywordInputError(keyword));
835
+ });
836
+ /** Mouse click → try select entity */
837
+ var clickHandler = function (e) {
838
+ var pos = _this.view.screenToWorld(_this.view.viewportToCanvas({ x: e.clientX, y: e.clientY }));
839
+ var picked = _this.view.pick(pos);
840
+ // Clicked empty space
841
+ if (picked.length == 0) {
842
+ // this.view.showMessage(options.rejectMessage)
843
+ return;
844
+ }
845
+ // Locked layer
846
+ // if (picked.locked && !options.allowObjectOnLockedLayer) {
847
+ // this.view.showMessage(options.rejectMessage)
848
+ // return
849
+ // }
850
+ // Class filter
851
+ // if (!options.isClassAllowed(picked.className)) {
852
+ // this.view.showMessage(options.rejectMessage)
853
+ // return
854
+ // }
855
+ cleanup();
856
+ resolve(picked[0].id);
857
+ };
858
+ /** Keyboard handling */
859
+ var keyHandler = function (e) {
860
+ if (e.key === 'Escape') {
861
+ cleanup();
862
+ reject(new Error('cancelled'));
863
+ return;
864
+ }
865
+ if (e.key === 'Enter' && options.allowNone) {
866
+ cleanup();
867
+ resolve(null);
868
+ }
869
+ };
870
+ document.addEventListener('keydown', keyHandler);
871
+ _this.view.canvas.addEventListener('mousedown', clickHandler);
872
+ })];
873
+ case 1:
874
+ value = _a.sent();
875
+ return [2 /*return*/, new AcEdPromptEntityResult(AcEdPromptStatus.OK, value || undefined)];
876
+ case 2:
877
+ error_8 = _a.sent();
878
+ if (this.isPromptCancelled(error_8)) {
879
+ return [2 /*return*/, new AcEdPromptEntityResult(AcEdPromptStatus.Cancel)];
880
+ }
881
+ if (this.isPromptKeyword(error_8)) {
882
+ result = new AcEdPromptEntityResult(AcEdPromptStatus.Keyword);
883
+ result.stringResult = error_8.keyword;
884
+ return [2 /*return*/, result];
885
+ }
886
+ throw error_8;
887
+ case 3: return [2 /*return*/];
527
888
  }
528
- };
529
- document.addEventListener('keydown', keyHandler);
530
- _this.view.canvas.addEventListener('mousedown', clickHandler);
889
+ });
531
890
  });
532
891
  };
533
892
  /**
@@ -535,48 +894,68 @@ var AcEdInputManager = /** @class */ (function () {
535
894
  * Each corner may be specified by clicking on the canvas or typing "x,y".
536
895
  * A live HTML overlay rectangle previews the box as the user moves the mouse.
537
896
  */
538
- AcEdInputManager.prototype.getBox = function () {
897
+ AcEdInputManager.prototype.getBox = function (options) {
539
898
  return __awaiter(this, void 0, void 0, function () {
540
- var message1, options1, p1, cwcsP1, previewEl, cleanup, drawPreview, message2, options2, p2;
899
+ var message1, options1, p1Result, p1, cwcsP1_1, previewEl_1, cleanup, drawPreview, message2, options2, p2, box, error_9;
541
900
  var _this = this;
542
901
  return __generator(this, function (_a) {
543
902
  switch (_a.label) {
544
903
  case 0:
545
- message1 = AcApI18n.t('main.inputManager.firstCorner');
904
+ _a.trys.push([0, 3, , 4]);
905
+ message1 = options.firstCornerMessage ||
906
+ AcApI18n.t('main.inputManager.firstCorner');
546
907
  options1 = new AcEdPromptPointOptions(message1);
547
- options1.useDashedLine = false;
548
- options1.useBasePoint = false;
908
+ this.copyKeywords(options, options1);
909
+ options1.useDashedLine = options.useDashedLine;
910
+ options1.useBasePoint = options.useBasePoint;
549
911
  return [4 /*yield*/, this.getPoint(options1)];
550
912
  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);
913
+ p1Result = _a.sent();
914
+ if (p1Result.status !== AcEdPromptStatus.OK) {
915
+ return [2 /*return*/, new AcEdPromptBoxResult(p1Result.status, undefined, p1Result.stringResult)];
916
+ }
917
+ p1 = p1Result.value;
918
+ cwcsP1_1 = this.view.worldToScreen(p1);
919
+ previewEl_1 = document.createElement('div');
920
+ previewEl_1.className = 'ml-jig-preview-rect';
921
+ this.view.container.appendChild(previewEl_1);
556
922
  cleanup = function () {
557
- previewEl.remove();
923
+ previewEl_1.remove();
558
924
  };
559
925
  drawPreview = function (pos) {
560
926
  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, {
927
+ var left = Math.min(cwcsP2.x, cwcsP1_1.x);
928
+ var top = Math.min(cwcsP2.y, cwcsP1_1.y);
929
+ var width = Math.abs(cwcsP2.x - cwcsP1_1.x);
930
+ var height = Math.abs(cwcsP2.y - cwcsP1_1.y);
931
+ Object.assign(previewEl_1.style, {
566
932
  left: "".concat(left, "px"),
567
933
  top: "".concat(top, "px"),
568
934
  width: "".concat(width, "px"),
569
935
  height: "".concat(height, "px")
570
936
  });
571
937
  };
572
- message2 = AcApI18n.t('main.inputManager.secondCorner');
938
+ message2 = options.secondCornerMessage ||
939
+ AcApI18n.t('main.inputManager.secondCorner');
573
940
  options2 = new AcEdPromptPointOptions(message2);
574
- options2.useDashedLine = false;
575
- options2.useBasePoint = false;
941
+ this.copyKeywords(options, options2);
942
+ options2.useDashedLine = options.useDashedLine;
943
+ options2.useBasePoint = options.useBasePoint;
576
944
  return [4 /*yield*/, this.getPointInternal(options2, cleanup, drawPreview)];
577
945
  case 2:
578
946
  p2 = _a.sent();
579
- return [2 /*return*/, new AcGeBox2d().expandByPoint(p1).expandByPoint(p2)];
947
+ box = new AcGeBox2d().expandByPoint(p1).expandByPoint(p2);
948
+ return [2 /*return*/, new AcEdPromptBoxResult(AcEdPromptStatus.OK, box)];
949
+ case 3:
950
+ error_9 = _a.sent();
951
+ if (this.isPromptCancelled(error_9)) {
952
+ return [2 /*return*/, new AcEdPromptBoxResult(AcEdPromptStatus.Cancel)];
953
+ }
954
+ if (this.isPromptKeyword(error_9)) {
955
+ return [2 /*return*/, new AcEdPromptBoxResult(AcEdPromptStatus.Keyword, undefined, error_9.keyword)];
956
+ }
957
+ throw error_9;
958
+ case 4: return [2 /*return*/];
580
959
  }
581
960
  });
582
961
  });
@@ -586,33 +965,34 @@ var AcEdInputManager = /** @class */ (function () {
586
965
  * typed input OR mouse click.
587
966
  */
588
967
  AcEdInputManager.prototype.getPointInternal = function (options, cleanup, drawPreview) {
589
- var _this = this;
590
- var scriptedValue = this.tryGetScriptedPoint(options);
591
- if (scriptedValue != null) {
592
- cleanup === null || cleanup === void 0 ? void 0 : cleanup();
593
- return Promise.resolve(scriptedValue);
594
- }
595
- var getDynamicValue = function (pos) {
596
- return {
597
- value: { x: pos.x, y: pos.y, z: 0 },
598
- raw: {
599
- x: _this.formatNumber(pos.x, 'point'),
600
- y: _this.formatNumber(pos.y, 'point')
968
+ return __awaiter(this, void 0, void 0, function () {
969
+ var scriptedValue, getDynamicValue, handler;
970
+ var _this = this;
971
+ return __generator(this, function (_a) {
972
+ scriptedValue = this.tryGetScriptedPoint(options);
973
+ if (scriptedValue != null) {
974
+ cleanup === null || cleanup === void 0 ? void 0 : cleanup();
975
+ return [2 /*return*/, Promise.resolve(scriptedValue)];
601
976
  }
602
- };
603
- };
604
- var handler = new AcEdPointHandler(options);
605
- return this.makeFloatingInputPromise({
606
- message: options.message,
607
- inputCount: 2,
608
- jig: options.jig,
609
- showBaseLineOnly: !options.useDashedLine,
610
- useBasePoint: options.useBasePoint,
611
- basePoint: options.basePoint,
612
- cleanup: cleanup,
613
- handler: handler,
614
- getDynamicValue: getDynamicValue,
615
- drawPreview: drawPreview
977
+ getDynamicValue = function (pos) {
978
+ return {
979
+ value: { x: pos.x, y: pos.y, z: 0 },
980
+ raw: {
981
+ x: _this.formatNumber(pos.x, 'point'),
982
+ y: _this.formatNumber(pos.y, 'point')
983
+ }
984
+ };
985
+ };
986
+ handler = new AcEdPointHandler(options);
987
+ return [2 /*return*/, this.makeFloatingInputPromise({
988
+ inputCount: 2,
989
+ promptOptions: options,
990
+ cleanup: cleanup,
991
+ handler: handler,
992
+ getDynamicValue: getDynamicValue,
993
+ drawPreview: drawPreview
994
+ })];
995
+ });
616
996
  });
617
997
  };
618
998
  /**
@@ -672,6 +1052,34 @@ var AcEdInputManager = /** @class */ (function () {
672
1052
  return undefined;
673
1053
  return { x: parts[0], y: parts[1] };
674
1054
  };
1055
+ AcEdInputManager.prototype.isPromptCancelled = function (error) {
1056
+ return error instanceof Error && error.message === 'cancelled';
1057
+ };
1058
+ AcEdInputManager.prototype.updateModifierStateFromEvent = function (e) {
1059
+ var next = {
1060
+ ctrlKey: !!e.ctrlKey,
1061
+ shiftKey: !!e.shiftKey,
1062
+ altKey: !!e.altKey,
1063
+ metaKey: !!e.metaKey
1064
+ };
1065
+ var prev = this._modifierState;
1066
+ var changed = prev.ctrlKey !== next.ctrlKey ||
1067
+ prev.shiftKey !== next.shiftKey ||
1068
+ prev.altKey !== next.altKey ||
1069
+ prev.metaKey !== next.metaKey;
1070
+ if (changed) {
1071
+ this._modifierState = next;
1072
+ }
1073
+ return changed;
1074
+ };
1075
+ AcEdInputManager.prototype.handleCtrlToggleKey = function (e) {
1076
+ if (e.key !== 'Control' || e.repeat)
1077
+ return false;
1078
+ if (e.type !== 'keydown')
1079
+ return false;
1080
+ this._ctrlArcFlip = !this._ctrlArcFlip;
1081
+ return true;
1082
+ };
675
1083
  /**
676
1084
  * Creates a promise for floating input that will be resolved or rejected by user input.
677
1085
  *
@@ -679,86 +1087,143 @@ var AcEdInputManager = /** @class */ (function () {
679
1087
  * including handling the Escape key to cancel, resolving with user-provided
680
1088
  * values, and guaranteeing cleanup of UI elements and event handlers.
681
1089
  */
1090
+ AcEdInputManager.prototype.resolvePromptDefaults = function (options) {
1091
+ var hasBasePoint = 'basePoint' in options;
1092
+ var hasUseBasePoint = 'useBasePoint' in options;
1093
+ var hasUseDashedLine = 'useDashedLine' in options;
1094
+ var basePoint = hasBasePoint && options.basePoint
1095
+ ? options.basePoint
1096
+ : undefined;
1097
+ var useBasePoint = hasUseBasePoint ? options.useBasePoint : false;
1098
+ var showBaseLineOnly = hasUseDashedLine ? !options.useDashedLine : false;
1099
+ return {
1100
+ message: options.message,
1101
+ jig: options.jig,
1102
+ basePoint: basePoint,
1103
+ useBasePoint: useBasePoint,
1104
+ showBaseLineOnly: showBaseLineOnly
1105
+ };
1106
+ };
682
1107
  AcEdInputManager.prototype.makeFloatingInputPromise = function (options) {
683
- var _this = this;
684
- return new Promise(function (resolve, reject) {
685
- _this.active = true;
686
- var validate = function (raw) {
687
- var value = options.handler.parse(raw.x, raw.y);
688
- return {
689
- isValid: value != null,
690
- value: value !== null && value !== void 0 ? value : undefined
691
- };
692
- };
693
- var basePoint = undefined;
694
- if (options.useBasePoint) {
695
- if (options.basePoint) {
696
- basePoint = options.basePoint;
697
- }
698
- else if (_this.lastPoint) {
699
- basePoint = { x: _this.lastPoint.x, y: _this.lastPoint.y };
700
- }
701
- }
702
- _this._commandLine.setPrompt(options.message);
703
- var floatingInput = new AcEdFloatingInput(_this.view, {
704
- parent: _this.view.canvas,
705
- inputCount: options.inputCount,
706
- message: options.message,
707
- disableOSnap: options.disableOSnap,
708
- showBaseLineOnly: options.showBaseLineOnly,
709
- basePoint: basePoint,
710
- validate: validate,
711
- getDynamicValue: options.getDynamicValue,
712
- drawPreview: function (pos) {
713
- var _a;
714
- if (options.jig) {
715
- var defaults = options.getDynamicValue(pos);
716
- options.jig.update(defaults.value);
717
- options.jig.render();
718
- }
719
- (_a = options.drawPreview) === null || _a === void 0 ? void 0 : _a.call(options, pos);
720
- },
721
- onCommit: function (val) {
722
- var result = false;
723
- if (!options.onCommit || options.onCommit(val)) {
724
- resolver(val);
725
- result = true;
726
- }
727
- if (floatingInput.lastPoint) {
728
- _this.lastPoint = {
729
- x: floatingInput.lastPoint.x,
730
- y: floatingInput.lastPoint.y
1108
+ return __awaiter(this, void 0, void 0, function () {
1109
+ var _this = this;
1110
+ return __generator(this, function (_a) {
1111
+ return [2 /*return*/, new Promise(function (resolve, reject) {
1112
+ _this.active = true;
1113
+ _this.entitySelectionActive = false;
1114
+ var settled = false;
1115
+ var validate = function (raw) {
1116
+ var value = options.handler.parse(raw.x, raw.y);
1117
+ return {
1118
+ isValid: value != null,
1119
+ value: value !== null && value !== void 0 ? value : undefined
1120
+ };
1121
+ };
1122
+ var promptDefaults = _this.resolvePromptDefaults(options.promptOptions);
1123
+ var keywordSession = _this.startKeywordSession(options.promptOptions, true);
1124
+ var basePoint = undefined;
1125
+ if (promptDefaults.useBasePoint) {
1126
+ if (promptDefaults.basePoint) {
1127
+ basePoint = promptDefaults.basePoint;
1128
+ }
1129
+ else if (_this.lastPoint) {
1130
+ basePoint = { x: _this.lastPoint.x, y: _this.lastPoint.y };
1131
+ }
1132
+ }
1133
+ var commandLineMessage = promptDefaults.message;
1134
+ if (!keywordSession) {
1135
+ _this._commandLine.setPrompt(commandLineMessage);
1136
+ }
1137
+ var floatingInput = new AcEdFloatingInput(_this.view, {
1138
+ parent: _this.view.canvas,
1139
+ inputCount: options.inputCount,
1140
+ message: promptDefaults.message,
1141
+ disableOSnap: options.disableOSnap,
1142
+ showBaseLineOnly: promptDefaults.showBaseLineOnly,
1143
+ basePoint: basePoint,
1144
+ allowPrompt: options.allowPrompt !== false,
1145
+ validate: validate,
1146
+ getDynamicValue: options.getDynamicValue,
1147
+ drawPreview: function (pos) {
1148
+ var _a;
1149
+ if (promptDefaults.jig) {
1150
+ var defaults = options.getDynamicValue(pos);
1151
+ promptDefaults.jig.update(defaults.value);
1152
+ promptDefaults.jig.render();
1153
+ }
1154
+ (_a = options.drawPreview) === null || _a === void 0 ? void 0 : _a.call(options, pos);
1155
+ },
1156
+ onCommit: function (val) {
1157
+ var result = false;
1158
+ if (!options.onCommit || options.onCommit(val)) {
1159
+ resolver(val);
1160
+ result = true;
1161
+ }
1162
+ if (floatingInput.lastPoint) {
1163
+ _this.lastPoint = {
1164
+ x: floatingInput.lastPoint.x,
1165
+ y: floatingInput.lastPoint.y
1166
+ };
1167
+ }
1168
+ return result;
1169
+ },
1170
+ onCancel: function () { return rejector(); }
1171
+ });
1172
+ var cleanup = function () {
1173
+ var _a, _b;
1174
+ if (settled)
1175
+ return;
1176
+ settled = true;
1177
+ _this.active = false;
1178
+ _this.entitySelectionActive = false;
1179
+ (_a = options.cleanup) === null || _a === void 0 ? void 0 : _a.call(options);
1180
+ (_b = promptDefaults.jig) === null || _b === void 0 ? void 0 : _b.end();
1181
+ document.removeEventListener('keydown', escHandler);
1182
+ document.removeEventListener('keydown', modifierHandler);
1183
+ document.removeEventListener('keyup', modifierHandler);
1184
+ floatingInput.dispose();
1185
+ keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.cancel();
1186
+ _this._commandLine.clear();
1187
+ };
1188
+ var resolver = function (value) {
1189
+ cleanup();
1190
+ resolve(value);
731
1191
  };
732
- }
733
- return result;
734
- },
735
- onCancel: function () { return rejector(); }
1192
+ var rejector = function (err) {
1193
+ cleanup();
1194
+ reject(err !== null && err !== void 0 ? err : new Error('cancelled'));
1195
+ };
1196
+ var keywordRejector = function (keyword) {
1197
+ rejector(new AcEdKeywordInputError(keyword));
1198
+ };
1199
+ var escHandler = function (e) {
1200
+ if (e.key === 'Escape') {
1201
+ rejector();
1202
+ }
1203
+ };
1204
+ var modifierHandler = function (e) {
1205
+ var toggled = _this.handleCtrlToggleKey(e);
1206
+ var changed = _this.updateModifierStateFromEvent(e);
1207
+ if (toggled || changed) {
1208
+ floatingInput.requestPreviewRefresh();
1209
+ }
1210
+ };
1211
+ document.addEventListener('keydown', escHandler);
1212
+ document.addEventListener('keydown', modifierHandler);
1213
+ document.addEventListener('keyup', modifierHandler);
1214
+ // showAt() expects viewport coordinates; curMousePos is canvas-local.
1215
+ floatingInput.showAt(_this.view.canvasToViewport(_this.view.curMousePos));
1216
+ keywordSession === null || keywordSession === void 0 ? void 0 : keywordSession.promise.then(function (keyword) {
1217
+ if (settled)
1218
+ return;
1219
+ if (!keyword) {
1220
+ rejector();
1221
+ return;
1222
+ }
1223
+ keywordRejector(keyword);
1224
+ });
1225
+ })];
736
1226
  });
737
- var cleanup = function () {
738
- var _a, _b;
739
- _this.active = false;
740
- (_a = options.cleanup) === null || _a === void 0 ? void 0 : _a.call(options);
741
- (_b = options.jig) === null || _b === void 0 ? void 0 : _b.end();
742
- document.removeEventListener('keydown', escHandler);
743
- floatingInput.dispose();
744
- _this._commandLine.clear();
745
- };
746
- var resolver = function (value) {
747
- cleanup();
748
- resolve(value);
749
- };
750
- var rejector = function () {
751
- cleanup();
752
- reject(new Error('cancelled'));
753
- };
754
- var escHandler = function (e) {
755
- if (e.key === 'Escape') {
756
- rejector();
757
- }
758
- };
759
- document.addEventListener('keydown', escHandler);
760
- // showAt() expects viewport coordinates; curMousePos is canvas-local.
761
- floatingInput.showAt(_this.view.canvasToViewport(_this.view.curMousePos));
762
1227
  });
763
1228
  };
764
1229
  /** Inject styles only once */