@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
@@ -0,0 +1,387 @@
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
+ var __read = (this && this.__read) || function (o, n) {
53
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
54
+ if (!m) return o;
55
+ var i = m.call(o), r, ar = [], e;
56
+ try {
57
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
58
+ }
59
+ catch (error) { e = { error: error }; }
60
+ finally {
61
+ try {
62
+ if (r && !r.done && (m = i["return"])) m.call(i);
63
+ }
64
+ finally { if (e) throw e.error; }
65
+ }
66
+ return ar;
67
+ };
68
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
69
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
70
+ if (ar || !(i in from)) {
71
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
72
+ ar[i] = from[i];
73
+ }
74
+ }
75
+ return to.concat(ar || Array.prototype.slice.call(from));
76
+ };
77
+ import { AcDbLine, AcGiLineWeight } from '@mlightcad/data-model';
78
+ import { AcEdCommand, AcEdCorsorType, AcEdOpenMode, AcEdPreviewJig, AcEdPromptPointOptions, AcEdPromptStatus, AcEdViewMode } from '../editor';
79
+ import { AcApI18n } from '../i18n';
80
+ import { colorToCssAlpha, cssColor, makeBadge, makeDot, makeLiveBadge, makeOverlayCanvas, measurementColor } from '../util';
81
+ import { registerMeasurementCleanup } from './AcApClearMeasurementsCmd';
82
+ /**
83
+ * Rubber-band jig: shows a preview line from the last confirmed
84
+ * vertex to the current cursor position and fires onMove on each update.
85
+ */
86
+ var AcApMeasureAreaJig = /** @class */ (function (_super) {
87
+ __extends(AcApMeasureAreaJig, _super);
88
+ function AcApMeasureAreaJig(view, from, color, onMove) {
89
+ var _this = _super.call(this, view) || this;
90
+ _this._line = new AcDbLine(from, from);
91
+ _this._line.color = color;
92
+ _this._line.lineWeight = AcGiLineWeight.LineWeight070;
93
+ _this._onMove = onMove;
94
+ return _this;
95
+ }
96
+ Object.defineProperty(AcApMeasureAreaJig.prototype, "entity", {
97
+ get: function () {
98
+ return this._line;
99
+ },
100
+ enumerable: false,
101
+ configurable: true
102
+ });
103
+ AcApMeasureAreaJig.prototype.update = function (p) {
104
+ this._line.endPoint = p;
105
+ this._onMove(p);
106
+ };
107
+ return AcApMeasureAreaJig;
108
+ }(AcEdPreviewJig));
109
+ /**
110
+ * Returns true when segment (p1→p2) properly crosses segment (p3→p4).
111
+ * Endpoint-touches are intentionally excluded so adjacent edges never trigger.
112
+ */
113
+ function segmentsIntersect(p1, p2, p3, p4) {
114
+ var d1x = p2.x - p1.x, d1y = p2.y - p1.y;
115
+ var d2x = p4.x - p3.x, d2y = p4.y - p3.y;
116
+ var denom = d1x * d2y - d1y * d2x;
117
+ if (Math.abs(denom) < 1e-10)
118
+ return false; // parallel
119
+ var dx = p3.x - p1.x, dy = p3.y - p1.y;
120
+ var t = (dx * d2y - dy * d2x) / denom;
121
+ var u = (dx * d1y - dy * d1x) / denom;
122
+ return t > 0 && t < 1 && u > 0 && u < 1;
123
+ }
124
+ /** Computes the area of a polygon using the shoelace (Gauss) formula. */
125
+ function shoelaceArea(pts) {
126
+ var area = 0;
127
+ var n = pts.length;
128
+ for (var i = 0; i < n; i++) {
129
+ var j = (i + 1) % n;
130
+ area += pts[i].x * pts[j].y;
131
+ area -= pts[j].x * pts[i].y;
132
+ }
133
+ return Math.abs(area) / 2;
134
+ }
135
+ /** Returns the arithmetic centroid of a set of world points. */
136
+ function centroid(pts) {
137
+ var x = pts.reduce(function (s, p) { return s + p.x; }, 0) / pts.length;
138
+ var y = pts.reduce(function (s, p) { return s + p.y; }, 0) / pts.length;
139
+ return { x: x, y: y };
140
+ }
141
+ /** Draws a filled polygon on a full-viewport canvas overlay. */
142
+ function drawAreaOnCanvas(canvas, view, points, color) {
143
+ var rect = view.canvas.getBoundingClientRect();
144
+ var dpr = window.devicePixelRatio || 1;
145
+ var w = Math.round(rect.width);
146
+ var h = Math.round(rect.height);
147
+ var origin = view.canvasToContainer({ x: 0, y: 0 });
148
+ canvas.style.left = "".concat(origin.x, "px");
149
+ canvas.style.top = "".concat(origin.y, "px");
150
+ canvas.style.width = "".concat(w, "px");
151
+ canvas.style.height = "".concat(h, "px");
152
+ if (canvas.width !== w * dpr || canvas.height !== h * dpr) {
153
+ canvas.width = w * dpr;
154
+ canvas.height = h * dpr;
155
+ }
156
+ var ctx = canvas.getContext('2d');
157
+ if (!ctx || points.length < 3)
158
+ return;
159
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
160
+ ctx.save();
161
+ ctx.scale(dpr, dpr);
162
+ var spts = points.map(function (p) { return view.worldToScreen(p); });
163
+ ctx.beginPath();
164
+ ctx.moveTo(spts[0].x, spts[0].y);
165
+ for (var i = 1; i < spts.length; i++)
166
+ ctx.lineTo(spts[i].x, spts[i].y);
167
+ ctx.closePath();
168
+ ctx.fillStyle = colorToCssAlpha(color, 0.2);
169
+ ctx.fill();
170
+ ctx.strokeStyle = cssColor(color);
171
+ ctx.lineWidth = 2.5;
172
+ ctx.stroke();
173
+ ctx.restore();
174
+ }
175
+ /**
176
+ * Command that measures the area of a polygon drawn by the user.
177
+ *
178
+ * The user clicks successive vertices; after each click the canvas overlay
179
+ * updates with a semi-transparent blue fill and a dashed outline. The polygon
180
+ * auto-closes when the user clicks near the first vertex (14 px threshold),
181
+ * clicks near the last vertex, or draws a segment that crosses an existing
182
+ * edge — matching AutoCAD's area measurement behaviour. Pressing ESC/Enter
183
+ * also finalises the polygon.
184
+ *
185
+ * Persistent overlays are placed via {@link AcTrHtmlTransientManager} for dots
186
+ * and badge. The filled area canvas is managed with a viewChanged listener
187
+ * cleaned up via {@link registerMeasurementCleanup}.
188
+ */
189
+ var AcApMeasureAreaCmd = /** @class */ (function (_super) {
190
+ __extends(AcApMeasureAreaCmd, _super);
191
+ function AcApMeasureAreaCmd() {
192
+ var _this = _super.call(this) || this;
193
+ _this.mode = AcEdOpenMode.Read;
194
+ return _this;
195
+ }
196
+ AcApMeasureAreaCmd.prototype.execute = function (context) {
197
+ return __awaiter(this, void 0, void 0, function () {
198
+ var editor, color, points, fillCanvas, liveBadge;
199
+ var _this = this;
200
+ return __generator(this, function (_a) {
201
+ switch (_a.label) {
202
+ case 0:
203
+ editor = context.view.editor;
204
+ color = measurementColor(context.doc.database);
205
+ points = [];
206
+ fillCanvas = makeOverlayCanvas(context.view.container);
207
+ liveBadge = makeLiveBadge(color);
208
+ return [4 /*yield*/, context.view.withMode(AcEdViewMode.SELECTION, function () {
209
+ return editor.withCursor(AcEdCorsorType.Crosshair, function () { return __awaiter(_this, void 0, void 0, function () {
210
+ var drawPolygon, redrawOnViewChange, p1Result, p1, _loop_1, state_1, _a, area, persistCanvas, redrawPersist, htManager, id, mid;
211
+ return __generator(this, function (_b) {
212
+ switch (_b.label) {
213
+ case 0:
214
+ drawPolygon = function (cursor) {
215
+ var rect = context.view.canvas.getBoundingClientRect();
216
+ var dpr = window.devicePixelRatio || 1;
217
+ var w = Math.round(rect.width);
218
+ var h = Math.round(rect.height);
219
+ var origin = context.view.canvasToContainer({ x: 0, y: 0 });
220
+ fillCanvas.style.left = "".concat(origin.x, "px");
221
+ fillCanvas.style.top = "".concat(origin.y, "px");
222
+ fillCanvas.style.width = "".concat(w, "px");
223
+ fillCanvas.style.height = "".concat(h, "px");
224
+ if (fillCanvas.width !== w * dpr || fillCanvas.height !== h * dpr) {
225
+ fillCanvas.width = w * dpr;
226
+ fillCanvas.height = h * dpr;
227
+ }
228
+ var ctx = fillCanvas.getContext('2d');
229
+ if (!ctx || points.length < 1)
230
+ return;
231
+ ctx.clearRect(0, 0, fillCanvas.width, fillCanvas.height);
232
+ ctx.save();
233
+ ctx.scale(dpr, dpr);
234
+ var confirmedSpts = points.map(function (p) { return context.view.worldToScreen(p); });
235
+ var fillSpts = cursor
236
+ ? __spreadArray(__spreadArray([], __read(confirmedSpts), false), [context.view.worldToScreen(cursor)], false) : confirmedSpts;
237
+ if (fillSpts.length >= 3) {
238
+ ctx.beginPath();
239
+ ctx.moveTo(fillSpts[0].x, fillSpts[0].y);
240
+ for (var i = 1; i < fillSpts.length; i++)
241
+ ctx.lineTo(fillSpts[i].x, fillSpts[i].y);
242
+ ctx.closePath();
243
+ ctx.fillStyle = colorToCssAlpha(color, 0.2);
244
+ ctx.fill();
245
+ }
246
+ if (confirmedSpts.length >= 2) {
247
+ ctx.beginPath();
248
+ ctx.moveTo(confirmedSpts[0].x, confirmedSpts[0].y);
249
+ for (var i = 1; i < confirmedSpts.length; i++)
250
+ ctx.lineTo(confirmedSpts[i].x, confirmedSpts[i].y);
251
+ ctx.strokeStyle = cssColor(color);
252
+ ctx.lineWidth = 2.5;
253
+ ctx.setLineDash([8, 5]);
254
+ ctx.stroke();
255
+ ctx.setLineDash([]);
256
+ }
257
+ ctx.restore();
258
+ };
259
+ redrawOnViewChange = function () { return drawPolygon(); };
260
+ context.view.events.viewChanged.addEventListener(redrawOnViewChange);
261
+ return [4 /*yield*/, editor.getPoint(new AcEdPromptPointOptions(AcApI18n.t('jig.measureArea.firstPoint')))];
262
+ case 1:
263
+ p1Result = _b.sent();
264
+ if (p1Result.status !== AcEdPromptStatus.OK)
265
+ return [2 /*return*/];
266
+ p1 = p1Result.value;
267
+ points.push(p1);
268
+ drawPolygon();
269
+ _b.label = 2;
270
+ case 2:
271
+ _b.trys.push([2, 6, , 7]);
272
+ _loop_1 = function () {
273
+ var prompt_1, onMove, pResult, p, sp_1, snap, last, crosses, i;
274
+ return __generator(this, function (_c) {
275
+ switch (_c.label) {
276
+ case 0:
277
+ prompt_1 = new AcEdPromptPointOptions(AcApI18n.t('jig.measureArea.nextPoint'));
278
+ prompt_1.useBasePoint = true;
279
+ onMove = function (cursor) {
280
+ if (points.length < 2)
281
+ return;
282
+ var tempPts = __spreadArray(__spreadArray([], __read(points), false), [cursor], false);
283
+ var area = shoelaceArea(tempPts);
284
+ liveBadge.textContent = "~ ".concat(area.toFixed(3), " m\u00B2");
285
+ liveBadge.style.display = '';
286
+ var mid = centroid(tempPts);
287
+ var rect = context.view.canvas.getBoundingClientRect();
288
+ var sc = context.view.worldToScreen(mid);
289
+ liveBadge.style.left = "".concat(sc.x + rect.left, "px");
290
+ liveBadge.style.top = "".concat(sc.y + rect.top, "px");
291
+ drawPolygon(cursor);
292
+ };
293
+ prompt_1.jig = new AcApMeasureAreaJig(context.view, points[points.length - 1], color, onMove);
294
+ return [4 /*yield*/, editor.getPoint(prompt_1)];
295
+ case 1:
296
+ pResult = _c.sent();
297
+ if (pResult.status !== AcEdPromptStatus.OK)
298
+ return [2 /*return*/, "break"];
299
+ p = pResult.value;
300
+ liveBadge.style.display = 'none';
301
+ if (points.length >= 3) {
302
+ sp_1 = context.view.worldToScreen(p);
303
+ snap = function (anchor) {
304
+ var sa = context.view.worldToScreen(anchor);
305
+ var dx = sp_1.x - sa.x;
306
+ var dy = sp_1.y - sa.y;
307
+ return dx * dx + dy * dy <= 14 * 14;
308
+ };
309
+ if (snap(points[0]) || snap(points[points.length - 1]))
310
+ return [2 /*return*/, "break"];
311
+ }
312
+ if (points.length >= 3) {
313
+ last = points[points.length - 1];
314
+ crosses = false;
315
+ for (i = 0; i < points.length - 2; i++) {
316
+ if (segmentsIntersect(last, p, points[i], points[i + 1])) {
317
+ crosses = true;
318
+ break;
319
+ }
320
+ }
321
+ if (crosses)
322
+ return [2 /*return*/, "break"];
323
+ }
324
+ points.push(p);
325
+ drawPolygon();
326
+ return [2 /*return*/];
327
+ }
328
+ });
329
+ };
330
+ _b.label = 3;
331
+ case 3:
332
+ if (!(points.length < 50)) return [3 /*break*/, 5];
333
+ return [5 /*yield**/, _loop_1()];
334
+ case 4:
335
+ state_1 = _b.sent();
336
+ if (state_1 === "break")
337
+ return [3 /*break*/, 5];
338
+ return [3 /*break*/, 3];
339
+ case 5: return [3 /*break*/, 7];
340
+ case 6:
341
+ _a = _b.sent();
342
+ return [3 /*break*/, 7];
343
+ case 7:
344
+ // Clean up construction-phase elements
345
+ liveBadge.remove();
346
+ context.view.events.viewChanged.removeEventListener(redrawOnViewChange);
347
+ fillCanvas.remove();
348
+ if (points.length < 3)
349
+ return [2 /*return*/];
350
+ area = shoelaceArea(points);
351
+ persistCanvas = makeOverlayCanvas(context.view.container);
352
+ drawAreaOnCanvas(persistCanvas, context.view, points, color);
353
+ redrawPersist = function () {
354
+ return drawAreaOnCanvas(persistCanvas, context.view, points, color);
355
+ };
356
+ context.view.events.viewChanged.addEventListener(redrawPersist);
357
+ htManager = context.view.htmlTransientManager;
358
+ id = "area-".concat(Date.now());
359
+ mid = centroid(points);
360
+ htManager.add("".concat(id, "-badge"), makeBadge(color, "~ ".concat(area.toFixed(3), " m\u00B2")), mid, 'measurement');
361
+ points.forEach(function (p, i) {
362
+ htManager.add("".concat(id, "-dot").concat(i), makeDot(color), p, 'measurement');
363
+ });
364
+ registerMeasurementCleanup(function () {
365
+ persistCanvas.remove();
366
+ context.view.events.viewChanged.removeEventListener(redrawPersist);
367
+ htManager.remove("".concat(id, "-badge"));
368
+ points.forEach(function (_, i) {
369
+ htManager.remove("".concat(id, "-dot").concat(i));
370
+ });
371
+ });
372
+ return [2 /*return*/];
373
+ }
374
+ });
375
+ }); });
376
+ })];
377
+ case 1:
378
+ _a.sent();
379
+ return [2 /*return*/];
380
+ }
381
+ });
382
+ });
383
+ };
384
+ return AcApMeasureAreaCmd;
385
+ }(AcEdCommand));
386
+ export { AcApMeasureAreaCmd };
387
+ //# sourceMappingURL=AcApMeasureAreaCmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcApMeasureAreaCmd.js","sourceRoot":"","sources":["../../src/command/AcApMeasureAreaCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAEL,QAAQ,EAER,cAAc,EACf,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EAEL,WAAW,EACX,cAAc,EACd,YAAY,EACZ,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACb,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EACL,eAAe,EACf,QAAQ,EACR,SAAS,EACT,OAAO,EACP,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AAEvE;;;GAGG;AACH;IAAiC,sCAA+B;IAI9D,4BACE,IAAkB,EAClB,IAAqB,EACrB,KAAgB,EAChB,MAAoC;QAEpC,YAAA,MAAK,YAAC,IAAI,CAAC,SAAA;QACX,KAAI,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QACrC,KAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAA;QACxB,KAAI,CAAC,KAAK,CAAC,UAAU,GAAG,cAAc,CAAC,aAAa,CAAA;QACpD,KAAI,CAAC,OAAO,GAAG,MAAM,CAAA;;IACvB,CAAC;IAED,sBAAI,sCAAM;aAAV;YACE,OAAO,IAAI,CAAC,KAAK,CAAA;QACnB,CAAC;;;OAAA;IAED,mCAAM,GAAN,UAAO,CAAkB;QACvB,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAA;QACvB,IAAI,CAAC,O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AAC,CAAA;gDAEF,0BAA0B,CAAC;oDACzB,aAAa,CAAC,MAAM,EAAE,CAAA;oDACtB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAA;oDAClE,SAAS,CAAC,MAAM,CAAC,UAAG,EAAE,WAAQ,CAAC,CAAA;oDAC/B,MAAM,CAAC,OAAO,CAAC,UAAC,CAAC,EAAE,CAAC;wDAClB,SAAS,CAAC,MAAM,CAAC,UAAG,EAAE,iBAAO,CAAC,CAAE,CAAC,CAAA;oDACnC,CAAC,CAAC,CAAA;gDACJ,CAAC,CAAC,CAAA;;;;qCACH,CAAC;4BAzKF,CAyKE,CACH,EAAA;;wBA3KD,SA2KC,CAAA;;;;;KACF;IACH,yBAAC;AAAD,CAAC,AA/LD,CAAwC,WAAW,GA+LlD"}
@@ -0,0 +1,34 @@
1
+ import { AcCmColor, AcDbLine, AcGePoint3dLike } from '@mlightcad/data-model';
2
+ import { AcApContext } from '../app';
3
+ import { AcEdBaseView, AcEdCommand, AcEdPreviewJig } from '../editor';
4
+ /**
5
+ * Preview jig for the distance measurement command.
6
+ *
7
+ * Renders a live rubber-band line from the fixed first point to the current
8
+ * cursor position. The badge showing the live distance is rendered by the
9
+ * jig itself and is removed when the jig ends — it is intentionally short-lived
10
+ * and intrinsic to the interactive input UX.
11
+ */
12
+ export declare class AcApMeasureDistanceJig extends AcEdPreviewJig<AcGePoint3dLike> {
13
+ private _line;
14
+ private _p1;
15
+ private _view;
16
+ private _badge;
17
+ constructor(view: AcEdBaseView, p1: AcGePoint3dLike, color: AcCmColor);
18
+ get entity(): AcDbLine;
19
+ update(p2: AcGePoint3dLike): void;
20
+ end(): void;
21
+ }
22
+ /**
23
+ * Command that measures the straight-line distance between two points.
24
+ *
25
+ * Prompts the user to pick two world points, then registers a transient CAD
26
+ * line between them. Persistent DOM overlays (dots + badge) are placed via
27
+ * {@link AcTrHtmlTransientManager} using CSS2DObject, so they track zoom/pan
28
+ * automatically without manual viewChanged listeners.
29
+ */
30
+ export declare class AcApMeasureDistanceCmd extends AcEdCommand {
31
+ constructor();
32
+ execute(context: AcApContext): Promise<void>;
33
+ }
34
+ //# sourceMappingURL=AcApMeasureDistanceCmd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcApMeasureDistanceCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApMeasureDistanceCmd.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EAEhB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EACL,YAAY,EACZ,WAAW,EAGX,cAAc,EAIf,MAAM,WAAW,CAAA;AAalB;;;;;;;GAOG;AACH,qBAAa,sBAAuB,SAAQ,cAAc,CAAC,eAAe,CAAC;IACzE,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,GAAG,CAAiB;IAC5B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,MAAM,CAAgB;gBAElB,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS;IAYrE,IAAI,MAAM,IAAI,QAAQ,CAErB;IAED,MAAM,CAAC,EAAE,EAAE,eAAe;IAmB1B,GAAG;CAIJ;AAED;;;;;;;GAOG;AACH,qBAAa,sBAAuB,SAAQ,WAAW;;IAM/C,OAAO,CAAC,OAAO,EAAE,WAAW;CAqDnC"}
@@ -0,0 +1,191 @@
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 { AcDbLine, AcGiLineWeight } from '@mlightcad/data-model';
53
+ import { AcEdCommand, AcEdCorsorType, AcEdOpenMode, AcEdPreviewJig, AcEdPromptPointOptions, AcEdPromptStatus, AcEdViewMode } from '../editor';
54
+ import { AcApI18n } from '../i18n';
55
+ import { makeBadge, makeDot, makeLiveBadge, measurementColor } from '../util';
56
+ import { registerMeasurementCleanup } from './AcApClearMeasurementsCmd';
57
+ /** Returns the 2D Euclidean distance between two world points. */
58
+ function calcDist(p1, p2) {
59
+ var dx = p2.x - p1.x;
60
+ var dy = p2.y - p1.y;
61
+ return Math.sqrt(dx * dx + dy * dy);
62
+ }
63
+ /**
64
+ * Preview jig for the distance measurement command.
65
+ *
66
+ * Renders a live rubber-band line from the fixed first point to the current
67
+ * cursor position. The badge showing the live distance is rendered by the
68
+ * jig itself and is removed when the jig ends — it is intentionally short-lived
69
+ * and intrinsic to the interactive input UX.
70
+ */
71
+ var AcApMeasureDistanceJig = /** @class */ (function (_super) {
72
+ __extends(AcApMeasureDistanceJig, _super);
73
+ function AcApMeasureDistanceJig(view, p1, color) {
74
+ var _this = _super.call(this, view) || this;
75
+ _this._p1 = p1;
76
+ _this._view = view;
77
+ _this._line = new AcDbLine(p1, p1);
78
+ _this._line.color = color;
79
+ _this._line.lineWeight = AcGiLineWeight.LineWeight070;
80
+ // Live badge — short-lived, cleaned up in end()
81
+ _this._badge = makeLiveBadge(color);
82
+ return _this;
83
+ }
84
+ Object.defineProperty(AcApMeasureDistanceJig.prototype, "entity", {
85
+ get: function () {
86
+ return this._line;
87
+ },
88
+ enumerable: false,
89
+ configurable: true
90
+ });
91
+ AcApMeasureDistanceJig.prototype.update = function (p2) {
92
+ this._line.endPoint = p2;
93
+ var dist = calcDist(this._p1, p2);
94
+ if (dist < 0.0001) {
95
+ this._badge.style.display = 'none';
96
+ return;
97
+ }
98
+ this._badge.textContent = "~ ".concat(dist.toFixed(3), " m");
99
+ this._badge.style.display = 'block';
100
+ var mid = { x: (this._p1.x + p2.x) / 2, y: (this._p1.y + p2.y) / 2 };
101
+ var rect = this._view.canvas.getBoundingClientRect();
102
+ var s = this._view.worldToScreen(mid);
103
+ this._badge.style.left = "".concat(s.x + rect.left, "px");
104
+ this._badge.style.top = "".concat(s.y + rect.top, "px");
105
+ };
106
+ AcApMeasureDistanceJig.prototype.end = function () {
107
+ _super.prototype.end.call(this);
108
+ this._badge.remove();
109
+ };
110
+ return AcApMeasureDistanceJig;
111
+ }(AcEdPreviewJig));
112
+ export { AcApMeasureDistanceJig };
113
+ /**
114
+ * Command that measures the straight-line distance between two points.
115
+ *
116
+ * Prompts the user to pick two world points, then registers a transient CAD
117
+ * line between them. Persistent DOM overlays (dots + badge) are placed via
118
+ * {@link AcTrHtmlTransientManager} using CSS2DObject, so they track zoom/pan
119
+ * automatically without manual viewChanged listeners.
120
+ */
121
+ var AcApMeasureDistanceCmd = /** @class */ (function (_super) {
122
+ __extends(AcApMeasureDistanceCmd, _super);
123
+ function AcApMeasureDistanceCmd() {
124
+ var _this = _super.call(this) || this;
125
+ _this.mode = AcEdOpenMode.Read;
126
+ return _this;
127
+ }
128
+ AcApMeasureDistanceCmd.prototype.execute = function (context) {
129
+ return __awaiter(this, void 0, void 0, function () {
130
+ var editor, color;
131
+ var _this = this;
132
+ return __generator(this, function (_a) {
133
+ switch (_a.label) {
134
+ case 0:
135
+ editor = context.view.editor;
136
+ color = measurementColor(context.doc.database);
137
+ return [4 /*yield*/, context.view.withMode(AcEdViewMode.SELECTION, function () {
138
+ return editor.withCursor(AcEdCorsorType.Crosshair, function () { return __awaiter(_this, void 0, void 0, function () {
139
+ var p1Prompt, p1Result, p1, p2Prompt, p2Result, p2, dist, line, htManager, id, mid;
140
+ return __generator(this, function (_a) {
141
+ switch (_a.label) {
142
+ case 0:
143
+ p1Prompt = new AcEdPromptPointOptions(AcApI18n.t('jig.measureDistance.firstPoint'));
144
+ return [4 /*yield*/, editor.getPoint(p1Prompt)];
145
+ case 1:
146
+ p1Result = _a.sent();
147
+ if (p1Result.status !== AcEdPromptStatus.OK)
148
+ return [2 /*return*/];
149
+ p1 = p1Result.value;
150
+ p2Prompt = new AcEdPromptPointOptions(AcApI18n.t('jig.measureDistance.secondPoint'));
151
+ p2Prompt.useBasePoint = true;
152
+ p2Prompt.jig = new AcApMeasureDistanceJig(context.view, p1, color);
153
+ return [4 /*yield*/, editor.getPoint(p2Prompt)];
154
+ case 2:
155
+ p2Result = _a.sent();
156
+ if (p2Result.status !== AcEdPromptStatus.OK)
157
+ return [2 /*return*/];
158
+ p2 = p2Result.value;
159
+ dist = calcDist(p1, p2);
160
+ line = new AcDbLine(p1, p2);
161
+ line.color = color;
162
+ line.lineWeight = AcGiLineWeight.LineWeight070;
163
+ context.view.addTransientEntity(line);
164
+ htManager = context.view.htmlTransientManager;
165
+ id = "dist-".concat(Date.now());
166
+ mid = { x: (p1.x + p2.x) / 2, y: (p1.y + p2.y) / 2 };
167
+ htManager.add("".concat(id, "-dot1"), makeDot(color), p1, 'measurement');
168
+ htManager.add("".concat(id, "-dot2"), makeDot(color), p2, 'measurement');
169
+ htManager.add("".concat(id, "-badge"), makeBadge(color, "~ ".concat(dist.toFixed(3), " m")), mid, 'measurement');
170
+ registerMeasurementCleanup(function () {
171
+ context.view.removeTransientEntity(line.objectId);
172
+ htManager.remove("".concat(id, "-dot1"));
173
+ htManager.remove("".concat(id, "-dot2"));
174
+ htManager.remove("".concat(id, "-badge"));
175
+ });
176
+ return [2 /*return*/];
177
+ }
178
+ });
179
+ }); });
180
+ })];
181
+ case 1:
182
+ _a.sent();
183
+ return [2 /*return*/];
184
+ }
185
+ });
186
+ });
187
+ };
188
+ return AcApMeasureDistanceCmd;
189
+ }(AcEdCommand));
190
+ export { AcApMeasureDistanceCmd };
191
+ //# sourceMappingURL=AcApMeasureDistanceCmd.js.map