@mlightcad/cad-simple-viewer 1.2.0 → 1.2.2

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 (197) hide show
  1. package/package.json +6 -6
  2. package/dist/index.js +0 -22197
  3. package/dist/index.umd.cjs +0 -284
  4. package/dist/libredwg-parser-worker.js +0 -15411
  5. package/dist/mtext-renderer-worker.js +0 -18688
  6. package/lib/app/AcApContext.d.ts +0 -57
  7. package/lib/app/AcApContext.d.ts.map +0 -1
  8. package/lib/app/AcApContext.js +0 -106
  9. package/lib/app/AcApContext.js.map +0 -1
  10. package/lib/app/AcApDocManager.d.ts +0 -272
  11. package/lib/app/AcApDocManager.d.ts.map +0 -1
  12. package/lib/app/AcApDocManager.js +0 -485
  13. package/lib/app/AcApDocManager.js.map +0 -1
  14. package/lib/app/AcApDocument.d.ts +0 -101
  15. package/lib/app/AcApDocument.d.ts.map +0 -1
  16. package/lib/app/AcApDocument.js +0 -237
  17. package/lib/app/AcApDocument.js.map +0 -1
  18. package/lib/app/AcApFontLoader.d.ts +0 -56
  19. package/lib/app/AcApFontLoader.d.ts.map +0 -1
  20. package/lib/app/AcApFontLoader.js +0 -159
  21. package/lib/app/AcApFontLoader.js.map +0 -1
  22. package/lib/app/AcApGlobalFunc.d.ts +0 -26
  23. package/lib/app/AcApGlobalFunc.d.ts.map +0 -1
  24. package/lib/app/AcApGlobalFunc.js +0 -66
  25. package/lib/app/AcApGlobalFunc.js.map +0 -1
  26. package/lib/app/AcApSettingManager.d.ts +0 -232
  27. package/lib/app/AcApSettingManager.d.ts.map +0 -1
  28. package/lib/app/AcApSettingManager.js +0 -283
  29. package/lib/app/AcApSettingManager.js.map +0 -1
  30. package/lib/app/index.d.ts +0 -6
  31. package/lib/app/index.d.ts.map +0 -1
  32. package/lib/app/index.js +0 -6
  33. package/lib/app/index.js.map +0 -1
  34. package/lib/command/AcApConvertToSvgCmd.d.ts +0 -32
  35. package/lib/command/AcApConvertToSvgCmd.d.ts.map +0 -1
  36. package/lib/command/AcApConvertToSvgCmd.js +0 -56
  37. package/lib/command/AcApConvertToSvgCmd.js.map +0 -1
  38. package/lib/command/AcApOpenCmd.d.ts +0 -37
  39. package/lib/command/AcApOpenCmd.d.ts.map +0 -1
  40. package/lib/command/AcApOpenCmd.js +0 -60
  41. package/lib/command/AcApOpenCmd.js.map +0 -1
  42. package/lib/command/AcApPanCmd.d.ts +0 -31
  43. package/lib/command/AcApPanCmd.d.ts.map +0 -1
  44. package/lib/command/AcApPanCmd.js +0 -55
  45. package/lib/command/AcApPanCmd.js.map +0 -1
  46. package/lib/command/AcApQNewCmd.d.ts +0 -32
  47. package/lib/command/AcApQNewCmd.d.ts.map +0 -1
  48. package/lib/command/AcApQNewCmd.js +0 -56
  49. package/lib/command/AcApQNewCmd.js.map +0 -1
  50. package/lib/command/AcApSelectCmd.d.ts +0 -32
  51. package/lib/command/AcApSelectCmd.d.ts.map +0 -1
  52. package/lib/command/AcApSelectCmd.js +0 -56
  53. package/lib/command/AcApSelectCmd.js.map +0 -1
  54. package/lib/command/AcApSvgConvertor.d.ts +0 -53
  55. package/lib/command/AcApSvgConvertor.d.ts.map +0 -1
  56. package/lib/command/AcApSvgConvertor.js +0 -103
  57. package/lib/command/AcApSvgConvertor.js.map +0 -1
  58. package/lib/command/AcApZoomCmd.d.ts +0 -35
  59. package/lib/command/AcApZoomCmd.d.ts.map +0 -1
  60. package/lib/command/AcApZoomCmd.js +0 -57
  61. package/lib/command/AcApZoomCmd.js.map +0 -1
  62. package/lib/command/AcApZoomToBoxCmd.d.ts +0 -68
  63. package/lib/command/AcApZoomToBoxCmd.d.ts.map +0 -1
  64. package/lib/command/AcApZoomToBoxCmd.js +0 -158
  65. package/lib/command/AcApZoomToBoxCmd.js.map +0 -1
  66. package/lib/command/index.d.ts +0 -10
  67. package/lib/command/index.d.ts.map +0 -1
  68. package/lib/command/index.js +0 -10
  69. package/lib/command/index.js.map +0 -1
  70. package/lib/editor/command/AcEdCommand.d.ts +0 -151
  71. package/lib/editor/command/AcEdCommand.d.ts.map +0 -1
  72. package/lib/editor/command/AcEdCommand.js +0 -164
  73. package/lib/editor/command/AcEdCommand.js.map +0 -1
  74. package/lib/editor/command/AcEdCommandIterator.d.ts +0 -36
  75. package/lib/editor/command/AcEdCommandIterator.d.ts.map +0 -1
  76. package/lib/editor/command/AcEdCommandIterator.js +0 -65
  77. package/lib/editor/command/AcEdCommandIterator.js.map +0 -1
  78. package/lib/editor/command/AcEdCommandStack.d.ts +0 -120
  79. package/lib/editor/command/AcEdCommandStack.d.ts.map +0 -1
  80. package/lib/editor/command/AcEdCommandStack.js +0 -235
  81. package/lib/editor/command/AcEdCommandStack.js.map +0 -1
  82. package/lib/editor/command/index.d.ts +0 -3
  83. package/lib/editor/command/index.d.ts.map +0 -1
  84. package/lib/editor/command/index.js +0 -3
  85. package/lib/editor/command/index.js.map +0 -1
  86. package/lib/editor/global/AcEdConditionWaiter.d.ts +0 -51
  87. package/lib/editor/global/AcEdConditionWaiter.d.ts.map +0 -1
  88. package/lib/editor/global/AcEdConditionWaiter.js +0 -87
  89. package/lib/editor/global/AcEdConditionWaiter.js.map +0 -1
  90. package/lib/editor/global/AcEdGlobalFunc.d.ts +0 -8
  91. package/lib/editor/global/AcEdGlobalFunc.d.ts.map +0 -1
  92. package/lib/editor/global/AcEdGlobalFunc.js +0 -14
  93. package/lib/editor/global/AcEdGlobalFunc.js.map +0 -1
  94. package/lib/editor/global/AcEdMessage.d.ts +0 -5
  95. package/lib/editor/global/AcEdMessage.d.ts.map +0 -1
  96. package/lib/editor/global/AcEdMessage.js +0 -6
  97. package/lib/editor/global/AcEdMessage.js.map +0 -1
  98. package/lib/editor/global/eventBus.d.ts +0 -103
  99. package/lib/editor/global/eventBus.d.ts.map +0 -1
  100. package/lib/editor/global/eventBus.js +0 -41
  101. package/lib/editor/global/eventBus.js.map +0 -1
  102. package/lib/editor/global/index.d.ts +0 -4
  103. package/lib/editor/global/index.d.ts.map +0 -1
  104. package/lib/editor/global/index.js +0 -4
  105. package/lib/editor/global/index.js.map +0 -1
  106. package/lib/editor/index.d.ts +0 -5
  107. package/lib/editor/index.d.ts.map +0 -1
  108. package/lib/editor/index.js +0 -5
  109. package/lib/editor/index.js.map +0 -1
  110. package/lib/editor/input/AcEdBaseInput.d.ts +0 -89
  111. package/lib/editor/input/AcEdBaseInput.d.ts.map +0 -1
  112. package/lib/editor/input/AcEdBaseInput.js +0 -166
  113. package/lib/editor/input/AcEdBaseInput.js.map +0 -1
  114. package/lib/editor/input/AcEdBoxSelector.d.ts +0 -108
  115. package/lib/editor/input/AcEdBoxSelector.d.ts.map +0 -1
  116. package/lib/editor/input/AcEdBoxSelector.js +0 -220
  117. package/lib/editor/input/AcEdBoxSelector.js.map +0 -1
  118. package/lib/editor/input/AcEdCursorManager.d.ts +0 -130
  119. package/lib/editor/input/AcEdCursorManager.d.ts.map +0 -1
  120. package/lib/editor/input/AcEdCursorManager.js +0 -155
  121. package/lib/editor/input/AcEdCursorManager.js.map +0 -1
  122. package/lib/editor/input/AcEdInputPoint.d.ts +0 -51
  123. package/lib/editor/input/AcEdInputPoint.d.ts.map +0 -1
  124. package/lib/editor/input/AcEdInputPoint.js +0 -78
  125. package/lib/editor/input/AcEdInputPoint.js.map +0 -1
  126. package/lib/editor/input/AcEdJig.d.ts +0 -180
  127. package/lib/editor/input/AcEdJig.d.ts.map +0 -1
  128. package/lib/editor/input/AcEdJig.js +0 -256
  129. package/lib/editor/input/AcEdJig.js.map +0 -1
  130. package/lib/editor/input/AcEdJigLoop.d.ts +0 -63
  131. package/lib/editor/input/AcEdJigLoop.d.ts.map +0 -1
  132. package/lib/editor/input/AcEdJigLoop.js +0 -91
  133. package/lib/editor/input/AcEdJigLoop.js.map +0 -1
  134. package/lib/editor/input/AcEdSelectionSet.d.ts +0 -146
  135. package/lib/editor/input/AcEdSelectionSet.d.ts.map +0 -1
  136. package/lib/editor/input/AcEdSelectionSet.js +0 -179
  137. package/lib/editor/input/AcEdSelectionSet.js.map +0 -1
  138. package/lib/editor/input/AcEditor.d.ts +0 -111
  139. package/lib/editor/input/AcEditor.d.ts.map +0 -1
  140. package/lib/editor/input/AcEditor.js +0 -183
  141. package/lib/editor/input/AcEditor.js.map +0 -1
  142. package/lib/editor/input/index.d.ts +0 -5
  143. package/lib/editor/input/index.d.ts.map +0 -1
  144. package/lib/editor/input/index.js +0 -5
  145. package/lib/editor/input/index.js.map +0 -1
  146. package/lib/editor/view/AcEdBaseView.d.ts +0 -457
  147. package/lib/editor/view/AcEdBaseView.d.ts.map +0 -1
  148. package/lib/editor/view/AcEdBaseView.js +0 -349
  149. package/lib/editor/view/AcEdBaseView.js.map +0 -1
  150. package/lib/editor/view/AcEdLayerInfo.d.ts +0 -21
  151. package/lib/editor/view/AcEdLayerInfo.d.ts.map +0 -1
  152. package/lib/editor/view/AcEdLayerInfo.js +0 -2
  153. package/lib/editor/view/AcEdLayerInfo.js.map +0 -1
  154. package/lib/editor/view/index.d.ts +0 -3
  155. package/lib/editor/view/index.d.ts.map +0 -1
  156. package/lib/editor/view/index.js +0 -3
  157. package/lib/editor/view/index.js.map +0 -1
  158. package/lib/index.d.ts +0 -5
  159. package/lib/index.d.ts.map +0 -1
  160. package/lib/index.js +0 -5
  161. package/lib/index.js.map +0 -1
  162. package/lib/util/AcTrGeometryUtil.d.ts +0 -92
  163. package/lib/util/AcTrGeometryUtil.d.ts.map +0 -1
  164. package/lib/util/AcTrGeometryUtil.js +0 -109
  165. package/lib/util/AcTrGeometryUtil.js.map +0 -1
  166. package/lib/util/index.d.ts +0 -2
  167. package/lib/util/index.d.ts.map +0 -1
  168. package/lib/util/index.js +0 -2
  169. package/lib/util/index.js.map +0 -1
  170. package/lib/view/AcTrLayer.d.ts +0 -132
  171. package/lib/view/AcTrLayer.d.ts.map +0 -1
  172. package/lib/view/AcTrLayer.js +0 -199
  173. package/lib/view/AcTrLayer.js.map +0 -1
  174. package/lib/view/AcTrLayout.d.ts +0 -218
  175. package/lib/view/AcTrLayout.d.ts.map +0 -1
  176. package/lib/view/AcTrLayout.js +0 -437
  177. package/lib/view/AcTrLayout.js.map +0 -1
  178. package/lib/view/AcTrLayoutView.d.ts +0 -115
  179. package/lib/view/AcTrLayoutView.d.ts.map +0 -1
  180. package/lib/view/AcTrLayoutView.js +0 -200
  181. package/lib/view/AcTrLayoutView.js.map +0 -1
  182. package/lib/view/AcTrLayoutViewManager.d.ts +0 -89
  183. package/lib/view/AcTrLayoutViewManager.d.ts.map +0 -1
  184. package/lib/view/AcTrLayoutViewManager.js +0 -118
  185. package/lib/view/AcTrLayoutViewManager.js.map +0 -1
  186. package/lib/view/AcTrScene.d.ts +0 -162
  187. package/lib/view/AcTrScene.d.ts.map +0 -1
  188. package/lib/view/AcTrScene.js +0 -370
  189. package/lib/view/AcTrScene.js.map +0 -1
  190. package/lib/view/AcTrView2d.d.ts +0 -262
  191. package/lib/view/AcTrView2d.d.ts.map +0 -1
  192. package/lib/view/AcTrView2d.js +0 -772
  193. package/lib/view/AcTrView2d.js.map +0 -1
  194. package/lib/view/index.d.ts +0 -2
  195. package/lib/view/index.d.ts.map +0 -1
  196. package/lib/view/index.js +0 -2
  197. package/lib/view/index.js.map +0 -1
@@ -1,485 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- 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);
12
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- 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;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- import { AcCmEventManager, acdbHostApplicationServices, AcGeBox2d } from '@mlightcad/data-model';
38
- import { AcApConvertToSvgCmd, AcApOpenCmd, AcApPanCmd, AcApQNewCmd, AcApSelectCmd, AcApZoomCmd, AcApZoomToBoxCmd, AcEdCommandStack } from '../command';
39
- import { eventBus } from '../editor';
40
- import { AcTrView2d } from '../view';
41
- import { AcApContext } from './AcApContext';
42
- import { AcApDocument } from './AcApDocument';
43
- import { AcApFontLoader } from './AcApFontLoader';
44
- /**
45
- * Document manager that handles CAD document lifecycle and provides the main entry point for the CAD viewer.
46
- *
47
- * This singleton class manages:
48
- * - Document creation and opening (from URLs or file content)
49
- * - View and context management
50
- * - Command registration and execution
51
- * - Font loading for text rendering
52
- * - Event handling for document lifecycle
53
- *
54
- * The manager follows a singleton pattern to ensure only one instance manages the application state.
55
- */
56
- var AcApDocManager = /** @class */ (function () {
57
- /**
58
- * Private constructor for singleton pattern.
59
- *
60
- * Creates an empty document with a 2D view and sets up the application context.
61
- * Registers default commands and creates an example document.
62
- *
63
- * @param canvas - Optional HTML canvas element for rendering. If not provided, a new canvas will be created
64
- * @private
65
- */
66
- function AcApDocManager(canvas) {
67
- /** Events fired during document lifecycle */
68
- this.events = {
69
- /** Fired when a new document is created */
70
- documentCreated: new AcCmEventManager(),
71
- /** Fired when a document becomes active */
72
- documentActivated: new AcCmEventManager()
73
- };
74
- this._baseUrl = 'https://mlightcad.gitlab.io/cad-data/';
75
- // Create one empty drawing
76
- var doc = new AcApDocument();
77
- doc.database.events.openProgress.addEventListener(function (args) {
78
- eventBus.emit('open-file-progress', {
79
- database: doc.database,
80
- percentage: args.percentage,
81
- stage: args.stage,
82
- subStage: args.subStage,
83
- subStageStatus: args.subStageStatus,
84
- data: args.data
85
- });
86
- });
87
- var callback = function () {
88
- return {
89
- width: window.innerWidth,
90
- height: window.innerHeight - 30
91
- };
92
- };
93
- var view = new AcTrView2d({ canvas: canvas, calculateSizeCallback: callback });
94
- this._context = new AcApContext(view, doc);
95
- this._fontLoader = new AcApFontLoader();
96
- this._fontLoader.baseUrl = this._baseUrl + 'fonts/';
97
- acdbHostApplicationServices().workingDatabase = doc.database;
98
- this.registerCommands();
99
- }
100
- /**
101
- * Creates the singleton instance with an optional canvas element.
102
- *
103
- * This method should be called before accessing the `instance` property
104
- * if you want to provide a specific canvas element.
105
- *
106
- * @param canvas - Optional HTML canvas element for rendering
107
- * @returns The singleton instance
108
- *
109
- * @example
110
- * ```typescript
111
- * const canvas = document.getElementById('my-canvas') as HTMLCanvasElement;
112
- * const docManager = AcApDocManager.createInstance(canvas);
113
- * ```
114
- */
115
- AcApDocManager.createInstance = function (canvas) {
116
- if (AcApDocManager._instance == null) {
117
- AcApDocManager._instance = new AcApDocManager(canvas);
118
- }
119
- return this._instance;
120
- };
121
- Object.defineProperty(AcApDocManager, "instance", {
122
- /**
123
- * Gets the singleton instance of the document manager.
124
- *
125
- * Creates a new instance if one doesn't exist yet.
126
- *
127
- * @returns The singleton document manager instance
128
- */
129
- get: function () {
130
- if (!AcApDocManager._instance) {
131
- AcApDocManager._instance = new AcApDocManager();
132
- }
133
- return AcApDocManager._instance;
134
- },
135
- enumerable: false,
136
- configurable: true
137
- });
138
- Object.defineProperty(AcApDocManager.prototype, "context", {
139
- /**
140
- * Gets the current application context.
141
- *
142
- * The context binds the current document with its associated view.
143
- *
144
- * @returns The current application context
145
- */
146
- get: function () {
147
- return this._context;
148
- },
149
- enumerable: false,
150
- configurable: true
151
- });
152
- Object.defineProperty(AcApDocManager.prototype, "curDocument", {
153
- /**
154
- * Gets the currently open CAD document.
155
- *
156
- * @returns The current document instance
157
- */
158
- get: function () {
159
- return this._context.doc;
160
- },
161
- enumerable: false,
162
- configurable: true
163
- });
164
- Object.defineProperty(AcApDocManager.prototype, "mdiActiveDocument", {
165
- /**
166
- * Gets the currently active document.
167
- *
168
- * For now, this is the same as `curDocument` since only one document
169
- * can be active at a time.
170
- *
171
- * @returns The current active document
172
- */
173
- get: function () {
174
- return this._context.doc;
175
- },
176
- enumerable: false,
177
- configurable: true
178
- });
179
- Object.defineProperty(AcApDocManager.prototype, "curView", {
180
- /**
181
- * Gets the current 2D view used to display the drawing.
182
- *
183
- * @returns The current 2D view instance
184
- */
185
- get: function () {
186
- return this._context.view;
187
- },
188
- enumerable: false,
189
- configurable: true
190
- });
191
- Object.defineProperty(AcApDocManager.prototype, "editor", {
192
- /**
193
- * Gets the editor instance for handling user input.
194
- *
195
- * @returns The current editor instance
196
- */
197
- get: function () {
198
- return this._context.view.editor;
199
- },
200
- enumerable: false,
201
- configurable: true
202
- });
203
- Object.defineProperty(AcApDocManager.prototype, "baseUrl", {
204
- /**
205
- * Base URL to load fonts
206
- */
207
- get: function () {
208
- return this._baseUrl;
209
- },
210
- set: function (value) {
211
- this._baseUrl = value;
212
- this._fontLoader.baseUrl = value + 'fonts/';
213
- },
214
- enumerable: false,
215
- configurable: true
216
- });
217
- Object.defineProperty(AcApDocManager.prototype, "avaiableFonts", {
218
- /**
219
- * Gets the list of available fonts that can be loaded.
220
- *
221
- * Note: These fonts are available for loading but may not be loaded yet.
222
- *
223
- * @returns Array of available font names
224
- */
225
- get: function () {
226
- return this._fontLoader.avaiableFonts;
227
- },
228
- enumerable: false,
229
- configurable: true
230
- });
231
- /**
232
- * Loads the specified fonts for text rendering.
233
- *
234
- * @param fonts - Array of font names to load
235
- * @returns Promise that resolves when fonts are loaded
236
- *
237
- * @example
238
- * ```typescript
239
- * await docManager.loadFonts(['Arial', 'Times New Roman']);
240
- * ```
241
- */
242
- AcApDocManager.prototype.loadFonts = function (fonts) {
243
- return __awaiter(this, void 0, void 0, function () {
244
- return __generator(this, function (_a) {
245
- switch (_a.label) {
246
- case 0: return [4 /*yield*/, this._fontLoader.load(fonts)];
247
- case 1:
248
- _a.sent();
249
- return [2 /*return*/];
250
- }
251
- });
252
- });
253
- };
254
- /**
255
- * Loads default fonts for CAD text rendering.
256
- *
257
- * This method loads either the specified fonts or falls back to default Chinese fonts
258
- * (specifically 'simkai') if no fonts are provided. The loaded fonts are used for
259
- * rendering CAD text entities like MText and Text in the viewer.
260
- *
261
- * It is better to load default fonts when viewer is initialized so that the viewer can
262
- * render text correctly if fonts used in the document are not available.
263
- *
264
- * @param fonts - Optional array of font names to load. If not provided or null,
265
- * defaults to ['simkai'] for Chinese text support
266
- * @returns Promise that resolves when all specified fonts are loaded
267
- *
268
- * @example
269
- * ```typescript
270
- * // Load default fonts (simkai)
271
- * await docManager.loadDefaultFonts();
272
- *
273
- * // Load specific fonts
274
- * await docManager.loadDefaultFonts(['Arial', 'SimSun']);
275
- *
276
- * // Load no fonts (empty array)
277
- * await docManager.loadDefaultFonts([]);
278
- * ```
279
- *
280
- * @see {@link AcApFontLoader.load} - The underlying font loading implementation
281
- * @see {@link createExampleDoc} - Method that uses this for example document creation
282
- */
283
- AcApDocManager.prototype.loadDefaultFonts = function (fonts) {
284
- return __awaiter(this, void 0, void 0, function () {
285
- return __generator(this, function (_a) {
286
- switch (_a.label) {
287
- case 0:
288
- if (!(fonts == null)) return [3 /*break*/, 2];
289
- return [4 /*yield*/, this._fontLoader.load(['simkai'])];
290
- case 1:
291
- _a.sent();
292
- return [3 /*break*/, 4];
293
- case 2: return [4 /*yield*/, this._fontLoader.load(fonts)];
294
- case 3:
295
- _a.sent();
296
- _a.label = 4;
297
- case 4: return [2 /*return*/];
298
- }
299
- });
300
- });
301
- };
302
- /**
303
- * Opens a CAD document from a URL.
304
- *
305
- * This method loads a document from the specified URL and replaces the current document.
306
- * It handles the complete document lifecycle including before/after open events.
307
- *
308
- * @param url - The URL of the CAD file to open
309
- * @param options - Optional database opening options. If not provided, default options with font loader will be used
310
- * @returns Promise that resolves to true if the document was successfully opened, false otherwise
311
- *
312
- * @example
313
- * ```typescript
314
- * const success = await docManager.openUrl('https://example.com/drawing.dwg');
315
- * if (success) {
316
- * console.log('Document opened successfully');
317
- * }
318
- * ```
319
- */
320
- AcApDocManager.prototype.openUrl = function (url, options) {
321
- return __awaiter(this, void 0, void 0, function () {
322
- var isSuccess;
323
- return __generator(this, function (_a) {
324
- switch (_a.label) {
325
- case 0:
326
- this.onBeforeOpenDocument();
327
- options = this.setOptions(options);
328
- return [4 /*yield*/, this.context.doc.openUri(url, options)];
329
- case 1:
330
- isSuccess = _a.sent();
331
- this.onAfterOpenDocument(isSuccess);
332
- return [2 /*return*/, isSuccess];
333
- }
334
- });
335
- });
336
- };
337
- /**
338
- * Opens a CAD document from file content.
339
- *
340
- * This method loads a document from the provided file content (binary data)
341
- * and replaces the current document. It handles the complete document lifecycle
342
- * including before/after open events.
343
- *
344
- * @param fileName - The name of the file being opened (used for format detection)
345
- * @param content - The file content
346
- * @param options - Database opening options including font loader settings
347
- * @returns Promise that resolves to true if the document was successfully opened, false otherwise
348
- *
349
- * @example
350
- * ```typescript
351
- * const fileContent = await file.arrayBuffer();
352
- * const success = await docManager.openDocument('drawing.dwg', fileContent, options);
353
- * ```
354
- */
355
- AcApDocManager.prototype.openDocument = function (fileName, content, options) {
356
- return __awaiter(this, void 0, void 0, function () {
357
- var isSuccess;
358
- return __generator(this, function (_a) {
359
- switch (_a.label) {
360
- case 0:
361
- this.onBeforeOpenDocument();
362
- options = this.setOptions(options);
363
- return [4 /*yield*/, this.context.doc.openDocument(fileName, content, options)];
364
- case 1:
365
- isSuccess = _a.sent();
366
- this.onAfterOpenDocument(isSuccess);
367
- return [2 /*return*/, isSuccess];
368
- }
369
- });
370
- });
371
- };
372
- /**
373
- * Registers all default commands available in the CAD viewer.
374
- *
375
- * This method sets up the command system by registering built-in commands including:
376
- * - pan: Pan/move the view
377
- * - select: Select entities
378
- * - zoom: Zoom in/out
379
- * - zoomw: Zoom to window/box
380
- * - csvg: Convert to SVG
381
- * - qnew: Quick new document
382
- * - open: Open document
383
- *
384
- * All commands are registered under the system command group.
385
- */
386
- AcApDocManager.prototype.registerCommands = function () {
387
- var register = AcEdCommandStack.instance;
388
- register.addCommand(AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME, 'pan', 'pan', new AcApPanCmd());
389
- register.addCommand(AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME, 'select', 'select', new AcApSelectCmd());
390
- register.addCommand(AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME, 'zoom', 'zoom', new AcApZoomCmd());
391
- register.addCommand(AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME, 'zoomw', 'zoomw', new AcApZoomToBoxCmd());
392
- register.addCommand(AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME, 'csvg', 'csvg', new AcApConvertToSvgCmd());
393
- register.addCommand(AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME, 'qnew', 'qnew', new AcApQNewCmd());
394
- register.addCommand(AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME, 'open', 'open', new AcApOpenCmd());
395
- };
396
- /**
397
- * Executes a command by its string name.
398
- *
399
- * This method looks up a registered command by name and executes it with the current context.
400
- * If the command is not found, no action is taken.
401
- *
402
- * @param cmdStr - The command string to execute (e.g., 'pan', 'zoom', 'select')
403
- *
404
- * @example
405
- * ```typescript
406
- * docManager.sendStringToExecute('zoom');
407
- * docManager.sendStringToExecute('pan');
408
- * ```
409
- */
410
- AcApDocManager.prototype.sendStringToExecute = function (cmdStr) {
411
- var register = AcEdCommandStack.instance;
412
- var cmd = register.lookupGlobalCmd(cmdStr);
413
- cmd === null || cmd === void 0 ? void 0 : cmd.execute(this.context);
414
- };
415
- /**
416
- * Configures layout information for the current view.
417
- *
418
- * Sets up the active layout block table record ID and model space block table
419
- * record ID based on the current document's space configuration.
420
- */
421
- AcApDocManager.prototype.setActiveLayout = function () {
422
- var currentView = this.curView;
423
- currentView.activeLayoutBtrId = this.curDocument.database.currentSpaceId;
424
- currentView.modelSpaceBtrId = this.curDocument.database.currentSpaceId;
425
- };
426
- /**
427
- * Performs cleanup operations before opening a new document.
428
- *
429
- * This protected method is called automatically before any document opening operation.
430
- * It clears the current view to prepare for the new document content.
431
- *
432
- * @protected
433
- */
434
- AcApDocManager.prototype.onBeforeOpenDocument = function () {
435
- this.curView.clear();
436
- };
437
- /**
438
- * Performs setup operations after a document opening attempt.
439
- *
440
- * This protected method is called automatically after any document opening operation.
441
- * If the document was successfully opened, it dispatches the documentActivated event,
442
- * sets up layout information, and zooms the view to fit the content.
443
- *
444
- * @param isSuccess - Whether the document was successfully opened
445
- * @protected
446
- */
447
- AcApDocManager.prototype.onAfterOpenDocument = function (isSuccess) {
448
- if (isSuccess) {
449
- var doc = this.context.doc;
450
- this.events.documentActivated.dispatch({ doc: doc });
451
- this.setActiveLayout();
452
- var db = doc.database;
453
- // The extents of drawing database may be empty. Espically dxf files.
454
- if (db.extents.isEmpty()) {
455
- this.curView.zoomToFit();
456
- }
457
- else {
458
- this.curView.zoomTo(new AcGeBox2d(db.extmin, db.extmax));
459
- }
460
- }
461
- };
462
- /**
463
- * Sets up or validates database opening options.
464
- *
465
- * This private method ensures that the options object has a font loader configured.
466
- * If no options are provided, creates new options with the font loader.
467
- * If options are provided but missing a font loader, adds the font loader.
468
- *
469
- * @param options - Optional database opening options to validate/modify
470
- * @returns The validated options object with font loader configured
471
- * @private
472
- */
473
- AcApDocManager.prototype.setOptions = function (options) {
474
- if (options == null) {
475
- options = { fontLoader: this._fontLoader };
476
- }
477
- else if (options.fontLoader == null) {
478
- options.fontLoader = this._fontLoader;
479
- }
480
- return options;
481
- };
482
- return AcApDocManager;
483
- }());
484
- export { AcApDocManager };
485
- //# sourceMappingURL=AcApDocManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcApDocManager.js","sourceRoot":"","sources":["../../src/app/AcApDocManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAE3B,SAAS,EACV,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,YAAY,CAAA;AACnB,OAAO,EAA6B,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAUjD;;;;;;;;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AED;;;;;;;;;;OAUG;IACK,mCAAU,GAAlB,UAAmB,OAAiC;QAClD,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACpB,OAAO,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,CAAA;QAC5C,CAAC;aAAM,IAAI,OAAO,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;YACtC,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAA;QACvC,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;IACH,qBAAC;AAAD,CAAC,AA1aD,IA0aC"}
@@ -1,101 +0,0 @@
1
- import { AcDbDatabase, AcDbOpenDatabaseOptions } from '@mlightcad/data-model';
2
- /**
3
- * Represents a CAD document that manages a drawing database and associated metadata.
4
- *
5
- * This class handles:
6
- * - Opening CAD files from URIs or file content (DWG/DXF formats)
7
- * - Managing document properties (title, read-only state)
8
- * - Providing access to the underlying database
9
- * - Handling file loading errors through event emission
10
- */
11
- export declare class AcApDocument {
12
- /** The URI of the opened document, if opened from a URI */
13
- private _uri?;
14
- /** The underlying CAD database containing all drawing data */
15
- private _database;
16
- /** The file name of the document */
17
- private _fileName;
18
- /** The display title of the document */
19
- private _docTitle;
20
- /** Whether the document is opened in read-only mode */
21
- private _isReadOnly;
22
- /**
23
- * Creates a new document instance with an empty database.
24
- *
25
- * The document is initialized with an "Untitled" title and read-only mode enabled.
26
- */
27
- constructor();
28
- /**
29
- * Opens a CAD document from a URI.
30
- *
31
- * @param uri - The URI of the CAD file to open
32
- * @param options - Options for opening the database, including read-only mode
33
- * @returns Promise resolving to true if successful, false if failed
34
- *
35
- * @example
36
- * ```typescript
37
- * const success = await document.openUri('https://example.com/drawing.dwg', {
38
- * readOnly: true
39
- * });
40
- * ```
41
- */
42
- openUri(uri: string, options: AcDbOpenDatabaseOptions): Promise<boolean>;
43
- /**
44
- * Opens a CAD document from file content.
45
- *
46
- * @param fileName - The name of the file (used to determine file type from extension)
47
- * @param content - The file content as string or ArrayBuffer
48
- * @param options - Options for opening the database, including read-only mode
49
- * @returns Promise resolving to true if successful, false if failed
50
- *
51
- * @example
52
- * ```typescript
53
- * const fileContent = await fetch('drawing.dwg').then(r => r.arrayBuffer());
54
- * const success = await document.openDocument('drawing.dwg', fileContent, {
55
- * readOnly: false
56
- * });
57
- * ```
58
- */
59
- openDocument(fileName: string, content: ArrayBuffer, options: AcDbOpenDatabaseOptions): Promise<boolean>;
60
- /**
61
- * Gets the URI of the document if opened from a URI.
62
- *
63
- * @returns The document URI, or undefined if not opened from URI
64
- */
65
- get uri(): string | undefined;
66
- /**
67
- * Gets the database object containing all drawing data.
68
- *
69
- * @returns The underlying CAD database instance
70
- */
71
- get database(): AcDbDatabase;
72
- /**
73
- * Gets the display title of the document.
74
- *
75
- * @returns The document title displayed in the window/tab
76
- */
77
- get docTitle(): string;
78
- /**
79
- * Sets the display title of the document.
80
- *
81
- * Also updates the browser tab title if running in a browser environment.
82
- *
83
- * @param value - The new document title
84
- */
85
- set docTitle(value: string);
86
- /**
87
- * Gets whether the document is opened in read-only mode.
88
- *
89
- * @returns True if the document is read-only, false if editable
90
- */
91
- get isReadOnly(): boolean;
92
- /**
93
- * Extracts the file name from a URI.
94
- *
95
- * @param uri - The URI to extract the file name from
96
- * @returns The extracted file name, or empty string if extraction fails
97
- * @private
98
- */
99
- private getFileNameFromUri;
100
- }
101
- //# sourceMappingURL=AcApDocument.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcApDocument.d.ts","sourceRoot":"","sources":["../../src/app/AcApDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,uBAAuB,EACxB,MAAM,uBAAuB,CAAA;AAI9B;;;;;;;;GAQG;AACH,qBAAa,YAAY;IACvB,2DAA2D;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAQ;IACrB,8DAA8D;IAC9D,OAAO,CAAC,SAAS,CAAc;IAC/B,oCAAoC;IACpC,OAAO,CAAC,SAAS,CAAa;IAC9B,wCAAwC;IACxC,OAAO,CAAC,SAAS,CAAa;IAC9B,uDAAuD;IACvD,OAAO,CAAC,WAAW,CAAgB;IAEnC;;;;OAIG;;IAMH;;;;;;;;;;;;;OAaG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB;IAe3D;;;;;;;;;;;;;;;OAeG;IACG,YAAY,CAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,uBAAuB;IAoBlC;;;;OAIG;IACH,IAAI,GAAG,uBAEN;IAED;;;;OAIG;IACH,IAAI,QAAQ,iBAEX;IAED;;;;OAIG;IACH,IAAI,QAAQ,IAWQ,MAAM,CATzB;IAED;;;;;;OAMG;IACH,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAMzB;IAED;;;;OAIG;IACH,IAAI,UAAU,YAEb;IAED;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;CAa3B"}