@mlightcad/cad-simple-viewer 1.4.7 → 1.4.9

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 (200) hide show
  1. package/dist/index.js +7749 -6724
  2. package/dist/index.umd.cjs +23 -23
  3. package/lib/app/AcApAnnotation.d.ts +46 -0
  4. package/lib/app/AcApAnnotation.d.ts.map +1 -0
  5. package/lib/app/AcApAnnotation.js +134 -0
  6. package/lib/app/AcApAnnotation.js.map +1 -0
  7. package/lib/app/AcApDocManager.d.ts +118 -6
  8. package/lib/app/AcApDocManager.d.ts.map +1 -1
  9. package/lib/app/AcApDocManager.js +163 -7
  10. package/lib/app/AcApDocManager.js.map +1 -1
  11. package/lib/app/AcApDocument.d.ts +16 -14
  12. package/lib/app/AcApDocument.d.ts.map +1 -1
  13. package/lib/app/AcApDocument.js +48 -31
  14. package/lib/app/AcApDocument.js.map +1 -1
  15. package/lib/app/AcApProgress.d.ts +8 -2
  16. package/lib/app/AcApProgress.d.ts.map +1 -1
  17. package/lib/app/AcApProgress.js +13 -7
  18. package/lib/app/AcApProgress.js.map +1 -1
  19. package/lib/app/AcDbOpenDatabaseOptions.d.ts +28 -0
  20. package/lib/app/AcDbOpenDatabaseOptions.d.ts.map +1 -0
  21. package/lib/app/AcDbOpenDatabaseOptions.js +2 -0
  22. package/lib/app/AcDbOpenDatabaseOptions.js.map +1 -0
  23. package/lib/app/index.d.ts +2 -0
  24. package/lib/app/index.d.ts.map +1 -1
  25. package/lib/app/index.js +2 -0
  26. package/lib/app/index.js.map +1 -1
  27. package/lib/command/AcApBaseRevCmd.d.ts +36 -0
  28. package/lib/command/AcApBaseRevCmd.d.ts.map +1 -0
  29. package/lib/command/AcApBaseRevCmd.js +68 -0
  30. package/lib/command/AcApBaseRevCmd.js.map +1 -0
  31. package/lib/command/AcApCircleCmd.d.ts +1 -0
  32. package/lib/command/AcApCircleCmd.d.ts.map +1 -1
  33. package/lib/command/AcApCircleCmd.js +4 -2
  34. package/lib/command/AcApCircleCmd.js.map +1 -1
  35. package/lib/command/AcApConvertToSvgCmd.d.ts +1 -1
  36. package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -1
  37. package/lib/command/AcApConvertToSvgCmd.js +44 -2
  38. package/lib/command/AcApConvertToSvgCmd.js.map +1 -1
  39. package/lib/command/AcApDimLinearCmd.d.ts +1 -0
  40. package/lib/command/AcApDimLinearCmd.d.ts.map +1 -1
  41. package/lib/command/AcApDimLinearCmd.js +4 -2
  42. package/lib/command/AcApDimLinearCmd.js.map +1 -1
  43. package/lib/command/AcApEraseCmd.d.ts +1 -0
  44. package/lib/command/AcApEraseCmd.d.ts.map +1 -1
  45. package/lib/command/AcApEraseCmd.js +14 -4
  46. package/lib/command/AcApEraseCmd.js.map +1 -1
  47. package/lib/command/AcApLineCmd.d.ts +1 -0
  48. package/lib/command/AcApLineCmd.d.ts.map +1 -1
  49. package/lib/command/AcApLineCmd.js +4 -2
  50. package/lib/command/AcApLineCmd.js.map +1 -1
  51. package/lib/command/AcApLogCmd.d.ts +1 -1
  52. package/lib/command/AcApLogCmd.d.ts.map +1 -1
  53. package/lib/command/AcApLogCmd.js +44 -3
  54. package/lib/command/AcApLogCmd.js.map +1 -1
  55. package/lib/command/AcApOpenCmd.d.ts +1 -1
  56. package/lib/command/AcApOpenCmd.d.ts.map +1 -1
  57. package/lib/command/AcApOpenCmd.js +42 -1
  58. package/lib/command/AcApOpenCmd.js.map +1 -1
  59. package/lib/command/AcApPanCmd.d.ts +1 -1
  60. package/lib/command/AcApPanCmd.d.ts.map +1 -1
  61. package/lib/command/AcApPanCmd.js +43 -2
  62. package/lib/command/AcApPanCmd.js.map +1 -1
  63. package/lib/command/AcApQNewCmd.d.ts +1 -1
  64. package/lib/command/AcApQNewCmd.d.ts.map +1 -1
  65. package/lib/command/AcApQNewCmd.js +44 -2
  66. package/lib/command/AcApQNewCmd.js.map +1 -1
  67. package/lib/command/AcApRectCmd.d.ts +23 -0
  68. package/lib/command/AcApRectCmd.d.ts.map +1 -0
  69. package/lib/command/AcApRectCmd.js +134 -0
  70. package/lib/command/AcApRectCmd.js.map +1 -0
  71. package/lib/command/AcApRegenCmd.d.ts +1 -1
  72. package/lib/command/AcApRegenCmd.d.ts.map +1 -1
  73. package/lib/command/AcApRegenCmd.js +42 -1
  74. package/lib/command/AcApRegenCmd.js.map +1 -1
  75. package/lib/command/AcApRevCircleCmd.d.ts +10 -0
  76. package/lib/command/AcApRevCircleCmd.d.ts.map +1 -0
  77. package/lib/command/AcApRevCircleCmd.js +83 -0
  78. package/lib/command/AcApRevCircleCmd.js.map +1 -0
  79. package/lib/command/AcApRevCloudCmd.d.ts +26 -0
  80. package/lib/command/AcApRevCloudCmd.d.ts.map +1 -0
  81. package/lib/command/AcApRevCloudCmd.js +234 -0
  82. package/lib/command/AcApRevCloudCmd.js.map +1 -0
  83. package/lib/command/AcApRevRectCmd.d.ts +10 -0
  84. package/lib/command/AcApRevRectCmd.d.ts.map +1 -0
  85. package/lib/command/AcApRevRectCmd.js +83 -0
  86. package/lib/command/AcApRevRectCmd.js.map +1 -0
  87. package/lib/command/AcApRevVisibilityCmd.d.ts +15 -0
  88. package/lib/command/AcApRevVisibilityCmd.d.ts.map +1 -0
  89. package/lib/command/AcApRevVisibilityCmd.js +90 -0
  90. package/lib/command/AcApRevVisibilityCmd.js.map +1 -0
  91. package/lib/command/AcApSelectCmd.d.ts +1 -1
  92. package/lib/command/AcApSelectCmd.d.ts.map +1 -1
  93. package/lib/command/AcApSelectCmd.js +43 -2
  94. package/lib/command/AcApSelectCmd.js.map +1 -1
  95. package/lib/command/AcApSketchCmd.d.ts +32 -0
  96. package/lib/command/AcApSketchCmd.d.ts.map +1 -0
  97. package/lib/command/AcApSketchCmd.js +171 -0
  98. package/lib/command/AcApSketchCmd.js.map +1 -0
  99. package/lib/command/AcApSwitchBgCmd.d.ts +14 -0
  100. package/lib/command/AcApSwitchBgCmd.d.ts.map +1 -0
  101. package/lib/command/AcApSwitchBgCmd.js +86 -0
  102. package/lib/command/AcApSwitchBgCmd.js.map +1 -0
  103. package/lib/command/AcApSysVarCmd.d.ts +2 -1
  104. package/lib/command/AcApSysVarCmd.d.ts.map +1 -1
  105. package/lib/command/AcApSysVarCmd.js +6 -5
  106. package/lib/command/AcApSysVarCmd.js.map +1 -1
  107. package/lib/command/AcApZoomCmd.d.ts +1 -1
  108. package/lib/command/AcApZoomCmd.d.ts.map +1 -1
  109. package/lib/command/AcApZoomCmd.js +42 -1
  110. package/lib/command/AcApZoomCmd.js.map +1 -1
  111. package/lib/command/index.d.ts +8 -0
  112. package/lib/command/index.d.ts.map +1 -1
  113. package/lib/command/index.js +8 -0
  114. package/lib/command/index.js.map +1 -1
  115. package/lib/editor/command/AcEdCommand.d.ts +81 -22
  116. package/lib/editor/command/AcEdCommand.d.ts.map +1 -1
  117. package/lib/editor/command/AcEdCommand.js +157 -15
  118. package/lib/editor/command/AcEdCommand.js.map +1 -1
  119. package/lib/editor/command/AcEdCommandIterator.d.ts +1 -1
  120. package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -1
  121. package/lib/editor/command/AcEdCommandStack.d.ts +31 -6
  122. package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -1
  123. package/lib/editor/command/AcEdCommandStack.js +55 -11
  124. package/lib/editor/command/AcEdCommandStack.js.map +1 -1
  125. package/lib/editor/input/AcEditor.d.ts +14 -0
  126. package/lib/editor/input/AcEditor.d.ts.map +1 -1
  127. package/lib/editor/input/AcEditor.js +5 -1
  128. package/lib/editor/input/AcEditor.js.map +1 -1
  129. package/lib/editor/input/marker/AcEdMarker.d.ts +4 -1
  130. package/lib/editor/input/marker/AcEdMarker.d.ts.map +1 -1
  131. package/lib/editor/input/marker/AcEdMarker.js +11 -3
  132. package/lib/editor/input/marker/AcEdMarker.js.map +1 -1
  133. package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts.map +1 -1
  134. package/lib/editor/input/marker/AcEdOSnapMarkerManager.js +6 -3
  135. package/lib/editor/input/marker/AcEdOSnapMarkerManager.js.map +1 -1
  136. package/lib/editor/input/ui/AcEdCommandLine.d.ts +2 -0
  137. package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
  138. package/lib/editor/input/ui/AcEdCommandLine.js +22 -5
  139. package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
  140. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +2 -1
  141. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -1
  142. package/lib/editor/input/ui/AcEdFloatingMessage.d.ts +6 -4
  143. package/lib/editor/input/ui/AcEdFloatingMessage.d.ts.map +1 -1
  144. package/lib/editor/input/ui/AcEdFloatingMessage.js +19 -13
  145. package/lib/editor/input/ui/AcEdFloatingMessage.js.map +1 -1
  146. package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
  147. package/lib/editor/input/ui/AcEdInputManager.js +14 -7
  148. package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
  149. package/lib/editor/view/AcEdBaseView.d.ts +30 -2
  150. package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
  151. package/lib/editor/view/AcEdBaseView.js +42 -6
  152. package/lib/editor/view/AcEdBaseView.js.map +1 -1
  153. package/lib/editor/view/AcEdOpenMode.d.ts +26 -0
  154. package/lib/editor/view/AcEdOpenMode.d.ts.map +1 -0
  155. package/lib/editor/view/AcEdOpenMode.js +27 -0
  156. package/lib/editor/view/AcEdOpenMode.js.map +1 -0
  157. package/lib/editor/view/index.d.ts +2 -0
  158. package/lib/editor/view/index.d.ts.map +1 -1
  159. package/lib/editor/view/index.js +2 -0
  160. package/lib/editor/view/index.js.map +1 -1
  161. package/lib/i18n/en/command.d.ts +18 -0
  162. package/lib/i18n/en/command.d.ts.map +1 -1
  163. package/lib/i18n/en/command.js +19 -1
  164. package/lib/i18n/en/command.js.map +1 -1
  165. package/lib/i18n/en/jig.d.ts +8 -0
  166. package/lib/i18n/en/jig.d.ts.map +1 -1
  167. package/lib/i18n/en/jig.js +8 -0
  168. package/lib/i18n/en/jig.js.map +1 -1
  169. package/lib/i18n/zh/command.d.ts +18 -0
  170. package/lib/i18n/zh/command.d.ts.map +1 -1
  171. package/lib/i18n/zh/command.js +18 -0
  172. package/lib/i18n/zh/command.js.map +1 -1
  173. package/lib/i18n/zh/jig.d.ts +8 -0
  174. package/lib/i18n/zh/jig.d.ts.map +1 -1
  175. package/lib/i18n/zh/jig.js +8 -0
  176. package/lib/i18n/zh/jig.js.map +1 -1
  177. package/lib/index.d.ts +1 -0
  178. package/lib/index.d.ts.map +1 -1
  179. package/lib/index.js +1 -0
  180. package/lib/index.js.map +1 -1
  181. package/lib/plugin/AcApPlugin.d.ts +83 -0
  182. package/lib/plugin/AcApPlugin.d.ts.map +1 -0
  183. package/lib/plugin/AcApPlugin.js +2 -0
  184. package/lib/plugin/AcApPlugin.js.map +1 -0
  185. package/lib/plugin/AcApPluginExample.d.ts +23 -0
  186. package/lib/plugin/AcApPluginExample.d.ts.map +1 -0
  187. package/lib/plugin/AcApPluginExample.js +160 -0
  188. package/lib/plugin/AcApPluginExample.js.map +1 -0
  189. package/lib/plugin/AcApPluginManager.d.ts +206 -0
  190. package/lib/plugin/AcApPluginManager.d.ts.map +1 -0
  191. package/lib/plugin/AcApPluginManager.js +499 -0
  192. package/lib/plugin/AcApPluginManager.js.map +1 -0
  193. package/lib/plugin/index.d.ts +4 -0
  194. package/lib/plugin/index.d.ts.map +1 -0
  195. package/lib/plugin/index.js +4 -0
  196. package/lib/plugin/index.js.map +1 -0
  197. package/lib/view/AcTrView2d.d.ts.map +1 -1
  198. package/lib/view/AcTrView2d.js +8 -1
  199. package/lib/view/AcTrView2d.js.map +1 -1
  200. package/package.json +5 -5
@@ -0,0 +1,171 @@
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 } from '@mlightcad/data-model';
53
+ import { AcApDocManager } from '../app';
54
+ import { AcEdOpenMode, AcEdPreviewJig, AcEdPromptPointOptions } from '../editor';
55
+ import { AcApI18n } from '../i18n';
56
+ import { AcApBaseRevCmd } from './AcApBaseRevCmd';
57
+ // Minimum distance between points to add a new vertex (in world units)
58
+ var MIN_DISTANCE = 0.1;
59
+ /**
60
+ * Calculates the distance between two points
61
+ */
62
+ function distance(p1, p2) {
63
+ var dx = p2.x - p1.x;
64
+ var dy = p2.y - p1.y;
65
+ return Math.sqrt(dx * dx + dy * dy);
66
+ }
67
+ var AcApSketchJig = /** @class */ (function (_super) {
68
+ __extends(AcApSketchJig, _super);
69
+ /**
70
+ * Creates a sketch jig.
71
+ *
72
+ * @param view - The associated view
73
+ * @param start - The first point
74
+ */
75
+ function AcApSketchJig(view, start) {
76
+ var _this = _super.call(this, view) || this;
77
+ _this._lastPoint = null;
78
+ _this._polyline = new AcDbPolyline();
79
+ _this._points = [new AcGePoint2d(start)];
80
+ _this._lastPoint = new AcGePoint2d(start);
81
+ // Add the first point to the polyline
82
+ _this._polyline.addVertexAt(0, _this._points[0]);
83
+ return _this;
84
+ }
85
+ Object.defineProperty(AcApSketchJig.prototype, "entity", {
86
+ get: function () {
87
+ return this._polyline;
88
+ },
89
+ enumerable: false,
90
+ configurable: true
91
+ });
92
+ Object.defineProperty(AcApSketchJig.prototype, "points", {
93
+ /**
94
+ * Gets all accumulated points
95
+ */
96
+ get: function () {
97
+ return this._points;
98
+ },
99
+ enumerable: false,
100
+ configurable: true
101
+ });
102
+ AcApSketchJig.prototype.update = function (currentPoint) {
103
+ if (this._lastPoint === null) {
104
+ return;
105
+ }
106
+ var current = new AcGePoint2d(currentPoint);
107
+ var dist = distance(this._lastPoint, current);
108
+ // Only add a new point if the distance is significant enough
109
+ if (dist >= MIN_DISTANCE) {
110
+ this._points.push(current);
111
+ this._lastPoint = current;
112
+ this._polyline.addVertexAt(this._points.length, current);
113
+ }
114
+ };
115
+ return AcApSketchJig;
116
+ }(AcEdPreviewJig));
117
+ export { AcApSketchJig };
118
+ /**
119
+ * Command to create a sketch line using polyline.
120
+ * After specifying the first point, continuously tracks mouse movement
121
+ * and adds points to the polyline until the user specifies the second point.
122
+ */
123
+ var AcApSketchCmd = /** @class */ (function (_super) {
124
+ __extends(AcApSketchCmd, _super);
125
+ function AcApSketchCmd() {
126
+ var _this = _super.call(this) || this;
127
+ _this.mode = AcEdOpenMode.Review;
128
+ return _this;
129
+ }
130
+ AcApSketchCmd.prototype.execute = function (context) {
131
+ return __awaiter(this, void 0, void 0, function () {
132
+ var firstPointPrompt, firstPoint, jig, secondPointPrompt, secondPoint, points, lastPoint, finalPoint, db, polyline, i;
133
+ return __generator(this, function (_a) {
134
+ switch (_a.label) {
135
+ case 0:
136
+ firstPointPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.sketch.firstPoint'));
137
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(firstPointPrompt)];
138
+ case 1:
139
+ firstPoint = _a.sent();
140
+ jig = new AcApSketchJig(context.view, firstPoint);
141
+ secondPointPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.sketch.nextPoint'));
142
+ secondPointPrompt.jig = jig;
143
+ secondPointPrompt.useDashedLine = false;
144
+ secondPointPrompt.useBasePoint = true;
145
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(secondPointPrompt)
146
+ // Always add the final point
147
+ ];
148
+ case 2:
149
+ secondPoint = _a.sent();
150
+ points = jig.points;
151
+ lastPoint = points[points.length - 1];
152
+ finalPoint = new AcGePoint2d(secondPoint);
153
+ // Only add if it's different from the last point
154
+ if (distance(lastPoint, finalPoint) > 0.01) {
155
+ points.push(finalPoint);
156
+ }
157
+ db = context.doc.database;
158
+ polyline = new AcDbPolyline();
159
+ for (i = 0; i < points.length; i++) {
160
+ polyline.addVertexAt(i, points[i]);
161
+ }
162
+ db.tables.blockTable.modelSpace.appendEntity(polyline);
163
+ return [2 /*return*/];
164
+ }
165
+ });
166
+ });
167
+ };
168
+ return AcApSketchCmd;
169
+ }(AcApBaseRevCmd));
170
+ export { AcApSketchCmd };
171
+ //# sourceMappingURL=AcApSketchCmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcApSketchCmd.js","sourceRoot":"","sources":["../../src/command/AcApSketchCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EAEZ,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAe,cAAc,EAAE,MAAM,QAAQ,CAAA;AACpD,OAAO,EAEL,YAAY,EACZ,cAAc,EACd,sBAAsB,EACvB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,uEAAuE;AACvE,IAAM,YAAY,GAAG,GAAG,CAAA;AAExB;;GAEG;AACH,SAAS,QAAQ,CAAC,EAAmB,EAAE,EAAmB;IACxD,IAAM,EAAE,GAAG,EAAE,CAAC,CAAC,G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AAI,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,IAAI,EAAE,CAAC;4BAC3C,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;wBACzB,CAAC;wBAGK,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAA;wBACzB,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAA;wBACnC,KAAS,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;4BACvC,QAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;wBACpC,CAAC;wBACD,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;;;;;KACvD;IACH,oBAAC;AAAD,CAAC,AA1CD,CAAmC,cAAc,GA0ChD"}
@@ -0,0 +1,14 @@
1
+ import { AcApContext } from '../app';
2
+ import { AcEdCommand } from '../editor';
3
+ /**
4
+ * Command for switching the drawing background between white and black.
5
+ */
6
+ export declare class AcApSwitchBgCmd extends AcEdCommand {
7
+ /**
8
+ * Executes the command to switch the drawing background between white and black.
9
+ *
10
+ * @param context - The application context containing the view
11
+ */
12
+ execute(context: AcApContext): Promise<void>;
13
+ }
14
+ //# sourceMappingURL=AcApSwitchBgCmd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcApSwitchBgCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApSwitchBgCmd.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC;;GAEG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAC9C;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,WAAW;CAanC"}
@@ -0,0 +1,86 @@
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 { AcDbSysVarManager } from '@mlightcad/data-model';
53
+ import { AcEdCommand } from '../editor';
54
+ /**
55
+ * Command for switching the drawing background between white and black.
56
+ */
57
+ var AcApSwitchBgCmd = /** @class */ (function (_super) {
58
+ __extends(AcApSwitchBgCmd, _super);
59
+ function AcApSwitchBgCmd() {
60
+ return _super !== null && _super.apply(this, arguments) || this;
61
+ }
62
+ /**
63
+ * Executes the command to switch the drawing background between white and black.
64
+ *
65
+ * @param context - The application context containing the view
66
+ */
67
+ AcApSwitchBgCmd.prototype.execute = function (context) {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ var variableName, sysVarManager, sysVar, db, useWhiteBackgroundColor;
70
+ return __generator(this, function (_a) {
71
+ variableName = 'WHITEBKCOLOR';
72
+ sysVarManager = AcDbSysVarManager.instance();
73
+ sysVar = sysVarManager.getDescriptor(variableName);
74
+ if (sysVar) {
75
+ db = context.doc.database;
76
+ useWhiteBackgroundColor = sysVarManager.getVar(variableName, db);
77
+ sysVarManager.setVar(variableName, !useWhiteBackgroundColor, db);
78
+ }
79
+ return [2 /*return*/];
80
+ });
81
+ });
82
+ };
83
+ return AcApSwitchBgCmd;
84
+ }(AcEdCommand));
85
+ export { AcApSwitchBgCmd };
86
+ //# sourceMappingURL=AcApSwitchBgCmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcApSwitchBgCmd.js","sourceRoot":"","sources":["../../src/command/AcApSwitchBgCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAGzD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC;;GAEG;AACH;IAAqC,mCAAW;IAAhD;;IAmBA,CAAC;IAlBC;;;;OAIG;IACG,iCAAO,GAAb,UAAc,OAAoB;;;;gBAC1B,YAAY,GAAG,cAAc,CAAA;gBAC7B,aAAa,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAA;gBAC5C,MAAM,GAAG,aAAa,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;gBACxD,IAAI,MAAM,EAAE,CAAC;oBACL,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAA;oBACzB,uBAAuB,GAAG,aAAa,CAAC,MAAM,CAClD,YAAY,EACZ,EAAE,CACQ,CAAA;oBACZ,aAAa,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAA;gBAClE,CAAC;;;;KACF;IACH,sBAAC;AAAD,CAAC,AAnBD,CAAqC,WAAW,GAmB/C"}
@@ -5,11 +5,12 @@ import { AcEdCommand } from '../editor';
5
5
  * this command.
6
6
  */
7
7
  export declare class AcApSysVarCmd extends AcEdCommand {
8
+ constructor();
8
9
  /**
9
10
  * Executes the command to modify the value of one system variable.
10
11
  *
11
12
  * @param context - The application context containing the view
12
13
  */
13
- execute(_context: AcApContext): Promise<void>;
14
+ execute(context: AcApContext): Promise<void>;
14
15
  }
15
16
  //# sourceMappingURL=AcApSysVarCmd.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AcApSysVarCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApSysVarCmd.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAkB,MAAM,QAAQ,CAAA;AACpD,OAAO,EAAE,WAAW,EAA2B,MAAM,WAAW,CAAA;AAGhE;;;GAGG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;;;OAIG;IACG,OAAO,CAAC,QAAQ,EAAE,WAAW;CAUpC"}
1
+ {"version":3,"file":"AcApSysVarCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApSysVarCmd.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAkB,MAAM,QAAQ,CAAA;AACpD,OAAO,EAAE,WAAW,EAAyC,MAAM,WAAW,CAAA;AAG9E;;;GAGG;AACH,qBAAa,aAAc,SAAQ,WAAW;;IAM5C;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,WAAW;CASnC"}
@@ -51,7 +51,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
51
51
  };
52
52
  import { AcDbSysVarManager } from '@mlightcad/data-model';
53
53
  import { AcApDocManager } from '../app';
54
- import { AcEdCommand, AcEdPromptStringOptions } from '../editor';
54
+ import { AcEdCommand, AcEdOpenMode, AcEdPromptStringOptions } from '../editor';
55
55
  import { AcApI18n } from '../i18n';
56
56
  /**
57
57
  * Command for modifying value of one system variable. All of system variables share
@@ -60,28 +60,29 @@ import { AcApI18n } from '../i18n';
60
60
  var AcApSysVarCmd = /** @class */ (function (_super) {
61
61
  __extends(AcApSysVarCmd, _super);
62
62
  function AcApSysVarCmd() {
63
- return _super !== null && _super.apply(this, arguments) || this;
63
+ var _this = _super.call(this) || this;
64
+ _this.mode = AcEdOpenMode.Review;
65
+ return _this;
64
66
  }
65
67
  /**
66
68
  * Executes the command to modify the value of one system variable.
67
69
  *
68
70
  * @param context - The application context containing the view
69
71
  */
70
- AcApSysVarCmd.prototype.execute = function (_context) {
72
+ AcApSysVarCmd.prototype.execute = function (context) {
71
73
  return __awaiter(this, void 0, void 0, function () {
72
74
  var prompt, value, sysVarManager, sysVar;
73
75
  return __generator(this, function (_a) {
74
76
  switch (_a.label) {
75
77
  case 0:
76
78
  prompt = new AcEdPromptStringOptions(AcApI18n.t('jig.sysvar.prompt'));
77
- AcEdPromptStringOptions;
78
79
  return [4 /*yield*/, AcApDocManager.instance.editor.getString(prompt)];
79
80
  case 1:
80
81
  value = _a.sent();
81
82
  sysVarManager = AcDbSysVarManager.instance();
82
83
  sysVar = sysVarManager.getDescriptor(this.globalName);
83
84
  if (sysVar) {
84
- sysVarManager.setVar(this.globalName, value);
85
+ sysVarManager.setVar(this.globalName, value, context.doc.database);
85
86
  }
86
87
  return [2 /*return*/];
87
88
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AcApSysVarCmd.js","sourceRoot":"","sources":["../../src/command/AcApSysVarCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAEzD,OAAO,EAAe,cAAc,EAAE,MAAM,QAAQ,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC;;;GAGG;AACH;IAAmC,iCAAW;IAA9C;;IAgBA,CAAC;IAfC;;;;OAIG;IACG,+BAAO,GAAb,UAAc,QAAqB;;;;;;wBAC3B,MAAM,GAAG,IAAI,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAA;wBAC3E,uBAAuB,CAAA;wBACT,qBAAM,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,EAAA;;wBAA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wBAC3D,IAAI,MAAM,EAAE,CAAC;4BACX,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;wBACpE,CAAC;;;;;KACF;IACH,oBAAC;AAAD,CAAC,AApBD,CAAmC,WAAW,GAoB7C"}
@@ -30,6 +30,6 @@ export declare class AcApZoomCmd extends AcEdCommand {
30
30
  *
31
31
  * @param context - The current application context containing the view to zoom
32
32
  */
33
- execute(context: AcApContext): void;
33
+ execute(context: AcApContext): Promise<void>;
34
34
  }
35
35
  //# sourceMappingURL=AcApZoomCmd.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AcApZoomCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApZoomCmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO,EAAE,WAAW;CAG7B"}
1
+ {"version":3,"file":"AcApZoomCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApZoomCmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;OAOG;IACG,OAAO,CAAC,OAAO,EAAE,WAAW;CAGnC"}
@@ -13,6 +13,42 @@ var __extends = (this && this.__extends) || (function () {
13
13
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
14
  };
15
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
+ };
16
52
  import { AcEdCommand } from '../command';
17
53
  /**
18
54
  * Command to zoom the view to fit all visible entities.
@@ -49,7 +85,12 @@ var AcApZoomCmd = /** @class */ (function (_super) {
49
85
  * @param context - The current application context containing the view to zoom
50
86
  */
51
87
  AcApZoomCmd.prototype.execute = function (context) {
52
- context.view.zoomToFitDrawing();
88
+ return __awaiter(this, void 0, void 0, function () {
89
+ return __generator(this, function (_a) {
90
+ context.view.zoomToFitDrawing();
91
+ return [2 /*return*/];
92
+ });
93
+ });
53
94
  };
54
95
  return AcApZoomCmd;
55
96
  }(AcEdCommand));
@@ -1 +1 @@
1
- {"version":3,"file":"AcApZoomCmd.js","sourceRoot":"","sources":["../../src/command/AcApZoomCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IAAiC,+BAAW;IAA5C;;IAYA,CAAC;IAXC;;;;;;;OAOG;IACH,6BAAO,GAAP,UAAQ,OAAoB;QAC1B,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAA;IACjC,CAAC;IACH,kBAAC;AAAD,CAAC,AAZD,CAAiC,WAAW,GAY3C"}
1
+ {"version":3,"file":"AcApZoomCmd.js","sourceRoot":"","sources":["../../src/command/AcApZoomCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IAAiC,+BAAW;IAA5C;;IAYA,CAAC;IAXC;;;;;;;OAOG;IACG,6BAAO,GAAb,UAAc,OAAoB;;;gBAChC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAA;;;;KAChC;IACH,kBAAC;AAAD,CAAC,AAZD,CAAiC,WAAW,GAY3C"}
@@ -1,5 +1,6 @@
1
1
  export * from '../editor/command/AcEdCommand';
2
2
  export * from '../editor/command/AcEdCommandStack';
3
+ export * from './AcApBaseRevCmd';
3
4
  export * from './AcApCircleCmd';
4
5
  export * from './AcApConvertToSvgCmd';
5
6
  export * from './AcApDimLinearCmd';
@@ -8,9 +9,16 @@ export * from './AcApLineCmd';
8
9
  export * from './AcApLogCmd';
9
10
  export * from './AcApOpenCmd';
10
11
  export * from './AcApQNewCmd';
12
+ export * from './AcApRectCmd';
11
13
  export * from './AcApRegenCmd';
14
+ export * from './AcApRevCloudCmd';
15
+ export * from './AcApRevCircleCmd';
16
+ export * from './AcApRevRectCmd';
17
+ export * from './AcApRevVisibilityCmd';
12
18
  export * from './AcApSelectCmd';
19
+ export * from './AcApSketchCmd';
13
20
  export * from './AcApSysVarCmd';
21
+ export * from './AcApSwitchBgCmd';
14
22
  export * from './AcApZoomCmd';
15
23
  export * from './AcApZoomToBoxCmd';
16
24
  export * from './AcApPanCmd';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oCAAoC,CAAA;AAClD,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oCAAoC,CAAA;AAClD,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA"}
@@ -1,5 +1,6 @@
1
1
  export * from '../editor/command/AcEdCommand';
2
2
  export * from '../editor/command/AcEdCommandStack';
3
+ export * from './AcApBaseRevCmd';
3
4
  export * from './AcApCircleCmd';
4
5
  export * from './AcApConvertToSvgCmd';
5
6
  export * from './AcApDimLinearCmd';
@@ -8,9 +9,16 @@ export * from './AcApLineCmd';
8
9
  export * from './AcApLogCmd';
9
10
  export * from './AcApOpenCmd';
10
11
  export * from './AcApQNewCmd';
12
+ export * from './AcApRectCmd';
11
13
  export * from './AcApRegenCmd';
14
+ export * from './AcApRevCloudCmd';
15
+ export * from './AcApRevCircleCmd';
16
+ export * from './AcApRevRectCmd';
17
+ export * from './AcApRevVisibilityCmd';
12
18
  export * from './AcApSelectCmd';
19
+ export * from './AcApSketchCmd';
13
20
  export * from './AcApSysVarCmd';
21
+ export * from './AcApSwitchBgCmd';
14
22
  export * from './AcApZoomCmd';
15
23
  export * from './AcApZoomToBoxCmd';
16
24
  export * from './AcApPanCmd';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oCAAoC,CAAA;AAClD,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oCAAoC,CAAA;AAClD,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA"}
@@ -1,14 +1,5 @@
1
- import { AcCmEventManager } from '@mlightcad/data-model';
2
1
  import { AcApContext } from '../../app';
3
- /**
4
- * Event arguments for command lifecycle events.
5
- *
6
- * Contains the command instance that triggered the event.
7
- */
8
- export interface AcEdCommandEventArgs {
9
- /** The command instance involved in the event */
10
- command: AcEdCommand;
11
- }
2
+ import { AcEdOpenMode } from '../view';
12
3
  /**
13
4
  * Abstract base class for all CAD commands.
14
5
  *
@@ -23,9 +14,9 @@ export interface AcEdCommandEventArgs {
23
14
  *
24
15
  * ## Command Lifecycle
25
16
  * 1. Command is triggered via `trigger()` method
26
- * 2. `commandWillStart` event is fired
17
+ * 2. `AcEditor.commandWillStart` event is fired
27
18
  * 3. `execute()` method is called with current context
28
- * 4. `commandEnded` event is fired
19
+ * 4. `AcEditor.commandEnded` event is fired
29
20
  *
30
21
  * @example
31
22
  * ```typescript
@@ -52,11 +43,14 @@ export interface AcEdCommandEventArgs {
52
43
  * command.trigger(context);
53
44
  * ```
54
45
  */
55
- export declare abstract class AcEdCommand {
46
+ export declare abstract class AcEdCommand<TUserData extends object = {}> {
56
47
  /** The global (untranslated) name of the command */
57
48
  private _globalName;
58
49
  /** The local (translated) name of the command */
59
50
  private _localName;
51
+ /** The minimum access mode required to execute this command */
52
+ private _mode;
53
+ private _userData;
60
54
  /**
61
55
  * Creates a new command instance.
62
56
  *
@@ -64,13 +58,36 @@ export declare abstract class AcEdCommand {
64
58
  * appropriate global and local names in their constructors.
65
59
  */
66
60
  constructor();
67
- /** Events fired during command execution lifecycle */
68
- readonly events: {
69
- /** Fired just before the command starts executing */
70
- commandWillStart: AcCmEventManager<AcEdCommandEventArgs>;
71
- /** Fired after the command finishes executing */
72
- commandEnded: AcCmEventManager<AcEdCommandEventArgs>;
73
- };
61
+ /**
62
+ * Gets the custom user-defined data associated with this command.
63
+ *
64
+ * `userData` is a generic, strongly-typed container that allows consumers
65
+ * of the command to attach arbitrary metadata without modifying the
66
+ * command class itself.
67
+ *
68
+ * The shape of `userData` is defined by the generic parameter `TUserData`
69
+ * when the command is declared:
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * interface MyCommandData {
74
+ * sourceLayerId: string
75
+ * isPreview: boolean
76
+ * }
77
+ *
78
+ * class MyCommand extends AcEdCommand<MyCommandData> {}
79
+ *
80
+ * const cmd = new MyCommand()
81
+ * cmd.userData.sourceLayerId = 'Layer-01'
82
+ * cmd.userData.isPreview = true
83
+ * ```
84
+ *
85
+ * This design provides flexibility similar to `THREE.Object3D.userData`
86
+ * while preserving full compile-time type safety.
87
+ *
88
+ * @returns The user-defined data object associated with this command
89
+ */
90
+ get userData(): TUserData;
74
91
  /**
75
92
  * Gets the global (untranslated) name of the command.
76
93
  *
@@ -101,6 +118,48 @@ export declare abstract class AcEdCommand {
101
118
  * @param value - The localized command name (e.g., 'Draw Line', 'Zoom In')
102
119
  */
103
120
  set localName(value: string);
121
+ /**
122
+ * Gets the minimum access mode required to execute this command.
123
+ *
124
+ * Commands with higher mode requirements can only be executed when the document
125
+ * is opened in a compatible mode. Higher value modes are compatible with lower value modes.
126
+ *
127
+ * @returns The minimum access mode required
128
+ */
129
+ get mode(): AcEdOpenMode;
130
+ /**
131
+ * Sets the minimum access mode required to execute this command.
132
+ *
133
+ * @param value - The minimum access mode (Read, Review, or Write)
134
+ */
135
+ set mode(value: AcEdOpenMode);
136
+ /**
137
+ * Called right before the command starts executing.
138
+ *
139
+ * This lifecycle hook is intended for subclasses that need to perform
140
+ * setup work before `execute()` runs, such as:
141
+ * - Initializing temporary state
142
+ * - Locking resources
143
+ * - Preparing UI or editor state
144
+ *
145
+ * The default implementation does nothing.
146
+ *
147
+ * @param _context - The current application context
148
+ */
149
+ protected onCommandWillStart(_context: AcApContext): void;
150
+ /**
151
+ * Called after the command has finished executing.
152
+ *
153
+ * This lifecycle hook is intended for cleanup or follow-up logic, such as:
154
+ * - Releasing resources
155
+ * - Resetting editor state
156
+ * - Finalizing transactions
157
+ *
158
+ * The default implementation does nothing.
159
+ *
160
+ * @param _context - The current application context
161
+ */
162
+ protected onCommandEnded(_context: AcApContext): void;
104
163
  /**
105
164
  * Triggers the command execution with proper event handling.
106
165
  *
@@ -121,7 +180,7 @@ export declare abstract class AcEdCommand {
121
180
  * command.trigger(docManager.context);
122
181
  * ```
123
182
  */
124
- tirgger(context: AcApContext): void;
183
+ trigger(context: AcApContext): Promise<void>;
125
184
  /**
126
185
  * Executes the command logic.
127
186
  *
@@ -146,6 +205,6 @@ export declare abstract class AcEdCommand {
146
205
  * }
147
206
  * ```
148
207
  */
149
- execute(_context: AcApContext): void;
208
+ execute(_context: AcApContext): Promise<void>;
150
209
  }
151
210
  //# sourceMappingURL=AcEdCommand.d.ts.map