@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,57 +0,0 @@
1
- import { AcEdBaseView } from '../editor/view/AcEdBaseView';
2
- import { AcApDocument } from './AcApDocument';
3
- /**
4
- * Application context that binds a CAD document with its associated view.
5
- *
6
- * This class establishes the connection between a CAD document (containing the drawing database)
7
- * and its visual representation (the view). It handles event forwarding between the document
8
- * and view to keep them synchronized.
9
- *
10
- * The context manages:
11
- * - Entity lifecycle events (add, modify, remove)
12
- * - Layer visibility changes
13
- * - System variable changes (like point display mode)
14
- * - Entity selection and highlighting
15
- *
16
- * @example
17
- * ```typescript
18
- * const document = new AcApDocument();
19
- * const view = new AcTrView2d();
20
- * const context = new AcApContext(view, document);
21
- *
22
- * // The context will automatically sync changes between document and view
23
- * // For example, when entities are added to the document, they appear in the view
24
- * ```
25
- */
26
- export declare class AcApContext {
27
- /** The view component that renders the CAD drawing */
28
- private _view;
29
- /** The document containing the CAD database */
30
- private _doc;
31
- /**
32
- * Creates a new application context that binds a document with its view.
33
- *
34
- * The constructor sets up event listeners to synchronize the document and view:
35
- * - Entity additions/modifications are reflected in the view
36
- * - Layer visibility changes update the view
37
- * - System variable changes (like point display mode) update rendering
38
- * - Entity selections show/hide grip points
39
- *
40
- * @param view - The view used to display the drawing
41
- * @param doc - The document containing the drawing database
42
- */
43
- constructor(view: AcEdBaseView, doc: AcApDocument);
44
- /**
45
- * Gets the view component that renders the CAD drawing.
46
- *
47
- * @returns The associated view instance
48
- */
49
- get view(): AcEdBaseView;
50
- /**
51
- * Gets the document containing the CAD database.
52
- *
53
- * @returns The associated document instance
54
- */
55
- get doc(): AcApDocument;
56
- }
57
- //# sourceMappingURL=AcApContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcApContext.d.ts","sourceRoot":"","sources":["../../src/app/AcApContext.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,WAAW;IACtB,sDAAsD;IACtD,OAAO,CAAC,KAAK,CAAc;IAC3B,+CAA+C;IAC/C,OAAO,CAAC,IAAI,CAAc;IAE1B;;;;;;;;;;;OAWG;gBACS,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY;IAgDjD;;;;OAIG;IACH,IAAI,IAAI,iBAEP;IAED;;;;OAIG;IACH,IAAI,GAAG,IAAI,YAAY,CAEtB;CACF"}
@@ -1,106 +0,0 @@
1
- import { AcDbLayout } from '@mlightcad/data-model';
2
- /**
3
- * Application context that binds a CAD document with its associated view.
4
- *
5
- * This class establishes the connection between a CAD document (containing the drawing database)
6
- * and its visual representation (the view). It handles event forwarding between the document
7
- * and view to keep them synchronized.
8
- *
9
- * The context manages:
10
- * - Entity lifecycle events (add, modify, remove)
11
- * - Layer visibility changes
12
- * - System variable changes (like point display mode)
13
- * - Entity selection and highlighting
14
- *
15
- * @example
16
- * ```typescript
17
- * const document = new AcApDocument();
18
- * const view = new AcTrView2d();
19
- * const context = new AcApContext(view, document);
20
- *
21
- * // The context will automatically sync changes between document and view
22
- * // For example, when entities are added to the document, they appear in the view
23
- * ```
24
- */
25
- var AcApContext = /** @class */ (function () {
26
- /**
27
- * Creates a new application context that binds a document with its view.
28
- *
29
- * The constructor sets up event listeners to synchronize the document and view:
30
- * - Entity additions/modifications are reflected in the view
31
- * - Layer visibility changes update the view
32
- * - System variable changes (like point display mode) update rendering
33
- * - Entity selections show/hide grip points
34
- *
35
- * @param view - The view used to display the drawing
36
- * @param doc - The document containing the drawing database
37
- */
38
- function AcApContext(view, doc) {
39
- var _this = this;
40
- this._view = view;
41
- this._doc = doc;
42
- // Add entity to scene
43
- doc.database.events.entityAppended.addEventListener(function (args) {
44
- _this.view.addEntity(args.entity);
45
- });
46
- // Update entity
47
- doc.database.events.entityModified.addEventListener(function (args) {
48
- _this.view.updateEntity(args.entity);
49
- });
50
- // Set layer visibility
51
- doc.database.events.layerAppended.addEventListener(function (args) {
52
- _this._view.addLayer(args.layer);
53
- });
54
- // Update layer information such as visibility
55
- doc.database.events.layerModified.addEventListener(function (args) {
56
- _this._view.updateLayer(args.layer);
57
- });
58
- // Set point display mode
59
- doc.database.events.headerSysVarChanged.addEventListener(function (args) {
60
- if (args.name == 'pdmode') {
61
- ;
62
- _this._view.rerenderPoints(args.database.pdmode);
63
- }
64
- });
65
- doc.database.events.dictObjetSet.addEventListener(function (args) {
66
- if (args.object instanceof AcDbLayout) {
67
- _this._view.addLayout(args.object);
68
- }
69
- });
70
- // Show their grip points when entities are selected
71
- view.selectionSet.events.selectionAdded.addEventListener(function (args) {
72
- view.highlight(args.ids);
73
- });
74
- // Hide their grip points when entities are deselected
75
- view.selectionSet.events.selectionRemoved.addEventListener(function (args) {
76
- view.unhighlight(args.ids);
77
- });
78
- }
79
- Object.defineProperty(AcApContext.prototype, "view", {
80
- /**
81
- * Gets the view component that renders the CAD drawing.
82
- *
83
- * @returns The associated view instance
84
- */
85
- get: function () {
86
- return this._view;
87
- },
88
- enumerable: false,
89
- configurable: true
90
- });
91
- Object.defineProperty(AcApContext.prototype, "doc", {
92
- /**
93
- * Gets the document containing the CAD database.
94
- *
95
- * @returns The associated document instance
96
- */
97
- get: function () {
98
- return this._doc;
99
- },
100
- enumerable: false,
101
- configurable: true
102
- });
103
- return AcApContext;
104
- }());
105
- export { AcApContext };
106
- //# sourceMappingURL=AcApContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcApContext.js","sourceRoot":"","sources":["../../src/app/AcApContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAMlD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;IAME;;;;;;;;;;;OAWG;IACH,qBAAY,IAAkB,EAAE,GAAiB;QAAjD,iBA8CC;QA7CC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAA;QAEf,sBAAsB;QACtB,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,UAAA,IAAI;YACtD,KAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAClC,CAAC,CAAC,CAAA;QAEF,gBAAgB;QAChB,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,UAAA,IAAI;YACtD,KAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEF,uBAAuB;QACvB,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,UAAA,I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QALR;;;;WAIG;aACH;YACE,OAAO,IAAI,CAAC,KAAK,CAAA;QACnB,CAAC;;;OAAA;IAOD,sBAAI,4BAAG;QALP;;;;WAIG;aACH;YACE,OAAO,IAAI,CAAC,IAAI,CAAA;QAClB,CAAC;;;OAAA;IACH,kBAAC;AAAD,CAAC,AAnFD,IAmFC"}
@@ -1,272 +0,0 @@
1
- import { AcCmEventManager, AcDbOpenDatabaseOptions } from '@mlightcad/data-model';
2
- import { AcTrView2d } from '../view';
3
- import { AcApContext } from './AcApContext';
4
- import { AcApDocument } from './AcApDocument';
5
- /**
6
- * Event arguments for document-related events.
7
- */
8
- export interface AcDbDocumentEventArgs {
9
- /** The document involved in the event */
10
- doc: AcApDocument;
11
- }
12
- /**
13
- * Document manager that handles CAD document lifecycle and provides the main entry point for the CAD viewer.
14
- *
15
- * This singleton class manages:
16
- * - Document creation and opening (from URLs or file content)
17
- * - View and context management
18
- * - Command registration and execution
19
- * - Font loading for text rendering
20
- * - Event handling for document lifecycle
21
- *
22
- * The manager follows a singleton pattern to ensure only one instance manages the application state.
23
- */
24
- export declare class AcApDocManager {
25
- /** The current application context binding document and view */
26
- private _context;
27
- /** Font loader for managing CAD text fonts */
28
- private _fontLoader;
29
- /** Base URL to get fonts, templates, and example files */
30
- private _baseUrl;
31
- /** Singleton instance */
32
- private static _instance?;
33
- /** Events fired during document lifecycle */
34
- readonly events: {
35
- /** Fired when a new document is created */
36
- documentCreated: AcCmEventManager<AcDbDocumentEventArgs>;
37
- /** Fired when a document becomes active */
38
- documentActivated: AcCmEventManager<AcDbDocumentEventArgs>;
39
- };
40
- /**
41
- * Private constructor for singleton pattern.
42
- *
43
- * Creates an empty document with a 2D view and sets up the application context.
44
- * Registers default commands and creates an example document.
45
- *
46
- * @param canvas - Optional HTML canvas element for rendering. If not provided, a new canvas will be created
47
- * @private
48
- */
49
- private constructor();
50
- /**
51
- * Creates the singleton instance with an optional canvas element.
52
- *
53
- * This method should be called before accessing the `instance` property
54
- * if you want to provide a specific canvas element.
55
- *
56
- * @param canvas - Optional HTML canvas element for rendering
57
- * @returns The singleton instance
58
- *
59
- * @example
60
- * ```typescript
61
- * const canvas = document.getElementById('my-canvas') as HTMLCanvasElement;
62
- * const docManager = AcApDocManager.createInstance(canvas);
63
- * ```
64
- */
65
- static createInstance(canvas?: HTMLCanvasElement): AcApDocManager | undefined;
66
- /**
67
- * Gets the singleton instance of the document manager.
68
- *
69
- * Creates a new instance if one doesn't exist yet.
70
- *
71
- * @returns The singleton document manager instance
72
- */
73
- static get instance(): AcApDocManager;
74
- /**
75
- * Gets the current application context.
76
- *
77
- * The context binds the current document with its associated view.
78
- *
79
- * @returns The current application context
80
- */
81
- get context(): AcApContext;
82
- /**
83
- * Gets the currently open CAD document.
84
- *
85
- * @returns The current document instance
86
- */
87
- get curDocument(): AcApDocument;
88
- /**
89
- * Gets the currently active document.
90
- *
91
- * For now, this is the same as `curDocument` since only one document
92
- * can be active at a time.
93
- *
94
- * @returns The current active document
95
- */
96
- get mdiActiveDocument(): AcApDocument;
97
- /**
98
- * Gets the current 2D view used to display the drawing.
99
- *
100
- * @returns The current 2D view instance
101
- */
102
- get curView(): AcTrView2d;
103
- /**
104
- * Gets the editor instance for handling user input.
105
- *
106
- * @returns The current editor instance
107
- */
108
- get editor(): import("../editor").AcEditor;
109
- /**
110
- * Base URL to load fonts
111
- */
112
- get baseUrl(): string;
113
- set baseUrl(value: string);
114
- /**
115
- * Gets the list of available fonts that can be loaded.
116
- *
117
- * Note: These fonts are available for loading but may not be loaded yet.
118
- *
119
- * @returns Array of available font names
120
- */
121
- get avaiableFonts(): import("@mlightcad/data-model").AcDbFontInfo[];
122
- /**
123
- * Loads the specified fonts for text rendering.
124
- *
125
- * @param fonts - Array of font names to load
126
- * @returns Promise that resolves when fonts are loaded
127
- *
128
- * @example
129
- * ```typescript
130
- * await docManager.loadFonts(['Arial', 'Times New Roman']);
131
- * ```
132
- */
133
- loadFonts(fonts: string[]): Promise<void>;
134
- /**
135
- * Loads default fonts for CAD text rendering.
136
- *
137
- * This method loads either the specified fonts or falls back to default Chinese fonts
138
- * (specifically 'simkai') if no fonts are provided. The loaded fonts are used for
139
- * rendering CAD text entities like MText and Text in the viewer.
140
- *
141
- * It is better to load default fonts when viewer is initialized so that the viewer can
142
- * render text correctly if fonts used in the document are not available.
143
- *
144
- * @param fonts - Optional array of font names to load. If not provided or null,
145
- * defaults to ['simkai'] for Chinese text support
146
- * @returns Promise that resolves when all specified fonts are loaded
147
- *
148
- * @example
149
- * ```typescript
150
- * // Load default fonts (simkai)
151
- * await docManager.loadDefaultFonts();
152
- *
153
- * // Load specific fonts
154
- * await docManager.loadDefaultFonts(['Arial', 'SimSun']);
155
- *
156
- * // Load no fonts (empty array)
157
- * await docManager.loadDefaultFonts([]);
158
- * ```
159
- *
160
- * @see {@link AcApFontLoader.load} - The underlying font loading implementation
161
- * @see {@link createExampleDoc} - Method that uses this for example document creation
162
- */
163
- loadDefaultFonts(fonts?: string[]): Promise<void>;
164
- /**
165
- * Opens a CAD document from a URL.
166
- *
167
- * This method loads a document from the specified URL and replaces the current document.
168
- * It handles the complete document lifecycle including before/after open events.
169
- *
170
- * @param url - The URL of the CAD file to open
171
- * @param options - Optional database opening options. If not provided, default options with font loader will be used
172
- * @returns Promise that resolves to true if the document was successfully opened, false otherwise
173
- *
174
- * @example
175
- * ```typescript
176
- * const success = await docManager.openUrl('https://example.com/drawing.dwg');
177
- * if (success) {
178
- * console.log('Document opened successfully');
179
- * }
180
- * ```
181
- */
182
- openUrl(url: string, options?: AcDbOpenDatabaseOptions): Promise<boolean>;
183
- /**
184
- * Opens a CAD document from file content.
185
- *
186
- * This method loads a document from the provided file content (binary data)
187
- * and replaces the current document. It handles the complete document lifecycle
188
- * including before/after open events.
189
- *
190
- * @param fileName - The name of the file being opened (used for format detection)
191
- * @param content - The file content
192
- * @param options - Database opening options including font loader settings
193
- * @returns Promise that resolves to true if the document was successfully opened, false otherwise
194
- *
195
- * @example
196
- * ```typescript
197
- * const fileContent = await file.arrayBuffer();
198
- * const success = await docManager.openDocument('drawing.dwg', fileContent, options);
199
- * ```
200
- */
201
- openDocument(fileName: string, content: ArrayBuffer, options: AcDbOpenDatabaseOptions): Promise<boolean>;
202
- /**
203
- * Registers all default commands available in the CAD viewer.
204
- *
205
- * This method sets up the command system by registering built-in commands including:
206
- * - pan: Pan/move the view
207
- * - select: Select entities
208
- * - zoom: Zoom in/out
209
- * - zoomw: Zoom to window/box
210
- * - csvg: Convert to SVG
211
- * - qnew: Quick new document
212
- * - open: Open document
213
- *
214
- * All commands are registered under the system command group.
215
- */
216
- registerCommands(): void;
217
- /**
218
- * Executes a command by its string name.
219
- *
220
- * This method looks up a registered command by name and executes it with the current context.
221
- * If the command is not found, no action is taken.
222
- *
223
- * @param cmdStr - The command string to execute (e.g., 'pan', 'zoom', 'select')
224
- *
225
- * @example
226
- * ```typescript
227
- * docManager.sendStringToExecute('zoom');
228
- * docManager.sendStringToExecute('pan');
229
- * ```
230
- */
231
- sendStringToExecute(cmdStr: string): void;
232
- /**
233
- * Configures layout information for the current view.
234
- *
235
- * Sets up the active layout block table record ID and model space block table
236
- * record ID based on the current document's space configuration.
237
- */
238
- setActiveLayout(): void;
239
- /**
240
- * Performs cleanup operations before opening a new document.
241
- *
242
- * This protected method is called automatically before any document opening operation.
243
- * It clears the current view to prepare for the new document content.
244
- *
245
- * @protected
246
- */
247
- protected onBeforeOpenDocument(): void;
248
- /**
249
- * Performs setup operations after a document opening attempt.
250
- *
251
- * This protected method is called automatically after any document opening operation.
252
- * If the document was successfully opened, it dispatches the documentActivated event,
253
- * sets up layout information, and zooms the view to fit the content.
254
- *
255
- * @param isSuccess - Whether the document was successfully opened
256
- * @protected
257
- */
258
- protected onAfterOpenDocument(isSuccess: boolean): void;
259
- /**
260
- * Sets up or validates database opening options.
261
- *
262
- * This private method ensures that the options object has a font loader configured.
263
- * If no options are provided, creates new options with the font loader.
264
- * If options are provided but missing a font loader, adds the font loader.
265
- *
266
- * @param options - Optional database opening options to validate/modify
267
- * @returns The validated options object with font loader configured
268
- * @private
269
- */
270
- private setOptions;
271
- }
272
- //# sourceMappingURL=AcApDocManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcApDocManager.d.ts","sourceRoot":"","sources":["../../src/app/AcApDocManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,uBAAuB,EAExB,MAAM,uBAAuB,CAAA;AAa9B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG7C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,yCAAyC;IACzC,GAAG,EAAE,YAAY,CAAA;CAClB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,cAAc;IACzB,gEAAgE;IAChE,OAAO,CAAC,QAAQ,CAAa;IAC7B,8CAA8C;IAC9C,OAAO,CAAC,WAAW,CAAgB;IACnC,0DAA0D;IAC1D,OAAO,CAAC,QAAQ,CAAQ;IACxB,yBAAyB;IACzB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAgB;IAEzC,6CAA6C;IAC7C,SAAgB,MAAM;QACpB,2CAA2C;;QAE3C,2CAA2C;;MAE5C;IAED;;;;;;;;OAQG;IACH,OAAO;IA4BP;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,iBAAiB;IAOhD;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ,mBAKlB;IAED;;;;;;OAMG;IACH,IAAI,OAAO,gBAEV;IAED;;;;OAIG;IACH,IAAI,WAAW,iBAEd;IAED;;;;;;;OAOG;IACH,IAAI,iBAAiB,iBAEpB;IAED;;;;OAIG;IACH,IAAI,OAAO,IACoB,UAAU,CACxC;IAED;;;;OAIG;IACH,IAAI,MAAM,iCAET;IAED;;OAEG;IACH,IA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