@mlightcad/cad-simple-viewer 1.4.11 → 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 (261) hide show
  1. package/dist/index.js +10751 -8434
  2. package/dist/index.umd.cjs +78 -77
  3. package/dist/libredwg-parser-worker.js +6603 -12203
  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 +1 -0
  8. package/lib/app/AcApDocManager.d.ts.map +1 -1
  9. package/lib/app/AcApDocManager.js +7 -1
  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.map +1 -1
  27. package/lib/command/AcApCircleCmd.js +10 -4
  28. package/lib/command/AcApCircleCmd.js.map +1 -1
  29. package/lib/command/AcApClearMeasurementsCmd.d.ts +1 -1
  30. package/lib/command/AcApClearMeasurementsCmd.d.ts.map +1 -1
  31. package/lib/command/AcApClearMeasurementsCmd.js +2 -4
  32. package/lib/command/AcApClearMeasurementsCmd.js.map +1 -1
  33. package/lib/command/AcApConvertToDxfCmd.d.ts +9 -0
  34. package/lib/command/AcApConvertToDxfCmd.d.ts.map +1 -0
  35. package/lib/command/AcApConvertToDxfCmd.js +75 -0
  36. package/lib/command/AcApConvertToDxfCmd.js.map +1 -0
  37. package/lib/command/AcApDimLinearCmd.d.ts.map +1 -1
  38. package/lib/command/AcApDimLinearCmd.js +14 -5
  39. package/lib/command/AcApDimLinearCmd.js.map +1 -1
  40. package/lib/command/AcApDxfConvertor.d.ts +12 -0
  41. package/lib/command/AcApDxfConvertor.d.ts.map +1 -0
  42. package/lib/command/AcApDxfConvertor.js +37 -0
  43. package/lib/command/AcApDxfConvertor.js.map +1 -0
  44. package/lib/command/AcApEraseCmd.d.ts.map +1 -1
  45. package/lib/command/AcApEraseCmd.js +10 -6
  46. package/lib/command/AcApEraseCmd.js.map +1 -1
  47. package/lib/command/AcApLineCmd.d.ts.map +1 -1
  48. package/lib/command/AcApLineCmd.js +10 -4
  49. package/lib/command/AcApLineCmd.js.map +1 -1
  50. package/lib/command/AcApMTextCmd.d.ts.map +1 -1
  51. package/lib/command/AcApMTextCmd.js +6 -3
  52. package/lib/command/AcApMTextCmd.js.map +1 -1
  53. package/lib/command/AcApMeasureAngleCmd.d.ts.map +1 -1
  54. package/lib/command/AcApMeasureAngleCmd.js +134 -123
  55. package/lib/command/AcApMeasureAngleCmd.js.map +1 -1
  56. package/lib/command/AcApMeasureArcCmd.d.ts.map +1 -1
  57. package/lib/command/AcApMeasureArcCmd.js +165 -147
  58. package/lib/command/AcApMeasureArcCmd.js.map +1 -1
  59. package/lib/command/AcApMeasureAreaCmd.d.ts.map +1 -1
  60. package/lib/command/AcApMeasureAreaCmd.js +183 -175
  61. package/lib/command/AcApMeasureAreaCmd.js.map +1 -1
  62. package/lib/command/AcApMeasureDistanceCmd.d.ts.map +1 -1
  63. package/lib/command/AcApMeasureDistanceCmd.js +51 -39
  64. package/lib/command/AcApMeasureDistanceCmd.js.map +1 -1
  65. package/lib/command/AcApPolylineCmd.d.ts +71 -0
  66. package/lib/command/AcApPolylineCmd.d.ts.map +1 -0
  67. package/lib/command/AcApPolylineCmd.js +569 -0
  68. package/lib/command/AcApPolylineCmd.js.map +1 -0
  69. package/lib/command/AcApRectCmd.d.ts.map +1 -1
  70. package/lib/command/AcApRectCmd.js +10 -4
  71. package/lib/command/AcApRectCmd.js.map +1 -1
  72. package/lib/command/AcApRevCloudCmd.d.ts.map +1 -1
  73. package/lib/command/AcApRevCloudCmd.js +10 -4
  74. package/lib/command/AcApRevCloudCmd.js.map +1 -1
  75. package/lib/command/AcApSketchCmd.d.ts.map +1 -1
  76. package/lib/command/AcApSketchCmd.js +11 -7
  77. package/lib/command/AcApSketchCmd.js.map +1 -1
  78. package/lib/command/AcApSplineCmd.d.ts +20 -0
  79. package/lib/command/AcApSplineCmd.d.ts.map +1 -0
  80. package/lib/command/AcApSplineCmd.js +213 -0
  81. package/lib/command/AcApSplineCmd.js.map +1 -0
  82. package/lib/command/AcApSysVarCmd.d.ts.map +1 -1
  83. package/lib/command/AcApSysVarCmd.js +6 -3
  84. package/lib/command/AcApSysVarCmd.js.map +1 -1
  85. package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -1
  86. package/lib/command/AcApZoomToBoxCmd.js +6 -4
  87. package/lib/command/AcApZoomToBoxCmd.js.map +1 -1
  88. package/lib/command/index.d.ts +5 -0
  89. package/lib/command/index.d.ts.map +1 -1
  90. package/lib/command/index.js +5 -0
  91. package/lib/command/index.js.map +1 -1
  92. package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -1
  93. package/lib/editor/command/AcEdCommandIterator.js.map +1 -1
  94. package/lib/editor/global/AcEdUiTheme.d.ts +4 -0
  95. package/lib/editor/global/AcEdUiTheme.d.ts.map +1 -0
  96. package/lib/editor/global/AcEdUiTheme.js +44 -0
  97. package/lib/editor/global/AcEdUiTheme.js.map +1 -0
  98. package/lib/editor/global/index.d.ts +1 -0
  99. package/lib/editor/global/index.d.ts.map +1 -1
  100. package/lib/editor/global/index.js +1 -0
  101. package/lib/editor/global/index.js.map +1 -1
  102. package/lib/editor/input/AcEdCursorManager.d.ts +10 -0
  103. package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
  104. package/lib/editor/input/AcEdCursorManager.js +24 -4
  105. package/lib/editor/input/AcEdCursorManager.js.map +1 -1
  106. package/lib/editor/input/AcEdInputModifiers.d.ts +39 -0
  107. package/lib/editor/input/AcEdInputModifiers.d.ts.map +1 -0
  108. package/lib/editor/input/AcEdInputModifiers.js +2 -0
  109. package/lib/editor/input/AcEdInputModifiers.js.map +1 -0
  110. package/lib/editor/input/AcEdInputToggles.d.ts +24 -0
  111. package/lib/editor/input/AcEdInputToggles.d.ts.map +1 -0
  112. package/lib/editor/input/AcEdInputToggles.js +2 -0
  113. package/lib/editor/input/AcEdInputToggles.js.map +1 -0
  114. package/lib/editor/input/AcEdPromptStateMachine.d.ts +110 -0
  115. package/lib/editor/input/AcEdPromptStateMachine.d.ts.map +1 -0
  116. package/lib/editor/input/AcEdPromptStateMachine.js +147 -0
  117. package/lib/editor/input/AcEdPromptStateMachine.js.map +1 -0
  118. package/lib/editor/input/AcEditor.d.ts +58 -9
  119. package/lib/editor/input/AcEditor.d.ts.map +1 -1
  120. package/lib/editor/input/AcEditor.js +96 -1
  121. package/lib/editor/input/AcEditor.js.map +1 -1
  122. package/lib/editor/input/index.d.ts +3 -0
  123. package/lib/editor/input/index.d.ts.map +1 -1
  124. package/lib/editor/input/index.js +3 -0
  125. package/lib/editor/input/index.js.map +1 -1
  126. package/lib/editor/input/marker/AcEdMarker.d.ts.map +1 -1
  127. package/lib/editor/input/marker/AcEdMarker.js +3 -3
  128. package/lib/editor/input/marker/AcEdMarker.js.map +1 -1
  129. package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts.map +1 -1
  130. package/lib/editor/input/prompt/AcEdKeywordCollection.js +11 -4
  131. package/lib/editor/input/prompt/AcEdKeywordCollection.js.map +1 -1
  132. package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts +1 -1
  133. package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts.map +1 -1
  134. package/lib/editor/input/prompt/AcEdPromptAngleOptions.js +2 -2
  135. package/lib/editor/input/prompt/AcEdPromptAngleOptions.js.map +1 -1
  136. package/lib/editor/input/prompt/AcEdPromptBoxResult.d.ts +12 -0
  137. package/lib/editor/input/prompt/AcEdPromptBoxResult.d.ts.map +1 -0
  138. package/lib/editor/input/prompt/AcEdPromptBoxResult.js +30 -0
  139. package/lib/editor/input/prompt/AcEdPromptBoxResult.js.map +1 -0
  140. package/lib/editor/input/prompt/AcEdPromptDoubleResult.d.ts +9 -0
  141. package/lib/editor/input/prompt/AcEdPromptDoubleResult.d.ts.map +1 -0
  142. package/lib/editor/input/prompt/AcEdPromptDoubleResult.js +28 -0
  143. package/lib/editor/input/prompt/AcEdPromptDoubleResult.js.map +1 -0
  144. package/lib/editor/input/prompt/AcEdPromptEntityOptions.d.ts +1 -1
  145. package/lib/editor/input/prompt/AcEdPromptEntityOptions.d.ts.map +1 -1
  146. package/lib/editor/input/prompt/AcEdPromptEntityOptions.js +2 -2
  147. package/lib/editor/input/prompt/AcEdPromptEntityOptions.js.map +1 -1
  148. package/lib/editor/input/prompt/AcEdPromptEntityResult.d.ts +14 -0
  149. package/lib/editor/input/prompt/AcEdPromptEntityResult.d.ts.map +1 -0
  150. package/lib/editor/input/prompt/AcEdPromptEntityResult.js +31 -0
  151. package/lib/editor/input/prompt/AcEdPromptEntityResult.js.map +1 -0
  152. package/lib/editor/input/prompt/AcEdPromptIntegerResult.d.ts +9 -0
  153. package/lib/editor/input/prompt/AcEdPromptIntegerResult.d.ts.map +1 -0
  154. package/lib/editor/input/prompt/AcEdPromptIntegerResult.js +28 -0
  155. package/lib/editor/input/prompt/AcEdPromptIntegerResult.js.map +1 -0
  156. package/lib/editor/input/prompt/AcEdPromptKeywordOptions.d.ts +1 -1
  157. package/lib/editor/input/prompt/AcEdPromptKeywordOptions.d.ts.map +1 -1
  158. package/lib/editor/input/prompt/AcEdPromptKeywordOptions.js +2 -2
  159. package/lib/editor/input/prompt/AcEdPromptKeywordOptions.js.map +1 -1
  160. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts +1 -1
  161. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts.map +1 -1
  162. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js +2 -2
  163. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js.map +1 -1
  164. package/lib/editor/input/prompt/AcEdPromptOptions.d.ts +3 -2
  165. package/lib/editor/input/prompt/AcEdPromptOptions.d.ts.map +1 -1
  166. package/lib/editor/input/prompt/AcEdPromptOptions.js +15 -4
  167. package/lib/editor/input/prompt/AcEdPromptOptions.js.map +1 -1
  168. package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts +1 -1
  169. package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts.map +1 -1
  170. package/lib/editor/input/prompt/AcEdPromptPointOptions.js +2 -2
  171. package/lib/editor/input/prompt/AcEdPromptPointOptions.js.map +1 -1
  172. package/lib/editor/input/prompt/AcEdPromptPointResult.d.ts +3 -3
  173. package/lib/editor/input/prompt/AcEdPromptSelectionOptions.d.ts +1 -1
  174. package/lib/editor/input/prompt/AcEdPromptSelectionOptions.d.ts.map +1 -1
  175. package/lib/editor/input/prompt/AcEdPromptSelectionOptions.js +2 -2
  176. package/lib/editor/input/prompt/AcEdPromptSelectionOptions.js.map +1 -1
  177. package/lib/editor/input/prompt/AcEdPromptSelectionResult.d.ts +12 -0
  178. package/lib/editor/input/prompt/AcEdPromptSelectionResult.d.ts.map +1 -0
  179. package/lib/editor/input/prompt/AcEdPromptSelectionResult.js +30 -0
  180. package/lib/editor/input/prompt/AcEdPromptSelectionResult.js.map +1 -0
  181. package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts +1 -1
  182. package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts.map +1 -1
  183. package/lib/editor/input/prompt/AcEdPromptStringOptions.js +2 -2
  184. package/lib/editor/input/prompt/AcEdPromptStringOptions.js.map +1 -1
  185. package/lib/editor/input/prompt/index.d.ts +9 -0
  186. package/lib/editor/input/prompt/index.d.ts.map +1 -1
  187. package/lib/editor/input/prompt/index.js +9 -0
  188. package/lib/editor/input/prompt/index.js.map +1 -1
  189. package/lib/editor/input/session/AcEdKeywordSession.d.ts +2 -1
  190. package/lib/editor/input/session/AcEdKeywordSession.d.ts.map +1 -1
  191. package/lib/editor/input/session/AcEdKeywordSession.js +7 -1
  192. package/lib/editor/input/session/AcEdKeywordSession.js.map +1 -1
  193. package/lib/editor/input/ui/AcEdCommandLine.d.ts +4 -1
  194. package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
  195. package/lib/editor/input/ui/AcEdCommandLine.js +34 -5
  196. package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
  197. package/lib/editor/input/ui/AcEdFloatingInput.d.ts +23 -1
  198. package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -1
  199. package/lib/editor/input/ui/AcEdFloatingInput.js +140 -26
  200. package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -1
  201. package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts +2 -0
  202. package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts.map +1 -1
  203. package/lib/editor/input/ui/AcEdFloatingInputBox.js +4 -0
  204. package/lib/editor/input/ui/AcEdFloatingInputBox.js.map +1 -1
  205. package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts +7 -0
  206. package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts.map +1 -1
  207. package/lib/editor/input/ui/AcEdFloatingInputBoxes.js +14 -6
  208. package/lib/editor/input/ui/AcEdFloatingInputBoxes.js.map +1 -1
  209. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +5 -0
  210. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -1
  211. package/lib/editor/input/ui/AcEdFloatingMessage.d.ts +12 -0
  212. package/lib/editor/input/ui/AcEdFloatingMessage.d.ts.map +1 -1
  213. package/lib/editor/input/ui/AcEdFloatingMessage.js +61 -2
  214. package/lib/editor/input/ui/AcEdFloatingMessage.js.map +1 -1
  215. package/lib/editor/input/ui/AcEdInputManager.d.ts +47 -13
  216. package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
  217. package/lib/editor/input/ui/AcEdInputManager.js +847 -383
  218. package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
  219. package/lib/editor/input/ui/AcEdRubberBand.js +1 -1
  220. package/lib/editor/input/ui/AcEdRubberBand.js.map +1 -1
  221. package/lib/editor/view/AcEdBaseView.d.ts +66 -0
  222. package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
  223. package/lib/editor/view/AcEdBaseView.js +170 -0
  224. package/lib/editor/view/AcEdBaseView.js.map +1 -1
  225. package/lib/editor/view/AcEdSpatialQueryResult.d.ts.map +1 -1
  226. package/lib/i18n/en/command.d.ts +15 -0
  227. package/lib/i18n/en/command.d.ts.map +1 -1
  228. package/lib/i18n/en/command.js +15 -0
  229. package/lib/i18n/en/command.js.map +1 -1
  230. package/lib/i18n/en/jig.d.ts +110 -0
  231. package/lib/i18n/en/jig.d.ts.map +1 -1
  232. package/lib/i18n/en/jig.js +110 -0
  233. package/lib/i18n/en/jig.js.map +1 -1
  234. package/lib/i18n/zh/command.d.ts +15 -0
  235. package/lib/i18n/zh/command.d.ts.map +1 -1
  236. package/lib/i18n/zh/command.js +15 -0
  237. package/lib/i18n/zh/command.js.map +1 -1
  238. package/lib/i18n/zh/jig.d.ts +110 -0
  239. package/lib/i18n/zh/jig.d.ts.map +1 -1
  240. package/lib/i18n/zh/jig.js +110 -0
  241. package/lib/i18n/zh/jig.js.map +1 -1
  242. package/lib/util/AcApMeasurementElementGenerator.d.ts +36 -0
  243. package/lib/util/AcApMeasurementElementGenerator.d.ts.map +1 -0
  244. package/lib/util/AcApMeasurementElementGenerator.js +92 -0
  245. package/lib/util/AcApMeasurementElementGenerator.js.map +1 -0
  246. package/lib/util/index.d.ts +1 -1
  247. package/lib/util/index.d.ts.map +1 -1
  248. package/lib/util/index.js +1 -1
  249. package/lib/util/index.js.map +1 -1
  250. package/lib/view/AcTrLayoutView.d.ts +6 -0
  251. package/lib/view/AcTrLayoutView.d.ts.map +1 -1
  252. package/lib/view/AcTrLayoutView.js +20 -0
  253. package/lib/view/AcTrLayoutView.js.map +1 -1
  254. package/lib/view/AcTrView2d.d.ts.map +1 -1
  255. package/lib/view/AcTrView2d.js +86 -46
  256. package/lib/view/AcTrView2d.js.map +1 -1
  257. package/package.json +10 -10
  258. package/lib/util/AcApMeasurementUtils.d.ts +0 -12
  259. package/lib/util/AcApMeasurementUtils.d.ts.map +0 -1
  260. package/lib/util/AcApMeasurementUtils.js +0 -36
  261. package/lib/util/AcApMeasurementUtils.js.map +0 -1
@@ -0,0 +1,71 @@
1
+ import { AcDbPolyline, AcGePoint2d, AcGePoint2dLike } from '@mlightcad/data-model';
2
+ import { AcApContext } from '../app';
3
+ import { AcEdBaseView, AcEdCommand, AcEdPreviewJig } from '../editor';
4
+ /**
5
+ * Preview jig that dynamically updates a polyline while the user is acquiring
6
+ * the *next* point.
7
+ *
8
+ * Responsibilities:
9
+ * - Keep the already-confirmed vertices visible.
10
+ * - Add a transient "current" vertex that follows the cursor.
11
+ * - Update the bulge of the last confirmed vertex to preview arc/line changes.
12
+ *
13
+ * Why this jig exists:
14
+ * - Point acquisition needs *live* geometry updates as the cursor moves.
15
+ * - We update the polyline incrementally (add/remove a single temp vertex)
16
+ * instead of `reset()` to avoid flicker and preserve transient state.
17
+ */
18
+ export declare class AcApPolylineJig extends AcEdPreviewJig<AcGePoint2dLike> {
19
+ private _polyline;
20
+ private _points;
21
+ private _bulges;
22
+ private _currentBulge?;
23
+ private _bulgeProvider?;
24
+ private _baseCount;
25
+ private _hasTemp;
26
+ private _appliedBulge?;
27
+ /**
28
+ * Creates a polyline jig.
29
+ *
30
+ * @param view - The associated view
31
+ */
32
+ /**
33
+ * Create a polyline preview jig for point acquisition.
34
+ *
35
+ * @param view - The associated view for transient rendering.
36
+ * @param points - Confirmed polyline vertices.
37
+ * @param bulges - Bulge values aligned with `points`.
38
+ * @param currentBulge - Optional fixed bulge used for the preview segment.
39
+ * @param bulgeProvider - Optional function to compute bulge based on the
40
+ * current cursor point.
41
+ */
42
+ constructor(view: AcEdBaseView, points: AcGePoint2d[], bulges: (number | undefined)[], currentBulge?: number, bulgeProvider?: (endPoint: AcGePoint2dLike) => number | undefined);
43
+ /**
44
+ * The transient polyline entity being previewed.
45
+ */
46
+ get entity(): AcDbPolyline;
47
+ /**
48
+ * Update the preview polyline as the cursor moves.
49
+ *
50
+ * This updates:
51
+ * - The bulge of the last confirmed vertex (if needed).
52
+ * - A single temporary vertex representing the current cursor position.
53
+ */
54
+ update(point: AcGePoint2dLike): void;
55
+ /**
56
+ * Seed the preview entity with the confirmed vertices.
57
+ */
58
+ private addBaseVertices;
59
+ }
60
+ /**
61
+ * Command to create one polyline.
62
+ */
63
+ export declare class AcApPolylineCmd extends AcEdCommand {
64
+ constructor();
65
+ private computeBulgeFromCenter;
66
+ private computeCircleCenter;
67
+ private computeBulgeFromThreePoints;
68
+ private computeBulgeFromRadius;
69
+ execute(context: AcApContext): Promise<void>;
70
+ }
71
+ //# sourceMappingURL=AcApPolylineCmd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcApPolylineCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApPolylineCmd.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,eAAe,EAEhB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,WAAW,EAAkB,MAAM,QAAQ,CAAA;AACpD,OAAO,EACL,YAAY,EACZ,WAAW,EAEX,cAAc,EAQf,MAAM,WAAW,CAAA;AAGlB;;;;;;;;;;;;;GAaG;AACH,qBAAa,eAAgB,SAAQ,cAAc,CAAC,eAAe,CAAC;IAClE,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,aAAa,CAAC,CAAQ;IAC9B,OAAO,CAAC,cAAc,CAAC,CAAmD;IAC1E,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,aAAa,CAAC,CAAQ;IAE9B;;;;OAIG;IACH;;;;;;;;;OASG;gBAED,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,WAAW,EAAE,EACrB,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EAC9B,YAAY,CAAC,EAAE,MAAM,EACrB,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,MAAM,GAAG,SAAS;IAanE;;OAEG;IACH,IAAI,MAAM,IAAI,YAAY,CAEzB;IAED;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,EAAE,eAAe;IA4B7B;;OAEG;IACH,OAAO,CAAC,eAAe;CAKxB;AAqDD;;GAEG;AACH,qBAAa,eAAgB,SAAQ,WAAW;;IAM9C,OAAO,CAAC,sBAAsB;IAgB9B,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,2BAA2B;IAUnC,OAAO,CAAC,sBAAsB;IAuBxB,OAAO,CAAC,OAAO,EAAE,WAAW;CA4XnC"}
@@ -0,0 +1,569 @@
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 { AcDbPolyline, AcGePoint2d, AcGePoint3d } from '@mlightcad/data-model';
53
+ import { AcApDocManager } from '../app';
54
+ import { AcEdCommand, AcEdOpenMode, AcEdPreviewJig, AcEdPromptDoubleOptions, AcEdPromptPointOptions, AcEdPromptStateMachine, AcEdPromptStatus } from '../editor';
55
+ import { AcApI18n } from '../i18n';
56
+ /**
57
+ * Preview jig that dynamically updates a polyline while the user is acquiring
58
+ * the *next* point.
59
+ *
60
+ * Responsibilities:
61
+ * - Keep the already-confirmed vertices visible.
62
+ * - Add a transient "current" vertex that follows the cursor.
63
+ * - Update the bulge of the last confirmed vertex to preview arc/line changes.
64
+ *
65
+ * Why this jig exists:
66
+ * - Point acquisition needs *live* geometry updates as the cursor moves.
67
+ * - We update the polyline incrementally (add/remove a single temp vertex)
68
+ * instead of `reset()` to avoid flicker and preserve transient state.
69
+ */
70
+ var AcApPolylineJig = /** @class */ (function (_super) {
71
+ __extends(AcApPolylineJig, _super);
72
+ /**
73
+ * Creates a polyline jig.
74
+ *
75
+ * @param view - The associated view
76
+ */
77
+ /**
78
+ * Create a polyline preview jig for point acquisition.
79
+ *
80
+ * @param view - The associated view for transient rendering.
81
+ * @param points - Confirmed polyline vertices.
82
+ * @param bulges - Bulge values aligned with `points`.
83
+ * @param currentBulge - Optional fixed bulge used for the preview segment.
84
+ * @param bulgeProvider - Optional function to compute bulge based on the
85
+ * current cursor point.
86
+ */
87
+ function AcApPolylineJig(view, points, bulges, currentBulge, bulgeProvider) {
88
+ var _this = _super.call(this, view) || this;
89
+ _this._hasTemp = false;
90
+ _this._polyline = new AcDbPolyline();
91
+ _this._points = points;
92
+ _this._bulges = bulges;
93
+ _this._currentBulge = currentBulge;
94
+ _this._bulgeProvider = bulgeProvider;
95
+ _this._baseCount = points.length;
96
+ _this._appliedBulge = _this._bulges[_this._baseCount - 1];
97
+ _this.addBaseVertices();
98
+ return _this;
99
+ }
100
+ Object.defineProperty(AcApPolylineJig.prototype, "entity", {
101
+ /**
102
+ * The transient polyline entity being previewed.
103
+ */
104
+ get: function () {
105
+ return this._polyline;
106
+ },
107
+ enumerable: false,
108
+ configurable: true
109
+ });
110
+ /**
111
+ * Update the preview polyline as the cursor moves.
112
+ *
113
+ * This updates:
114
+ * - The bulge of the last confirmed vertex (if needed).
115
+ * - A single temporary vertex representing the current cursor position.
116
+ */
117
+ AcApPolylineJig.prototype.update = function (point) {
118
+ var _a, _b;
119
+ if (this._baseCount === 0)
120
+ return;
121
+ if (this._hasTemp) {
122
+ this._polyline.removeVertexAt(this._baseCount);
123
+ this._hasTemp = false;
124
+ }
125
+ var lastIndex = this._baseCount - 1;
126
+ var dynamicBulge = (_a = this._bulgeProvider) === null || _a === void 0 ? void 0 : _a.call(this, point);
127
+ var desiredBulge = (_b = dynamicBulge !== null && dynamicBulge !== void 0 ? dynamicBulge : this._currentBulge) !== null && _b !== void 0 ? _b : this._bulges[lastIndex];
128
+ if (desiredBulge !== this._appliedBulge) {
129
+ var lastPoint = this._points[lastIndex];
130
+ this._polyline.removeVertexAt(lastIndex);
131
+ this._polyline.addVertexAt(lastIndex, lastPoint, desiredBulge);
132
+ this._appliedBulge = desiredBulge;
133
+ }
134
+ this._polyline.addVertexAt(this._baseCount, new AcGePoint2d(point), undefined);
135
+ this._hasTemp = true;
136
+ };
137
+ /**
138
+ * Seed the preview entity with the confirmed vertices.
139
+ */
140
+ AcApPolylineJig.prototype.addBaseVertices = function () {
141
+ var _this = this;
142
+ this._points.forEach(function (p, index) {
143
+ return _this._polyline.addVertexAt(index, p, _this._bulges[index]);
144
+ });
145
+ };
146
+ return AcApPolylineJig;
147
+ }(AcEdPreviewJig));
148
+ export { AcApPolylineJig };
149
+ /**
150
+ * Static preview jig used to keep the already-built polyline visible during
151
+ * *non-point* prompts (angle, center, radius, etc.).
152
+ *
153
+ * Why this jig exists:
154
+ * - Some prompts (like `getDouble`) don't update geometry, but the existing
155
+ * polyline should remain visible so the user doesn't lose context.
156
+ * - Using a separate jig avoids coupling static rendering with the dynamic
157
+ * point-following behavior of {@link AcApPolylineJig}.
158
+ *
159
+ * In short:
160
+ * - `AcApPolylineJig` is for live point tracking.
161
+ * - `AcApPolylineStaticJig` is for "hold the drawing while asking other inputs".
162
+ */
163
+ var AcApPolylineStaticJig = /** @class */ (function (_super) {
164
+ __extends(AcApPolylineStaticJig, _super);
165
+ /**
166
+ * Create a static polyline preview jig.
167
+ *
168
+ * @param view - The associated view for transient rendering.
169
+ * @param points - Confirmed polyline vertices.
170
+ * @param bulges - Bulge values aligned with `points`.
171
+ */
172
+ function AcApPolylineStaticJig(view, points, bulges) {
173
+ var _this = _super.call(this, view) || this;
174
+ _this._polyline = new AcDbPolyline();
175
+ points.forEach(function (p, index) {
176
+ return _this._polyline.addVertexAt(index, p, bulges[index]);
177
+ });
178
+ return _this;
179
+ }
180
+ Object.defineProperty(AcApPolylineStaticJig.prototype, "entity", {
181
+ /**
182
+ * The transient polyline entity being previewed.
183
+ */
184
+ get: function () {
185
+ return this._polyline;
186
+ },
187
+ enumerable: false,
188
+ configurable: true
189
+ });
190
+ /**
191
+ * No-op update. This jig keeps a static preview visible.
192
+ */
193
+ AcApPolylineStaticJig.prototype.update = function (_value) {
194
+ // Static preview: keep current polyline visible during prompts.
195
+ };
196
+ return AcApPolylineStaticJig;
197
+ }(AcEdPreviewJig));
198
+ /**
199
+ * Command to create one polyline.
200
+ */
201
+ var AcApPolylineCmd = /** @class */ (function (_super) {
202
+ __extends(AcApPolylineCmd, _super);
203
+ function AcApPolylineCmd() {
204
+ var _this = _super.call(this) || this;
205
+ _this.mode = AcEdOpenMode.Write;
206
+ return _this;
207
+ }
208
+ AcApPolylineCmd.prototype.computeBulgeFromCenter = function (start, end, center) {
209
+ var v1x = start.x - center.x;
210
+ var v1y = start.y - center.y;
211
+ var v2x = end.x - center.x;
212
+ var v2y = end.y - center.y;
213
+ var cross = v1x * v2y - v1y * v2x;
214
+ var dot = v1x * v2x + v1y * v2y;
215
+ var angle = Math.atan2(cross, dot);
216
+ if (!Number.isFinite(angle))
217
+ return undefined;
218
+ return Math.tan(angle / 4);
219
+ };
220
+ AcApPolylineCmd.prototype.computeCircleCenter = function (p1, p2, p3) {
221
+ var x1 = p1.x;
222
+ var y1 = p1.y;
223
+ var x2 = p2.x;
224
+ var y2 = p2.y;
225
+ var x3 = p3.x;
226
+ var y3 = p3.y;
227
+ var a = x1 - x2;
228
+ var b = y1 - y2;
229
+ var c = x1 - x3;
230
+ var d = y1 - y3;
231
+ var e = (x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2) / 2;
232
+ var f = (x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3) / 2;
233
+ var det = a * d - b * c;
234
+ if (Math.abs(det) < 1e-9)
235
+ return undefined;
236
+ var cx = (d * e - b * f) / det;
237
+ var cy = (-c * e + a * f) / det;
238
+ return new AcGePoint2d(cx, cy);
239
+ };
240
+ AcApPolylineCmd.prototype.computeBulgeFromThreePoints = function (start, mid, end) {
241
+ var center = this.computeCircleCenter(start, mid, end);
242
+ if (!center)
243
+ return undefined;
244
+ return this.computeBulgeFromCenter(start, end, center);
245
+ };
246
+ AcApPolylineCmd.prototype.computeBulgeFromRadius = function (start, end, radius) {
247
+ var r = Math.abs(radius);
248
+ var dx = end.x - start.x;
249
+ var dy = end.y - start.y;
250
+ var chord = Math.hypot(dx, dy);
251
+ if (chord === 0 || chord > 2 * r)
252
+ return undefined;
253
+ var midx = (start.x + end.x) / 2;
254
+ var midy = (start.y + end.y) / 2;
255
+ var h = Math.sqrt(Math.max(0, r * r - (chord * chord) / 4));
256
+ var ux = -dy / chord;
257
+ var uy = dx / chord;
258
+ var sign = radius >= 0 ? 1 : -1;
259
+ var cx = midx + ux * h * sign;
260
+ var cy = midy + uy * h * sign;
261
+ var center = new AcGePoint2d(cx, cy);
262
+ return this.computeBulgeFromCenter(start, end, center);
263
+ };
264
+ AcApPolylineCmd.prototype.execute = function (context) {
265
+ return __awaiter(this, void 0, void 0, function () {
266
+ var points, bulges, closed, ARC_BULGE, getArcDirectionFactor, applyArcDirection, computeBulgeFromCenter, computeBulgeFromThreePoints, computeBulgeFromRadius, createStaticJig, createPreviewJig, getCurrentPoint, setSegmentBulge, appendPoint, undoLast, shouldFinish, LineState, ArcState, firstPointPrompt, firstPointResult, machine, db, polyline_1;
267
+ var _this = this;
268
+ return __generator(this, function (_a) {
269
+ switch (_a.label) {
270
+ case 0:
271
+ AcApDocManager.instance.editor.resetInputToggles();
272
+ points = [];
273
+ bulges = [];
274
+ closed = false;
275
+ ARC_BULGE = 0.5;
276
+ getArcDirectionFactor = function () {
277
+ var toggles = AcApDocManager.instance.editor.getInputToggles();
278
+ return toggles.ctrlArcFlip ? -1 : 1;
279
+ };
280
+ applyArcDirection = function (bulge) {
281
+ if (bulge == null)
282
+ return bulge;
283
+ return bulge * getArcDirectionFactor();
284
+ };
285
+ computeBulgeFromCenter = function (start, end, center) { return _this.computeBulgeFromCenter(start, end, center); };
286
+ computeBulgeFromThreePoints = function (start, mid, end) { return _this.computeBulgeFromThreePoints(start, mid, end); };
287
+ computeBulgeFromRadius = function (start, end, radius) { return _this.computeBulgeFromRadius(start, end, radius); };
288
+ createStaticJig = function () {
289
+ return new AcApPolylineStaticJig(context.view, points, bulges);
290
+ };
291
+ createPreviewJig = function (currentBulge, bulgeProvider) {
292
+ return new AcApPolylineJig(context.view, points, bulges, currentBulge, bulgeProvider);
293
+ };
294
+ getCurrentPoint = function () { return points[points.length - 1]; };
295
+ setSegmentBulge = function (bulge) {
296
+ if (points.length > 0) {
297
+ bulges[points.length - 1] = bulge;
298
+ }
299
+ };
300
+ appendPoint = function (point) {
301
+ points.push(new AcGePoint2d(point));
302
+ bulges.push(undefined);
303
+ };
304
+ undoLast = function () {
305
+ if (points.length <= 1)
306
+ return;
307
+ points.pop();
308
+ bulges.pop();
309
+ bulges[bulges.length - 1] = undefined;
310
+ };
311
+ shouldFinish = function (status) {
312
+ return status !== AcEdPromptStatus.OK && status !== AcEdPromptStatus.Keyword;
313
+ };
314
+ LineState = /** @class */ (function () {
315
+ function LineState(machine) {
316
+ this.machine = machine;
317
+ }
318
+ LineState.prototype.buildPrompt = function () {
319
+ var prompt = new AcEdPromptPointOptions(AcApI18n.t('jig.polyline.nextPointWithOptions'));
320
+ prompt.keywords.add(AcApI18n.t('jig.polyline.keywords.arc.display'), AcApI18n.t('jig.polyline.keywords.arc.global'), AcApI18n.t('jig.polyline.keywords.arc.local'));
321
+ prompt.keywords.add(AcApI18n.t('jig.polyline.keywords.undo.display'), AcApI18n.t('jig.polyline.keywords.undo.global'), AcApI18n.t('jig.polyline.keywords.undo.local'));
322
+ prompt.keywords.add(AcApI18n.t('jig.polyline.keywords.close.display'), AcApI18n.t('jig.polyline.keywords.close.global'), AcApI18n.t('jig.polyline.keywords.close.local'));
323
+ prompt.useDashedLine = true;
324
+ prompt.useBasePoint = true;
325
+ var basePoint = getCurrentPoint();
326
+ if (basePoint) {
327
+ prompt.basePoint = new AcGePoint3d(basePoint);
328
+ }
329
+ prompt.jig = createPreviewJig(undefined);
330
+ return prompt;
331
+ };
332
+ LineState.prototype.handleResult = function (result) {
333
+ return __awaiter(this, void 0, void 0, function () {
334
+ var keyword;
335
+ var _a;
336
+ return __generator(this, function (_b) {
337
+ if (result.status === AcEdPromptStatus.Keyword) {
338
+ keyword = (_a = result.stringResult) !== null && _a !== void 0 ? _a : '';
339
+ if (keyword === 'Arc') {
340
+ this.machine.setState(new ArcState(this.machine));
341
+ }
342
+ else if (keyword === 'Undo') {
343
+ undoLast();
344
+ }
345
+ else if (keyword === 'Close' && points.length > 1) {
346
+ closed = true;
347
+ setSegmentBulge(undefined);
348
+ return [2 /*return*/, 'finish'];
349
+ }
350
+ return [2 /*return*/, 'continue'];
351
+ }
352
+ if (result.status === AcEdPromptStatus.OK) {
353
+ setSegmentBulge(undefined);
354
+ appendPoint(result.value);
355
+ return [2 /*return*/, 'continue'];
356
+ }
357
+ return [2 /*return*/, 'finish'];
358
+ });
359
+ });
360
+ };
361
+ return LineState;
362
+ }());
363
+ ArcState = /** @class */ (function () {
364
+ function ArcState(machine) {
365
+ this.machine = machine;
366
+ }
367
+ ArcState.prototype.buildPrompt = function () {
368
+ var prompt = new AcEdPromptPointOptions(AcApI18n.t('jig.polyline.nextPointWithArcOptions'));
369
+ prompt.keywords.add(AcApI18n.t('jig.polyline.keywords.angle.display'), AcApI18n.t('jig.polyline.keywords.angle.global'), AcApI18n.t('jig.polyline.keywords.angle.local'));
370
+ prompt.keywords.add(AcApI18n.t('jig.polyline.keywords.center.display'), AcApI18n.t('jig.polyline.keywords.center.global'), AcApI18n.t('jig.polyline.keywords.center.local'));
371
+ prompt.keywords.add(AcApI18n.t('jig.polyline.keywords.secondPoint.display'), AcApI18n.t('jig.polyline.keywords.secondPoint.global'), AcApI18n.t('jig.polyline.keywords.secondPoint.local'));
372
+ prompt.keywords.add(AcApI18n.t('jig.polyline.keywords.radius.display'), AcApI18n.t('jig.polyline.keywords.radius.global'), AcApI18n.t('jig.polyline.keywords.radius.local'));
373
+ prompt.keywords.add(AcApI18n.t('jig.polyline.keywords.line.display'), AcApI18n.t('jig.polyline.keywords.line.global'), AcApI18n.t('jig.polyline.keywords.line.local'));
374
+ prompt.keywords.add(AcApI18n.t('jig.polyline.keywords.undo.display'), AcApI18n.t('jig.polyline.keywords.undo.global'), AcApI18n.t('jig.polyline.keywords.undo.local'));
375
+ prompt.keywords.add(AcApI18n.t('jig.polyline.keywords.close.display'), AcApI18n.t('jig.polyline.keywords.close.global'), AcApI18n.t('jig.polyline.keywords.close.local'));
376
+ prompt.useDashedLine = true;
377
+ prompt.useBasePoint = true;
378
+ var basePoint = getCurrentPoint();
379
+ if (basePoint) {
380
+ prompt.basePoint = new AcGePoint3d(basePoint);
381
+ }
382
+ prompt.jig = createPreviewJig(undefined, function () {
383
+ return applyArcDirection(ARC_BULGE);
384
+ });
385
+ return prompt;
386
+ };
387
+ ArcState.prototype.handleResult = function (result) {
388
+ return __awaiter(this, void 0, void 0, function () {
389
+ var keyword, startPoint, anglePrompt, angleResult, endPrompt, angleRad, angleBulge_1, endResult, centerPrompt, centerResult_1, endPrompt, endResult, bulge, secondPrompt, secondResult_1, endPrompt, endResult, bulge, radiusPrompt, radiusResult_1, endPrompt, endResult, bulge;
390
+ var _a, _b, _c;
391
+ return __generator(this, function (_d) {
392
+ switch (_d.label) {
393
+ case 0:
394
+ if (result.status === AcEdPromptStatus.OK) {
395
+ setSegmentBulge(applyArcDirection(ARC_BULGE));
396
+ appendPoint(result.value);
397
+ return [2 /*return*/, 'continue'];
398
+ }
399
+ if (result.status !== AcEdPromptStatus.Keyword)
400
+ return [2 /*return*/, 'finish'];
401
+ keyword = (_a = result.stringResult) !== null && _a !== void 0 ? _a : '';
402
+ if (keyword === 'Line') {
403
+ this.machine.setState(new LineState(this.machine));
404
+ return [2 /*return*/, 'continue'];
405
+ }
406
+ if (keyword === 'Undo') {
407
+ undoLast();
408
+ return [2 /*return*/, 'continue'];
409
+ }
410
+ if (keyword === 'Close' && points.length > 1) {
411
+ closed = true;
412
+ setSegmentBulge(undefined);
413
+ return [2 /*return*/, 'finish'];
414
+ }
415
+ startPoint = getCurrentPoint();
416
+ if (!startPoint)
417
+ return [2 /*return*/, 'finish'];
418
+ if (!(keyword === 'Angle')) return [3 /*break*/, 3];
419
+ anglePrompt = new AcEdPromptDoubleOptions(AcApI18n.t('jig.polyline.arcAngle'));
420
+ anglePrompt.jig = createStaticJig();
421
+ return [4 /*yield*/, AcApDocManager.instance.editor.getDouble(anglePrompt)];
422
+ case 1:
423
+ angleResult = _d.sent();
424
+ if (shouldFinish(angleResult.status))
425
+ return [2 /*return*/, 'finish'];
426
+ endPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.polyline.arcEndPoint'));
427
+ endPrompt.useDashedLine = true;
428
+ endPrompt.useBasePoint = true;
429
+ endPrompt.basePoint = new AcGePoint3d(startPoint);
430
+ angleRad = ((_b = angleResult.value) !== null && _b !== void 0 ? _b : 0) * (Math.PI / 180);
431
+ angleBulge_1 = Math.tan(angleRad / 4);
432
+ endPrompt.jig = createPreviewJig(undefined, function () {
433
+ return applyArcDirection(angleBulge_1);
434
+ });
435
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(endPrompt)];
436
+ case 2:
437
+ endResult = _d.sent();
438
+ if (shouldFinish(endResult.status))
439
+ return [2 /*return*/, 'finish'];
440
+ setSegmentBulge(applyArcDirection(angleBulge_1));
441
+ appendPoint(endResult.value);
442
+ return [2 /*return*/, 'continue'];
443
+ case 3:
444
+ if (!(keyword === 'Center')) return [3 /*break*/, 6];
445
+ centerPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.polyline.arcCenter'));
446
+ centerPrompt.jig = createStaticJig();
447
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(centerPrompt)];
448
+ case 4:
449
+ centerResult_1 = _d.sent();
450
+ if (shouldFinish(centerResult_1.status))
451
+ return [2 /*return*/, 'finish'];
452
+ endPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.polyline.arcEndPoint'));
453
+ endPrompt.useDashedLine = true;
454
+ endPrompt.useBasePoint = true;
455
+ endPrompt.basePoint = new AcGePoint3d(startPoint);
456
+ endPrompt.jig = createPreviewJig(undefined, function (end) {
457
+ return applyArcDirection(computeBulgeFromCenter(startPoint, end, centerResult_1.value));
458
+ });
459
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(endPrompt)];
460
+ case 5:
461
+ endResult = _d.sent();
462
+ if (shouldFinish(endResult.status))
463
+ return [2 /*return*/, 'finish'];
464
+ bulge = computeBulgeFromCenter(startPoint, endResult.value, centerResult_1.value);
465
+ if (bulge === undefined)
466
+ return [2 /*return*/, 'continue'];
467
+ setSegmentBulge(applyArcDirection(bulge));
468
+ appendPoint(endResult.value);
469
+ return [2 /*return*/, 'continue'];
470
+ case 6:
471
+ if (!(keyword === 'SecondPoint')) return [3 /*break*/, 9];
472
+ secondPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.polyline.arcSecondPoint'));
473
+ secondPrompt.jig = createStaticJig();
474
+ secondPrompt.useDashedLine = true;
475
+ secondPrompt.useBasePoint = true;
476
+ secondPrompt.basePoint = new AcGePoint3d(startPoint);
477
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(secondPrompt)];
478
+ case 7:
479
+ secondResult_1 = _d.sent();
480
+ if (shouldFinish(secondResult_1.status))
481
+ return [2 /*return*/, 'finish'];
482
+ endPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.polyline.arcEndPoint'));
483
+ endPrompt.useDashedLine = true;
484
+ endPrompt.useBasePoint = true;
485
+ endPrompt.basePoint = new AcGePoint3d(startPoint);
486
+ endPrompt.jig = createPreviewJig(undefined, function (end) {
487
+ return applyArcDirection(computeBulgeFromThreePoints(startPoint, secondResult_1.value, end));
488
+ });
489
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(endPrompt)];
490
+ case 8:
491
+ endResult = _d.sent();
492
+ if (shouldFinish(endResult.status))
493
+ return [2 /*return*/, 'finish'];
494
+ bulge = computeBulgeFromThreePoints(startPoint, secondResult_1.value, endResult.value);
495
+ if (bulge === undefined)
496
+ return [2 /*return*/, 'continue'];
497
+ setSegmentBulge(applyArcDirection(bulge));
498
+ appendPoint(endResult.value);
499
+ return [2 /*return*/, 'continue'];
500
+ case 9:
501
+ if (!(keyword === 'Radius')) return [3 /*break*/, 12];
502
+ radiusPrompt = new AcEdPromptDoubleOptions(AcApI18n.t('jig.polyline.arcRadius'));
503
+ radiusPrompt.jig = createStaticJig();
504
+ return [4 /*yield*/, AcApDocManager.instance.editor.getDouble(radiusPrompt)];
505
+ case 10:
506
+ radiusResult_1 = _d.sent();
507
+ if (shouldFinish(radiusResult_1.status))
508
+ return [2 /*return*/, 'finish'];
509
+ endPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.polyline.arcEndPoint'));
510
+ endPrompt.useDashedLine = true;
511
+ endPrompt.useBasePoint = true;
512
+ endPrompt.basePoint = new AcGePoint3d(startPoint);
513
+ endPrompt.jig = createPreviewJig(undefined, function (end) {
514
+ var _a;
515
+ return applyArcDirection(computeBulgeFromRadius(startPoint, end, (_a = radiusResult_1.value) !== null && _a !== void 0 ? _a : 0));
516
+ });
517
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(endPrompt)];
518
+ case 11:
519
+ endResult = _d.sent();
520
+ if (shouldFinish(endResult.status))
521
+ return [2 /*return*/, 'finish'];
522
+ bulge = computeBulgeFromRadius(startPoint, endResult.value, (_c = radiusResult_1.value) !== null && _c !== void 0 ? _c : 0);
523
+ if (bulge === undefined)
524
+ return [2 /*return*/, 'continue'];
525
+ setSegmentBulge(applyArcDirection(bulge));
526
+ appendPoint(endResult.value);
527
+ return [2 /*return*/, 'continue'];
528
+ case 12: return [2 /*return*/, 'continue'];
529
+ }
530
+ });
531
+ });
532
+ };
533
+ return ArcState;
534
+ }());
535
+ firstPointPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.polyline.firstPoint'));
536
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(firstPointPrompt)];
537
+ case 1:
538
+ firstPointResult = _a.sent();
539
+ if (firstPointResult.status !== AcEdPromptStatus.OK)
540
+ return [2 /*return*/];
541
+ appendPoint(firstPointResult.value);
542
+ machine = new AcEdPromptStateMachine();
543
+ machine.setState(new LineState(machine));
544
+ return [4 /*yield*/, machine.run(function (prompt) { return AcApDocManager.instance.editor.getPoint(prompt); })
545
+ // Create polyline if we have at least two points
546
+ ];
547
+ case 2:
548
+ _a.sent();
549
+ // Create polyline if we have at least two points
550
+ if (points.length >= 2) {
551
+ db = context.doc.database;
552
+ polyline_1 = new AcDbPolyline();
553
+ points.forEach(function (p, index) {
554
+ return polyline_1.addVertexAt(index, p, bulges[index]);
555
+ });
556
+ if (closed) {
557
+ polyline_1.closed = true;
558
+ }
559
+ db.tables.blockTable.modelSpace.appendEntity(polyline_1);
560
+ }
561
+ return [2 /*return*/];
562
+ }
563
+ });
564
+ });
565
+ };
566
+ return AcApPolylineCmd;
567
+ }(AcEdCommand));
568
+ export { AcApPolylineCmd };
569
+ //# sourceMappingURL=AcApPolylineCmd.js.map