@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
@@ -0,0 +1,1009 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ var __generator = (this && this.__generator) || function (thisArg, body) {
26
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
27
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
+ function verb(n) { return function (v) { return step([n, v]); }; }
29
+ function step(op) {
30
+ if (f) throw new TypeError("Generator is already executing.");
31
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
32
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
+ if (y = 0, t) op = [op[0] & 2, t.value];
34
+ switch (op[0]) {
35
+ case 0: case 1: t = op; break;
36
+ case 4: _.label++; return { value: op[1], done: false };
37
+ case 5: _.label++; y = op[1]; op = [0]; continue;
38
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
+ default:
40
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
+ if (t[2]) _.ops.pop();
45
+ _.trys.pop(); continue;
46
+ }
47
+ op = body.call(thisArg, _);
48
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
+ }
51
+ };
52
+ import { AcDbArc, AcGePoint3d } from '@mlightcad/data-model';
53
+ import { AcApDocManager } from '../app';
54
+ import { AcEdCommand, AcEdOpenMode, AcEdPreviewJig, AcEdPromptDistanceOptions, AcEdPromptDoubleOptions, AcEdPromptPointOptions, AcEdPromptStatus, eventBus } from '../editor';
55
+ import { AcApI18n } from '../i18n';
56
+ var TAU = Math.PI * 2;
57
+ var EPSILON = 1e-9;
58
+ var POSITIVE_NORMAL = { x: 0, y: 0, z: 1 };
59
+ var NEGATIVE_NORMAL = { x: 0, y: 0, z: -1 };
60
+ /**
61
+ * Normalizes an angle to the range [0, 2π).
62
+ *
63
+ * @param angle - Input angle in radians.
64
+ * @returns Normalized angle in radians.
65
+ */
66
+ function normalizeAngle(angle) {
67
+ var value = angle % TAU;
68
+ return value >= 0 ? value : value + TAU;
69
+ }
70
+ /**
71
+ * Computes Euclidean distance in XY plane.
72
+ *
73
+ * @param p1 - First point.
74
+ * @param p2 - Second point.
75
+ * @returns 2D distance between points.
76
+ */
77
+ function distance2d(p1, p2) {
78
+ return Math.hypot(p2.x - p1.x, p2.y - p1.y);
79
+ }
80
+ /**
81
+ * Computes point angle around a center under a given arc orientation.
82
+ *
83
+ * For `normalSign = -1` (clockwise), the Y component is mirrored so that
84
+ * angle growth still follows the selected arc direction convention.
85
+ *
86
+ * @param center - Arc center.
87
+ * @param point - Point on the arc/circle.
88
+ * @param normalSign - Arc orientation sign (+Z / -Z).
89
+ * @returns Direction-aware normalized angle in radians.
90
+ */
91
+ function angleByNormalSign(center, point, normalSign) {
92
+ // For -Z arcs, mirror Y so the angle still increases in the arc direction.
93
+ var dx = point.x - center.x;
94
+ var dy = point.y - center.y;
95
+ var raw = normalSign === 1 ? Math.atan2(dy, dx) : Math.atan2(-dy, dx);
96
+ return normalizeAngle(raw);
97
+ }
98
+ /**
99
+ * Maps orientation sign to 3D normal vector.
100
+ *
101
+ * @param sign - Orientation sign.
102
+ * @returns Unit normal vector used by `AcDbArc`.
103
+ */
104
+ function toNormal(sign) {
105
+ return sign === 1 ? POSITIVE_NORMAL : NEGATIVE_NORMAL;
106
+ }
107
+ /**
108
+ * Creates one `AcDbArc` entity from normalized arc definition data.
109
+ *
110
+ * @param definition - Arc definition (center/radius/angles/orientation).
111
+ * @returns New arc entity instance.
112
+ */
113
+ function createArcEntity(definition) {
114
+ return new AcDbArc(definition.center, definition.radius, definition.startAngle, definition.endAngle, toNormal(definition.normalSign));
115
+ }
116
+ /**
117
+ * Applies arc definition fields onto an existing `AcDbArc`.
118
+ *
119
+ * Used by the preview jig to update transient geometry without recreating
120
+ * entity instances on each mouse-move.
121
+ *
122
+ * @param entity - Target arc entity to mutate.
123
+ * @param definition - Source definition values.
124
+ */
125
+ function applyArcDefinition(entity, definition) {
126
+ entity.center = definition.center;
127
+ entity.radius = definition.radius;
128
+ entity.startAngle = definition.startAngle;
129
+ entity.endAngle = definition.endAngle;
130
+ entity.normal = toNormal(definition.normalSign);
131
+ }
132
+ /**
133
+ * Creates a tiny placeholder arc used before valid preview geometry exists.
134
+ *
135
+ * @param point - Seed location for fallback arc center.
136
+ * @returns Minimal valid arc definition.
137
+ */
138
+ function createFallbackArc(point) {
139
+ return {
140
+ center: { x: point.x, y: point.y, z: 0 },
141
+ radius: 1e-6,
142
+ startAngle: 0,
143
+ endAngle: Math.PI / 2,
144
+ normalSign: 1
145
+ };
146
+ }
147
+ /**
148
+ * Projects an arbitrary point radially onto a circle.
149
+ *
150
+ * @param center - Circle center.
151
+ * @param radius - Circle radius.
152
+ * @param point - Input point to project.
153
+ * @returns Projected point on circle, or `undefined` when projection fails.
154
+ */
155
+ function projectPointToCircle(center, radius, point) {
156
+ var dx = point.x - center.x;
157
+ var dy = point.y - center.y;
158
+ var distance = Math.hypot(dx, dy);
159
+ if (distance <= EPSILON)
160
+ return undefined;
161
+ var scale = radius / distance;
162
+ return {
163
+ x: center.x + dx * scale,
164
+ y: center.y + dy * scale,
165
+ z: 0
166
+ };
167
+ }
168
+ /**
169
+ * Tests whether `mid` lies on the forward sweep from `start` to `end`.
170
+ *
171
+ * All angles are treated as normalized radians in [0, 2π).
172
+ *
173
+ * @param start - Sweep start angle.
174
+ * @param mid - Candidate angle to test.
175
+ * @param end - Sweep end angle.
176
+ * @returns `true` if `mid` is on the sweep.
177
+ */
178
+ function isAngleOnSweep(start, mid, end) {
179
+ var total = normalizeAngle(end - start);
180
+ var offset = normalizeAngle(mid - start);
181
+ return offset <= total + 1e-7;
182
+ }
183
+ /**
184
+ * Chooses arc orientation for 3-point input so the sweep passes the second point.
185
+ *
186
+ * @param center - Computed circumcenter.
187
+ * @param start - Arc start point.
188
+ * @param second - Point-on-arc (the AutoCAD "second point").
189
+ * @param end - Arc end point.
190
+ * @returns Orientation sign producing the intended 3-point arc.
191
+ */
192
+ function chooseThreePointNormalSign(center, start, second, end) {
193
+ var startCcw = angleByNormalSign(center, start, 1);
194
+ var secondCcw = angleByNormalSign(center, second, 1);
195
+ var endCcw = angleByNormalSign(center, end, 1);
196
+ var ccwContains = isAngleOnSweep(startCcw, secondCcw, endCcw);
197
+ var startCw = angleByNormalSign(center, start, -1);
198
+ var secondCw = angleByNormalSign(center, second, -1);
199
+ var endCw = angleByNormalSign(center, end, -1);
200
+ var cwContains = isAngleOnSweep(startCw, secondCw, endCw);
201
+ if (ccwContains && !cwContains)
202
+ return 1;
203
+ if (!ccwContains && cwContains)
204
+ return -1;
205
+ // Degenerate/near-boundary fallback.
206
+ var cross = (second.x - start.x) * (end.y - start.y) -
207
+ (second.y - start.y) * (end.x - start.x);
208
+ return cross >= 0 ? 1 : -1;
209
+ }
210
+ /**
211
+ * Builds an arc from 3-point input (start / point-on-arc / end).
212
+ *
213
+ * This method computes circumcenter/radius explicitly in XY and chooses
214
+ * orientation so the final sweep passes through `second`. If `reverseDirection`
215
+ * is true, the orientation is flipped (used by Ctrl toggle).
216
+ *
217
+ * @param start - Start point.
218
+ * @param second - Point on arc.
219
+ * @param end - End point.
220
+ * @param reverseDirection - Whether to invert auto-selected orientation.
221
+ * @returns Arc definition or `undefined` when points are invalid.
222
+ */
223
+ function createArcFromThreePoints(start, second, end, reverseDirection) {
224
+ if (reverseDirection === void 0) { reverseDirection = false; }
225
+ // Compute circumcenter from three non-collinear points in XY.
226
+ var x1 = start.x;
227
+ var y1 = start.y;
228
+ var x2 = second.x;
229
+ var y2 = second.y;
230
+ var x3 = end.x;
231
+ var y3 = end.y;
232
+ var d = 2 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2));
233
+ if (Math.abs(d) <= EPSILON)
234
+ return undefined;
235
+ var ux = ((x1 * x1 + y1 * y1) * (y2 - y3) +
236
+ (x2 * x2 + y2 * y2) * (y3 - y1) +
237
+ (x3 * x3 + y3 * y3) * (y1 - y2)) /
238
+ d;
239
+ var uy = ((x1 * x1 + y1 * y1) * (x3 - x2) +
240
+ (x2 * x2 + y2 * y2) * (x1 - x3) +
241
+ (x3 * x3 + y3 * y3) * (x2 - x1)) /
242
+ d;
243
+ var center = { x: ux, y: uy, z: 0 };
244
+ var radius = distance2d(center, start);
245
+ if (!Number.isFinite(radius) || radius <= EPSILON)
246
+ return undefined;
247
+ // By default, choose the arc that actually passes through the second point.
248
+ // Ctrl toggle can reverse this selection to the complementary direction.
249
+ var autoNormalSign = chooseThreePointNormalSign(center, start, second, end);
250
+ var normalSign = reverseDirection
251
+ ? -autoNormalSign
252
+ : autoNormalSign;
253
+ return {
254
+ center: center,
255
+ radius: radius,
256
+ startAngle: angleByNormalSign(center, start, normalSign),
257
+ endAngle: angleByNormalSign(center, end, normalSign),
258
+ normalSign: normalSign
259
+ };
260
+ }
261
+ /**
262
+ * Builds arc by center/start/end with explicit orientation.
263
+ *
264
+ * @param center - Arc center.
265
+ * @param start - Arc start point.
266
+ * @param end - Arc end point.
267
+ * @param normalSign - Orientation sign (+Z / -Z).
268
+ * @returns Arc definition, or `undefined` if geometric constraints fail.
269
+ */
270
+ function createArcFromCenterStartEnd(center, start, end, normalSign) {
271
+ var radiusFromStart = distance2d(center, start);
272
+ var radiusFromEnd = distance2d(center, end);
273
+ if (radiusFromStart <= EPSILON || radiusFromEnd <= EPSILON) {
274
+ return undefined;
275
+ }
276
+ // Start/end must lie on the same circle (small tolerance for picked input).
277
+ var tolerance = Math.max(EPSILON, radiusFromStart * 1e-6);
278
+ if (Math.abs(radiusFromStart - radiusFromEnd) > tolerance) {
279
+ return undefined;
280
+ }
281
+ return {
282
+ center: { x: center.x, y: center.y, z: 0 },
283
+ radius: radiusFromStart,
284
+ startAngle: angleByNormalSign(center, start, normalSign),
285
+ endAngle: angleByNormalSign(center, end, normalSign),
286
+ normalSign: normalSign
287
+ };
288
+ }
289
+ /**
290
+ * Builds center-start arc where user end input is projected onto the circle.
291
+ *
292
+ * Useful for preview/interaction where raw cursor point may not lie exactly
293
+ * on the circle defined by center+start.
294
+ *
295
+ * @param center - Arc center.
296
+ * @param start - Arc start point.
297
+ * @param rawEnd - Raw user cursor/pick point.
298
+ * @param normalSign - Orientation sign (+Z / -Z).
299
+ * @returns Arc definition, or `undefined` if projection/geometry fails.
300
+ */
301
+ function createArcFromCenterStartProjectedEnd(center, start, rawEnd, normalSign) {
302
+ var radius = distance2d(center, start);
303
+ if (radius <= EPSILON)
304
+ return undefined;
305
+ var end = projectPointToCircle(center, radius, rawEnd);
306
+ if (!end)
307
+ return undefined;
308
+ return createArcFromCenterStartEnd(center, start, end, normalSign);
309
+ }
310
+ /**
311
+ * Builds center-start arc from included sweep angle.
312
+ *
313
+ * Positive sweep = +Z orientation, negative sweep = -Z orientation.
314
+ *
315
+ * @param center - Arc center.
316
+ * @param start - Arc start point.
317
+ * @param sweepRad - Included angle in radians (signed).
318
+ * @returns Arc definition, or `undefined` for invalid sweep/radius.
319
+ */
320
+ function createArcFromCenterStartSweep(center, start, sweepRad) {
321
+ var radius = distance2d(center, start);
322
+ var sweep = Math.abs(sweepRad);
323
+ if (radius <= EPSILON || sweep <= EPSILON || sweep >= TAU - EPSILON) {
324
+ return undefined;
325
+ }
326
+ var normalSign = sweepRad >= 0 ? 1 : -1;
327
+ var startAngle = angleByNormalSign(center, start, normalSign);
328
+ var endAngle = normalizeAngle(startAngle + sweep);
329
+ return {
330
+ center: { x: center.x, y: center.y, z: 0 },
331
+ radius: radius,
332
+ startAngle: startAngle,
333
+ endAngle: endAngle,
334
+ normalSign: normalSign
335
+ };
336
+ }
337
+ /**
338
+ * Builds center-start arc from chord length.
339
+ *
340
+ * Sign of chord length controls orientation; magnitude controls included angle.
341
+ *
342
+ * @param center - Arc center.
343
+ * @param start - Arc start point.
344
+ * @param chordLength - Chord length (signed).
345
+ * @returns Arc definition, or `undefined` when out of geometric range.
346
+ */
347
+ function createArcFromCenterStartChord(center, start, chordLength) {
348
+ var radius = distance2d(center, start);
349
+ var chord = Math.abs(chordLength);
350
+ if (radius <= EPSILON || chord <= EPSILON || chord > 2 * radius + EPSILON) {
351
+ return undefined;
352
+ }
353
+ var ratio = Math.max(-1, Math.min(1, chord / (2 * radius)));
354
+ var sweep = 2 * Math.asin(ratio);
355
+ var signedSweep = chordLength >= 0 ? sweep : -sweep;
356
+ return createArcFromCenterStartSweep(center, start, signedSweep);
357
+ }
358
+ /**
359
+ * Builds start-end arc from included angle.
360
+ *
361
+ * @param start - Arc start point.
362
+ * @param end - Arc end point.
363
+ * @param sweepRad - Included angle in radians (signed).
364
+ * @returns Arc definition, or `undefined` if no valid solution exists.
365
+ */
366
+ function createArcFromStartEndAngle(start, end, sweepRad) {
367
+ var chord = distance2d(start, end);
368
+ var sweep = Math.abs(sweepRad);
369
+ if (chord <= EPSILON || sweep <= EPSILON || sweep >= TAU - EPSILON) {
370
+ return undefined;
371
+ }
372
+ // chord = 2 * r * sin(theta/2) -> r = chord / (2 * sin(theta/2))
373
+ var sinHalf = Math.sin(sweep / 2);
374
+ if (Math.abs(sinHalf) <= EPSILON)
375
+ return undefined;
376
+ var radius = chord / (2 * sinHalf);
377
+ var offsetSquared = radius * radius - (chord * chord) / 4;
378
+ if (offsetSquared < -EPSILON)
379
+ return undefined;
380
+ var offset = Math.sqrt(Math.max(0, offsetSquared));
381
+ var midX = (start.x + end.x) / 2;
382
+ var midY = (start.y + end.y) / 2;
383
+ var dx = end.x - start.x;
384
+ var dy = end.y - start.y;
385
+ var ux = -dy / chord;
386
+ var uy = dx / chord;
387
+ var isCounterClockwise = sweepRad >= 0;
388
+ // Two circle centers satisfy start/end + radius. Select side by
389
+ // CW/CCW intent and whether included angle is minor/major.
390
+ var useLeft = (isCounterClockwise && sweep <= Math.PI) ||
391
+ (!isCounterClockwise && sweep > Math.PI);
392
+ var side = useLeft ? 1 : -1;
393
+ var center = {
394
+ x: midX + ux * offset * side,
395
+ y: midY + uy * offset * side,
396
+ z: 0
397
+ };
398
+ var normalSign = isCounterClockwise ? 1 : -1;
399
+ return createArcFromCenterStartEnd(center, start, end, normalSign);
400
+ }
401
+ /**
402
+ * Builds start-end arc from tangent direction at start.
403
+ *
404
+ * @param start - Arc start point.
405
+ * @param end - Arc end point.
406
+ * @param directionRad - Tangent direction at start (radians).
407
+ * @returns Arc definition, or `undefined` when constraints are degenerate.
408
+ */
409
+ function createArcFromStartEndDirection(start, end, directionRad) {
410
+ // Build center from tangent constraint at start:
411
+ // center lies on line through start with normal to tangent.
412
+ var tx = Math.cos(directionRad);
413
+ var ty = Math.sin(directionRad);
414
+ var dx = end.x - start.x;
415
+ var dy = end.y - start.y;
416
+ var nx = -ty;
417
+ var ny = tx;
418
+ var denominator = 2 * (dx * nx + dy * ny);
419
+ if (Math.abs(denominator) <= EPSILON)
420
+ return undefined;
421
+ // Solve center = start + lambda * n so that |center-start| = |center-end|.
422
+ var lambda = (dx * dx + dy * dy) / denominator;
423
+ if (!Number.isFinite(lambda))
424
+ return undefined;
425
+ var center = {
426
+ x: start.x + nx * lambda,
427
+ y: start.y + ny * lambda,
428
+ z: 0
429
+ };
430
+ var radiusVectorX = start.x - center.x;
431
+ var radiusVectorY = start.y - center.y;
432
+ var cross = radiusVectorX * ty - radiusVectorY * tx;
433
+ if (Math.abs(cross) <= EPSILON)
434
+ return undefined;
435
+ var normalSign = cross >= 0 ? 1 : -1;
436
+ return createArcFromCenterStartEnd(center, start, end, normalSign);
437
+ }
438
+ /**
439
+ * Builds start-end arc from radius.
440
+ *
441
+ * Radius sign controls side/orientation (AutoCAD-like behavior).
442
+ *
443
+ * @param start - Arc start point.
444
+ * @param end - Arc end point.
445
+ * @param radiusInput - Radius value (signed).
446
+ * @returns Arc definition, or `undefined` when radius cannot connect points.
447
+ */
448
+ function createArcFromStartEndRadius(start, end, radiusInput) {
449
+ var radius = Math.abs(radiusInput);
450
+ var chord = distance2d(start, end);
451
+ if (radius <= EPSILON || chord <= EPSILON || chord > 2 * radius + EPSILON) {
452
+ return undefined;
453
+ }
454
+ var midX = (start.x + end.x) / 2;
455
+ var midY = (start.y + end.y) / 2;
456
+ var dx = end.x - start.x;
457
+ var dy = end.y - start.y;
458
+ var ux = -dy / chord;
459
+ var uy = dx / chord;
460
+ var offset = Math.sqrt(Math.max(0, radius * radius - (chord * chord) / 4));
461
+ // Keep AutoCAD-like behavior:
462
+ // positive radius picks +Z side, negative radius picks mirrored side.
463
+ var side = radiusInput >= 0 ? 1 : -1;
464
+ var center = {
465
+ x: midX + ux * offset * side,
466
+ y: midY + uy * offset * side,
467
+ z: 0
468
+ };
469
+ var normalSign = radiusInput >= 0 ? 1 : -1;
470
+ return createArcFromCenterStartEnd(center, start, end, normalSign);
471
+ }
472
+ /**
473
+ * Dynamic preview jig for ARC command.
474
+ *
475
+ * The jig holds one transient `AcDbArc` and updates it from a builder callback
476
+ * as cursor input changes.
477
+ */
478
+ var AcApArcJig = /** @class */ (function (_super) {
479
+ __extends(AcApArcJig, _super);
480
+ /**
481
+ * Creates a preview jig.
482
+ *
483
+ * @param view - Active editor view.
484
+ * @param builder - Cursor-to-arc definition resolver.
485
+ * @param fallback - Initial valid fallback definition.
486
+ */
487
+ function AcApArcJig(view, builder, fallback) {
488
+ var _this = _super.call(this, view) || this;
489
+ _this._builder = builder;
490
+ _this._arc = createArcEntity(fallback);
491
+ return _this;
492
+ }
493
+ Object.defineProperty(AcApArcJig.prototype, "entity", {
494
+ /**
495
+ * Gets transient arc entity.
496
+ */
497
+ get: function () {
498
+ return this._arc;
499
+ },
500
+ enumerable: false,
501
+ configurable: true
502
+ });
503
+ /**
504
+ * Updates transient arc for current cursor point.
505
+ *
506
+ * @param point - Current cursor/input point.
507
+ */
508
+ AcApArcJig.prototype.update = function (point) {
509
+ // Ignore invalid intermediate states while the cursor moves.
510
+ var definition = this._builder(point);
511
+ if (!definition)
512
+ return;
513
+ applyArcDefinition(this._arc, definition);
514
+ };
515
+ return AcApArcJig;
516
+ }(AcEdPreviewJig));
517
+ /**
518
+ * Command to create one arc.
519
+ *
520
+ * Supported input flows align with AutoCAD ARC command options:
521
+ * - Start/Second/End (3-point)
522
+ * - Start/Center/End, Start/Center/Angle, Start/Center/Chord Length
523
+ * - Start/End/Center, Start/End/Angle, Start/End/Direction, Start/End/Radius
524
+ * - Center/Start/End, Center/Start/Angle, Center/Start/Chord Length
525
+ */
526
+ var AcApArcCmd = /** @class */ (function (_super) {
527
+ __extends(AcApArcCmd, _super);
528
+ /**
529
+ * Creates ARC command instance.
530
+ */
531
+ function AcApArcCmd() {
532
+ var _this = _super.call(this) || this;
533
+ _this.mode = AcEdOpenMode.Write;
534
+ return _this;
535
+ }
536
+ /**
537
+ * Command entry point.
538
+ *
539
+ * Supports initial Start-point branch and Center-first branch.
540
+ *
541
+ * @param context - Current app context.
542
+ */
543
+ AcApArcCmd.prototype.execute = function (context) {
544
+ return __awaiter(this, void 0, void 0, function () {
545
+ var prompt, result;
546
+ return __generator(this, function (_a) {
547
+ switch (_a.label) {
548
+ case 0:
549
+ // Keep ARC behavior deterministic for each run (same as PLINE flow).
550
+ AcApDocManager.instance.editor.resetInputToggles();
551
+ prompt = new AcEdPromptPointOptions(AcApI18n.t('jig.arc.startPointOrCenter'));
552
+ this.addKeyword(prompt, 'center');
553
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(prompt)];
554
+ case 1:
555
+ result = _a.sent();
556
+ if (!(result.status === AcEdPromptStatus.Keyword)) return [3 /*break*/, 4];
557
+ if (!(result.stringResult === 'Center')) return [3 /*break*/, 3];
558
+ return [4 /*yield*/, this.runCenterStartFlow(context)];
559
+ case 2:
560
+ _a.sent();
561
+ _a.label = 3;
562
+ case 3: return [2 /*return*/];
563
+ case 4:
564
+ if (result.status !== AcEdPromptStatus.OK)
565
+ return [2 /*return*/];
566
+ return [4 /*yield*/, this.runStartFlow(context, result.value)];
567
+ case 5:
568
+ _a.sent();
569
+ return [2 /*return*/];
570
+ }
571
+ });
572
+ });
573
+ };
574
+ /**
575
+ * Adds one localized keyword to a prompt options object.
576
+ *
577
+ * @param prompt - Prompt options to extend.
578
+ * @param key - Keyword i18n key suffix.
579
+ */
580
+ AcApArcCmd.prototype.addKeyword = function (prompt, key) {
581
+ prompt.keywords.add(AcApI18n.t("jig.arc.keywords.".concat(key, ".display")), AcApI18n.t("jig.arc.keywords.".concat(key, ".global")), AcApI18n.t("jig.arc.keywords.".concat(key, ".local")));
582
+ };
583
+ /**
584
+ * Appends created arc entity to model space.
585
+ *
586
+ * @param context - Current app context.
587
+ * @param arc - Arc definition to append.
588
+ */
589
+ AcApArcCmd.prototype.appendArc = function (context, arc) {
590
+ context.doc.database.tables.blockTable.modelSpace.appendEntity(createArcEntity(arc));
591
+ };
592
+ /**
593
+ * Emits one warning message for invalid geometry input.
594
+ *
595
+ * @param key - Invalid-input category key.
596
+ */
597
+ AcApArcCmd.prototype.warnInvalidGeometry = function (key) {
598
+ eventBus.emit('message', {
599
+ message: AcApI18n.t("jig.arc.invalid.".concat(key)),
600
+ type: 'warning'
601
+ });
602
+ };
603
+ /**
604
+ * Gets direction factor from Ctrl-toggle state.
605
+ *
606
+ * @returns `1` for normal direction, `-1` for flipped direction.
607
+ */
608
+ AcApArcCmd.prototype.getArcDirectionFactor = function () {
609
+ var toggles = AcApDocManager.instance.editor.getInputToggles();
610
+ return toggles.ctrlArcFlip ? -1 : 1;
611
+ };
612
+ /**
613
+ * Applies Ctrl direction factor to orientation sign.
614
+ *
615
+ * @param sign - Base orientation sign.
616
+ * @returns Possibly flipped orientation sign.
617
+ */
618
+ AcApArcCmd.prototype.applyCtrlDirectionSign = function (sign) {
619
+ return (sign * this.getArcDirectionFactor());
620
+ };
621
+ /**
622
+ * Applies Ctrl direction factor to a signed numeric input.
623
+ *
624
+ * @param value - Signed value (angle/chord/radius).
625
+ * @returns Value with direction factor applied.
626
+ */
627
+ AcApArcCmd.prototype.applyCtrlDirectionValue = function (value) {
628
+ // Used by signed numeric inputs (angle/chord/radius), so Ctrl can flip sign.
629
+ return value * this.getArcDirectionFactor();
630
+ };
631
+ /**
632
+ * Gets whether current Ctrl-toggle indicates direction reversal.
633
+ *
634
+ * @returns `true` when direction is flipped.
635
+ */
636
+ AcApArcCmd.prototype.isCtrlDirectionFlipped = function () {
637
+ // 3-point flow uses geometric auto-direction first, then optional Ctrl reverse.
638
+ var toggles = AcApDocManager.instance.editor.getInputToggles();
639
+ return toggles.ctrlArcFlip;
640
+ };
641
+ /**
642
+ * Handles Start-first main branch.
643
+ *
644
+ * Flow:
645
+ * - Start -> Second -> End (3-point)
646
+ * - Start -> Center -> ...
647
+ * - Start -> End -> ...
648
+ *
649
+ * @param context - Current app context.
650
+ * @param start - Start point picked by user.
651
+ */
652
+ AcApArcCmd.prototype.runStartFlow = function (context, start) {
653
+ return __awaiter(this, void 0, void 0, function () {
654
+ var prompt, result;
655
+ return __generator(this, function (_a) {
656
+ switch (_a.label) {
657
+ case 0:
658
+ prompt = new AcEdPromptPointOptions(AcApI18n.t('jig.arc.secondPointOrOptions'));
659
+ this.addKeyword(prompt, 'center');
660
+ this.addKeyword(prompt, 'end');
661
+ prompt.useBasePoint = true;
662
+ prompt.useDashedLine = true;
663
+ prompt.basePoint = new AcGePoint3d(start);
664
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(prompt)];
665
+ case 1:
666
+ result = _a.sent();
667
+ if (!(result.status === AcEdPromptStatus.OK)) return [3 /*break*/, 3];
668
+ return [4 /*yield*/, this.finishThreePointArc(context, start, result.value)];
669
+ case 2:
670
+ _a.sent();
671
+ return [2 /*return*/];
672
+ case 3:
673
+ if (result.status !== AcEdPromptStatus.Keyword)
674
+ return [2 /*return*/];
675
+ if (!(result.stringResult === 'Center')) return [3 /*break*/, 5];
676
+ return [4 /*yield*/, this.runStartCenterFlow(context, start)];
677
+ case 4:
678
+ _a.sent();
679
+ return [2 /*return*/];
680
+ case 5:
681
+ if (!(result.stringResult === 'End')) return [3 /*break*/, 7];
682
+ return [4 /*yield*/, this.runStartEndFlow(context, start)];
683
+ case 6:
684
+ _a.sent();
685
+ _a.label = 7;
686
+ case 7: return [2 /*return*/];
687
+ }
688
+ });
689
+ });
690
+ };
691
+ /**
692
+ * Completes 3-point arc flow (Start/Second/End).
693
+ *
694
+ * @param context - Current app context.
695
+ * @param start - Start point.
696
+ * @param second - Point on arc.
697
+ */
698
+ AcApArcCmd.prototype.finishThreePointArc = function (context, start, second) {
699
+ return __awaiter(this, void 0, void 0, function () {
700
+ var prompt, result, arc;
701
+ var _this = this;
702
+ return __generator(this, function (_a) {
703
+ switch (_a.label) {
704
+ case 0:
705
+ prompt = new AcEdPromptPointOptions(AcApI18n.t('jig.arc.endPoint'));
706
+ prompt.useBasePoint = true;
707
+ prompt.useDashedLine = true;
708
+ prompt.basePoint = new AcGePoint3d(start);
709
+ prompt.jig = new AcApArcJig(context.view, function (point) {
710
+ return createArcFromThreePoints(start, second, point,
711
+ // Live preview follows the same Ctrl reverse behavior as final commit.
712
+ _this.isCtrlDirectionFlipped());
713
+ }, createFallbackArc(start));
714
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(prompt)];
715
+ case 1:
716
+ result = _a.sent();
717
+ if (result.status !== AcEdPromptStatus.OK)
718
+ return [2 /*return*/];
719
+ arc = createArcFromThreePoints(start, second, result.value,
720
+ // Keep commit behavior identical to preview.
721
+ this.isCtrlDirectionFlipped());
722
+ if (arc) {
723
+ this.appendArc(context, arc);
724
+ }
725
+ else {
726
+ this.warnInvalidGeometry('threePoint');
727
+ }
728
+ return [2 /*return*/];
729
+ }
730
+ });
731
+ });
732
+ };
733
+ /**
734
+ * Runs Center-first branch:
735
+ * Center -> Start -> (End | Angle | Chord Length)
736
+ *
737
+ * @param context - Current app context.
738
+ */
739
+ AcApArcCmd.prototype.runCenterStartFlow = function (context) {
740
+ return __awaiter(this, void 0, void 0, function () {
741
+ var centerPrompt, centerResult, center, startPrompt, startResult;
742
+ return __generator(this, function (_a) {
743
+ switch (_a.label) {
744
+ case 0:
745
+ centerPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.arc.centerPoint'));
746
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(centerPrompt)];
747
+ case 1:
748
+ centerResult = _a.sent();
749
+ if (centerResult.status !== AcEdPromptStatus.OK)
750
+ return [2 /*return*/];
751
+ center = centerResult.value;
752
+ startPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.arc.startPoint'));
753
+ startPrompt.useBasePoint = true;
754
+ startPrompt.useDashedLine = true;
755
+ startPrompt.basePoint = new AcGePoint3d(center);
756
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(startPrompt)];
757
+ case 2:
758
+ startResult = _a.sent();
759
+ if (startResult.status !== AcEdPromptStatus.OK)
760
+ return [2 /*return*/];
761
+ return [4 /*yield*/, this.finishCenterStartFlow(context, center, startResult.value)];
762
+ case 3:
763
+ _a.sent();
764
+ return [2 /*return*/];
765
+ }
766
+ });
767
+ });
768
+ };
769
+ /**
770
+ * Runs Start->Center branch:
771
+ * Start -> Center -> (End | Angle | Chord Length)
772
+ *
773
+ * @param context - Current app context.
774
+ * @param start - Start point.
775
+ */
776
+ AcApArcCmd.prototype.runStartCenterFlow = function (context, start) {
777
+ return __awaiter(this, void 0, void 0, function () {
778
+ var centerPrompt, centerResult;
779
+ return __generator(this, function (_a) {
780
+ switch (_a.label) {
781
+ case 0:
782
+ centerPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.arc.centerPoint'));
783
+ centerPrompt.useBasePoint = true;
784
+ centerPrompt.useDashedLine = true;
785
+ centerPrompt.basePoint = new AcGePoint3d(start);
786
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(centerPrompt)];
787
+ case 1:
788
+ centerResult = _a.sent();
789
+ if (centerResult.status !== AcEdPromptStatus.OK)
790
+ return [2 /*return*/];
791
+ return [4 /*yield*/, this.finishCenterStartFlow(context, centerResult.value, start)];
792
+ case 2:
793
+ _a.sent();
794
+ return [2 /*return*/];
795
+ }
796
+ });
797
+ });
798
+ };
799
+ /**
800
+ * Shared handler for center-start option family.
801
+ *
802
+ * Supports:
803
+ * - End point picking
804
+ * - Included angle input
805
+ * - Chord length input
806
+ *
807
+ * @param context - Current app context.
808
+ * @param center - Arc center.
809
+ * @param start - Arc start point.
810
+ */
811
+ AcApArcCmd.prototype.finishCenterStartFlow = function (context, center, start) {
812
+ return __awaiter(this, void 0, void 0, function () {
813
+ var endPrompt, endResult, arc, anglePrompt, angleResult, arc, chordPrompt, chordResult, arc;
814
+ var _this = this;
815
+ return __generator(this, function (_a) {
816
+ switch (_a.label) {
817
+ case 0:
818
+ endPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.arc.endPointOrOptions'));
819
+ this.addKeyword(endPrompt, 'angle');
820
+ this.addKeyword(endPrompt, 'chordLength');
821
+ endPrompt.useBasePoint = true;
822
+ endPrompt.useDashedLine = true;
823
+ endPrompt.basePoint = new AcGePoint3d(start);
824
+ endPrompt.jig = new AcApArcJig(context.view, function (point) {
825
+ return createArcFromCenterStartProjectedEnd(center, start, point, _this.applyCtrlDirectionSign(1));
826
+ }, createFallbackArc(start));
827
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(endPrompt)];
828
+ case 1:
829
+ endResult = _a.sent();
830
+ if (endResult.status === AcEdPromptStatus.OK) {
831
+ arc = createArcFromCenterStartProjectedEnd(center, start, endResult.value, this.applyCtrlDirectionSign(1));
832
+ if (arc) {
833
+ this.appendArc(context, arc);
834
+ }
835
+ else {
836
+ this.warnInvalidGeometry('center');
837
+ }
838
+ return [2 /*return*/];
839
+ }
840
+ if (endResult.status !== AcEdPromptStatus.Keyword)
841
+ return [2 /*return*/];
842
+ if (!(endResult.stringResult === 'Angle')) return [3 /*break*/, 3];
843
+ anglePrompt = new AcEdPromptDoubleOptions(AcApI18n.t('jig.arc.includedAngle'));
844
+ anglePrompt.allowZero = false;
845
+ anglePrompt.allowNegative = true;
846
+ return [4 /*yield*/, AcApDocManager.instance.editor.getDouble(anglePrompt)];
847
+ case 2:
848
+ angleResult = _a.sent();
849
+ if (angleResult.status !== AcEdPromptStatus.OK)
850
+ return [2 /*return*/];
851
+ arc = createArcFromCenterStartSweep(center, start, this.applyCtrlDirectionValue(this.degToRad(angleResult.value)));
852
+ if (arc) {
853
+ this.appendArc(context, arc);
854
+ }
855
+ else {
856
+ this.warnInvalidGeometry('angle');
857
+ }
858
+ return [2 /*return*/];
859
+ case 3:
860
+ if (!(endResult.stringResult === 'ChordLength')) return [3 /*break*/, 5];
861
+ chordPrompt = new AcEdPromptDistanceOptions(AcApI18n.t('jig.arc.chordLength'));
862
+ chordPrompt.allowZero = false;
863
+ chordPrompt.allowNegative = true;
864
+ return [4 /*yield*/, AcApDocManager.instance.editor.getDistance(chordPrompt)];
865
+ case 4:
866
+ chordResult = _a.sent();
867
+ if (chordResult.status !== AcEdPromptStatus.OK)
868
+ return [2 /*return*/];
869
+ arc = createArcFromCenterStartChord(center, start, this.applyCtrlDirectionValue(chordResult.value));
870
+ if (arc) {
871
+ this.appendArc(context, arc);
872
+ }
873
+ else {
874
+ this.warnInvalidGeometry('chordLength');
875
+ }
876
+ _a.label = 5;
877
+ case 5: return [2 /*return*/];
878
+ }
879
+ });
880
+ });
881
+ };
882
+ /**
883
+ * Handles Start-End option family.
884
+ *
885
+ * Supports:
886
+ * - Start -> End -> Center
887
+ * - Start -> End -> Angle
888
+ * - Start -> End -> Direction
889
+ * - Start -> End -> Radius
890
+ *
891
+ * @param context - Current app context.
892
+ * @param start - Arc start point.
893
+ */
894
+ AcApArcCmd.prototype.runStartEndFlow = function (context, start) {
895
+ return __awaiter(this, void 0, void 0, function () {
896
+ var endPrompt, endResult, end, centerOrOptionPrompt, centerOrOptionResult, arc, anglePrompt, angleResult, arc, directionPrompt, directionResult, directionPoint, direction, arc, radiusPrompt, radiusResult, arc;
897
+ var _this = this;
898
+ return __generator(this, function (_a) {
899
+ switch (_a.label) {
900
+ case 0:
901
+ endPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.arc.endPoint'));
902
+ endPrompt.useBasePoint = true;
903
+ endPrompt.useDashedLine = true;
904
+ endPrompt.basePoint = new AcGePoint3d(start);
905
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(endPrompt)];
906
+ case 1:
907
+ endResult = _a.sent();
908
+ if (endResult.status !== AcEdPromptStatus.OK)
909
+ return [2 /*return*/];
910
+ end = endResult.value;
911
+ centerOrOptionPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.arc.centerPointOrOptions'));
912
+ this.addKeyword(centerOrOptionPrompt, 'angle');
913
+ this.addKeyword(centerOrOptionPrompt, 'direction');
914
+ this.addKeyword(centerOrOptionPrompt, 'radius');
915
+ centerOrOptionPrompt.useBasePoint = true;
916
+ centerOrOptionPrompt.useDashedLine = true;
917
+ centerOrOptionPrompt.basePoint = new AcGePoint3d(start);
918
+ centerOrOptionPrompt.jig = new AcApArcJig(context.view, function (point) {
919
+ return createArcFromCenterStartEnd(point, start, end, _this.applyCtrlDirectionSign(1));
920
+ }, createFallbackArc(start));
921
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(centerOrOptionPrompt)];
922
+ case 2:
923
+ centerOrOptionResult = _a.sent();
924
+ if (centerOrOptionResult.status === AcEdPromptStatus.OK) {
925
+ arc = createArcFromCenterStartEnd(centerOrOptionResult.value, start, end, this.applyCtrlDirectionSign(1));
926
+ if (arc) {
927
+ this.appendArc(context, arc);
928
+ }
929
+ else {
930
+ this.warnInvalidGeometry('center');
931
+ }
932
+ return [2 /*return*/];
933
+ }
934
+ if (centerOrOptionResult.status !== AcEdPromptStatus.Keyword)
935
+ return [2 /*return*/];
936
+ if (!(centerOrOptionResult.stringResult === 'Angle')) return [3 /*break*/, 4];
937
+ anglePrompt = new AcEdPromptDoubleOptions(AcApI18n.t('jig.arc.includedAngle'));
938
+ anglePrompt.allowZero = false;
939
+ anglePrompt.allowNegative = true;
940
+ return [4 /*yield*/, AcApDocManager.instance.editor.getDouble(anglePrompt)];
941
+ case 3:
942
+ angleResult = _a.sent();
943
+ if (angleResult.status !== AcEdPromptStatus.OK)
944
+ return [2 /*return*/];
945
+ arc = createArcFromStartEndAngle(start, end, this.applyCtrlDirectionValue(this.degToRad(angleResult.value)));
946
+ if (arc) {
947
+ this.appendArc(context, arc);
948
+ }
949
+ else {
950
+ this.warnInvalidGeometry('angle');
951
+ }
952
+ return [2 /*return*/];
953
+ case 4:
954
+ if (!(centerOrOptionResult.stringResult === 'Direction')) return [3 /*break*/, 6];
955
+ directionPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.arc.tangentDirection'));
956
+ directionPrompt.useBasePoint = true;
957
+ directionPrompt.useDashedLine = true;
958
+ directionPrompt.basePoint = new AcGePoint3d(start);
959
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(directionPrompt)];
960
+ case 5:
961
+ directionResult = _a.sent();
962
+ if (directionResult.status !== AcEdPromptStatus.OK)
963
+ return [2 /*return*/];
964
+ directionPoint = directionResult.value;
965
+ direction = Math.atan2(directionPoint.y - start.y, directionPoint.x - start.x);
966
+ arc = createArcFromStartEndDirection(start, end, direction);
967
+ if (arc) {
968
+ this.appendArc(context, arc);
969
+ }
970
+ else {
971
+ this.warnInvalidGeometry('direction');
972
+ }
973
+ return [2 /*return*/];
974
+ case 6:
975
+ if (!(centerOrOptionResult.stringResult === 'Radius')) return [3 /*break*/, 8];
976
+ radiusPrompt = new AcEdPromptDistanceOptions(AcApI18n.t('jig.arc.radius'));
977
+ radiusPrompt.allowZero = false;
978
+ radiusPrompt.allowNegative = true;
979
+ return [4 /*yield*/, AcApDocManager.instance.editor.getDistance(radiusPrompt)];
980
+ case 7:
981
+ radiusResult = _a.sent();
982
+ if (radiusResult.status !== AcEdPromptStatus.OK)
983
+ return [2 /*return*/];
984
+ arc = createArcFromStartEndRadius(start, end, this.applyCtrlDirectionValue(radiusResult.value));
985
+ if (arc) {
986
+ this.appendArc(context, arc);
987
+ }
988
+ else {
989
+ this.warnInvalidGeometry('radius');
990
+ }
991
+ _a.label = 8;
992
+ case 8: return [2 /*return*/];
993
+ }
994
+ });
995
+ });
996
+ };
997
+ /**
998
+ * Converts degrees to radians.
999
+ *
1000
+ * @param degree - Angle in degrees.
1001
+ * @returns Angle in radians.
1002
+ */
1003
+ AcApArcCmd.prototype.degToRad = function (degree) {
1004
+ return (degree * Math.PI) / 180;
1005
+ };
1006
+ return AcApArcCmd;
1007
+ }(AcEdCommand));
1008
+ export { AcApArcCmd };
1009
+ //# sourceMappingURL=AcApArcCmd.js.map