@mlightcad/cad-simple-viewer 1.2.2 → 1.2.4

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 (201) hide show
  1. package/dist/index.js +33647 -0
  2. package/dist/index.umd.cjs +295 -0
  3. package/dist/libredwg-parser-worker.js +15458 -0
  4. package/dist/mtext-renderer-worker.js +29930 -0
  5. package/lib/app/AcApContext.d.ts +57 -0
  6. package/lib/app/AcApContext.d.ts.map +1 -0
  7. package/lib/app/AcApContext.js +106 -0
  8. package/lib/app/AcApContext.js.map +1 -0
  9. package/lib/app/AcApDocManager.d.ts +291 -0
  10. package/lib/app/AcApDocManager.d.ts.map +1 -0
  11. package/lib/app/AcApDocManager.js +498 -0
  12. package/lib/app/AcApDocManager.js.map +1 -0
  13. package/lib/app/AcApDocument.d.ts +101 -0
  14. package/lib/app/AcApDocument.d.ts.map +1 -0
  15. package/lib/app/AcApDocument.js +237 -0
  16. package/lib/app/AcApDocument.js.map +1 -0
  17. package/lib/app/AcApFontLoader.d.ts +54 -0
  18. package/lib/app/AcApFontLoader.d.ts.map +1 -0
  19. package/lib/app/AcApFontLoader.js +151 -0
  20. package/lib/app/AcApFontLoader.js.map +1 -0
  21. package/lib/app/AcApGlobalFunc.d.ts +26 -0
  22. package/lib/app/AcApGlobalFunc.d.ts.map +1 -0
  23. package/lib/app/AcApGlobalFunc.js +66 -0
  24. package/lib/app/AcApGlobalFunc.js.map +1 -0
  25. package/lib/app/AcApSettingManager.d.ts +232 -0
  26. package/lib/app/AcApSettingManager.d.ts.map +1 -0
  27. package/lib/app/AcApSettingManager.js +283 -0
  28. package/lib/app/AcApSettingManager.js.map +1 -0
  29. package/lib/app/index.d.ts +6 -0
  30. package/lib/app/index.d.ts.map +1 -0
  31. package/lib/app/index.js +6 -0
  32. package/lib/app/index.js.map +1 -0
  33. package/lib/command/AcApConvertToSvgCmd.d.ts +32 -0
  34. package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -0
  35. package/lib/command/AcApConvertToSvgCmd.js +56 -0
  36. package/lib/command/AcApConvertToSvgCmd.js.map +1 -0
  37. package/lib/command/AcApOpenCmd.d.ts +37 -0
  38. package/lib/command/AcApOpenCmd.d.ts.map +1 -0
  39. package/lib/command/AcApOpenCmd.js +60 -0
  40. package/lib/command/AcApOpenCmd.js.map +1 -0
  41. package/lib/command/AcApPanCmd.d.ts +31 -0
  42. package/lib/command/AcApPanCmd.d.ts.map +1 -0
  43. package/lib/command/AcApPanCmd.js +55 -0
  44. package/lib/command/AcApPanCmd.js.map +1 -0
  45. package/lib/command/AcApQNewCmd.d.ts +32 -0
  46. package/lib/command/AcApQNewCmd.d.ts.map +1 -0
  47. package/lib/command/AcApQNewCmd.js +56 -0
  48. package/lib/command/AcApQNewCmd.js.map +1 -0
  49. package/lib/command/AcApRegenCmd.d.ts +21 -0
  50. package/lib/command/AcApRegenCmd.d.ts.map +1 -0
  51. package/lib/command/AcApRegenCmd.js +45 -0
  52. package/lib/command/AcApRegenCmd.js.map +1 -0
  53. package/lib/command/AcApSelectCmd.d.ts +32 -0
  54. package/lib/command/AcApSelectCmd.d.ts.map +1 -0
  55. package/lib/command/AcApSelectCmd.js +56 -0
  56. package/lib/command/AcApSelectCmd.js.map +1 -0
  57. package/lib/command/AcApSvgConvertor.d.ts +53 -0
  58. package/lib/command/AcApSvgConvertor.d.ts.map +1 -0
  59. package/lib/command/AcApSvgConvertor.js +103 -0
  60. package/lib/command/AcApSvgConvertor.js.map +1 -0
  61. package/lib/command/AcApZoomCmd.d.ts +35 -0
  62. package/lib/command/AcApZoomCmd.d.ts.map +1 -0
  63. package/lib/command/AcApZoomCmd.js +57 -0
  64. package/lib/command/AcApZoomCmd.js.map +1 -0
  65. package/lib/command/AcApZoomToBoxCmd.d.ts +68 -0
  66. package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -0
  67. package/lib/command/AcApZoomToBoxCmd.js +158 -0
  68. package/lib/command/AcApZoomToBoxCmd.js.map +1 -0
  69. package/lib/command/index.d.ts +11 -0
  70. package/lib/command/index.d.ts.map +1 -0
  71. package/lib/command/index.js +11 -0
  72. package/lib/command/index.js.map +1 -0
  73. package/lib/editor/command/AcEdCommand.d.ts +151 -0
  74. package/lib/editor/command/AcEdCommand.d.ts.map +1 -0
  75. package/lib/editor/command/AcEdCommand.js +164 -0
  76. package/lib/editor/command/AcEdCommand.js.map +1 -0
  77. package/lib/editor/command/AcEdCommandIterator.d.ts +36 -0
  78. package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -0
  79. package/lib/editor/command/AcEdCommandIterator.js +65 -0
  80. package/lib/editor/command/AcEdCommandIterator.js.map +1 -0
  81. package/lib/editor/command/AcEdCommandStack.d.ts +120 -0
  82. package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -0
  83. package/lib/editor/command/AcEdCommandStack.js +235 -0
  84. package/lib/editor/command/AcEdCommandStack.js.map +1 -0
  85. package/lib/editor/command/index.d.ts +3 -0
  86. package/lib/editor/command/index.d.ts.map +1 -0
  87. package/lib/editor/command/index.js +3 -0
  88. package/lib/editor/command/index.js.map +1 -0
  89. package/lib/editor/global/AcEdConditionWaiter.d.ts +51 -0
  90. package/lib/editor/global/AcEdConditionWaiter.d.ts.map +1 -0
  91. package/lib/editor/global/AcEdConditionWaiter.js +87 -0
  92. package/lib/editor/global/AcEdConditionWaiter.js.map +1 -0
  93. package/lib/editor/global/AcEdGlobalFunc.d.ts +8 -0
  94. package/lib/editor/global/AcEdGlobalFunc.d.ts.map +1 -0
  95. package/lib/editor/global/AcEdGlobalFunc.js +14 -0
  96. package/lib/editor/global/AcEdGlobalFunc.js.map +1 -0
  97. package/lib/editor/global/AcEdMessage.d.ts +5 -0
  98. package/lib/editor/global/AcEdMessage.d.ts.map +1 -0
  99. package/lib/editor/global/AcEdMessage.js +6 -0
  100. package/lib/editor/global/AcEdMessage.js.map +1 -0
  101. package/lib/editor/global/eventBus.d.ts +103 -0
  102. package/lib/editor/global/eventBus.d.ts.map +1 -0
  103. package/lib/editor/global/eventBus.js +41 -0
  104. package/lib/editor/global/eventBus.js.map +1 -0
  105. package/lib/editor/global/index.d.ts +4 -0
  106. package/lib/editor/global/index.d.ts.map +1 -0
  107. package/lib/editor/global/index.js +4 -0
  108. package/lib/editor/global/index.js.map +1 -0
  109. package/lib/editor/index.d.ts +5 -0
  110. package/lib/editor/index.d.ts.map +1 -0
  111. package/lib/editor/index.js +5 -0
  112. package/lib/editor/index.js.map +1 -0
  113. package/lib/editor/input/AcEdBaseInput.d.ts +89 -0
  114. package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -0
  115. package/lib/editor/input/AcEdBaseInput.js +166 -0
  116. package/lib/editor/input/AcEdBaseInput.js.map +1 -0
  117. package/lib/editor/input/AcEdBoxSelector.d.ts +108 -0
  118. package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -0
  119. package/lib/editor/input/AcEdBoxSelector.js +220 -0
  120. package/lib/editor/input/AcEdBoxSelector.js.map +1 -0
  121. package/lib/editor/input/AcEdCursorManager.d.ts +130 -0
  122. package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -0
  123. package/lib/editor/input/AcEdCursorManager.js +155 -0
  124. package/lib/editor/input/AcEdCursorManager.js.map +1 -0
  125. package/lib/editor/input/AcEdInputPoint.d.ts +51 -0
  126. package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -0
  127. package/lib/editor/input/AcEdInputPoint.js +78 -0
  128. package/lib/editor/input/AcEdInputPoint.js.map +1 -0
  129. package/lib/editor/input/AcEdJig.d.ts +180 -0
  130. package/lib/editor/input/AcEdJig.d.ts.map +1 -0
  131. package/lib/editor/input/AcEdJig.js +256 -0
  132. package/lib/editor/input/AcEdJig.js.map +1 -0
  133. package/lib/editor/input/AcEdJigLoop.d.ts +63 -0
  134. package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -0
  135. package/lib/editor/input/AcEdJigLoop.js +91 -0
  136. package/lib/editor/input/AcEdJigLoop.js.map +1 -0
  137. package/lib/editor/input/AcEdSelectionSet.d.ts +146 -0
  138. package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -0
  139. package/lib/editor/input/AcEdSelectionSet.js +179 -0
  140. package/lib/editor/input/AcEdSelectionSet.js.map +1 -0
  141. package/lib/editor/input/AcEditor.d.ts +111 -0
  142. package/lib/editor/input/AcEditor.d.ts.map +1 -0
  143. package/lib/editor/input/AcEditor.js +183 -0
  144. package/lib/editor/input/AcEditor.js.map +1 -0
  145. package/lib/editor/input/index.d.ts +5 -0
  146. package/lib/editor/input/index.d.ts.map +1 -0
  147. package/lib/editor/input/index.js +5 -0
  148. package/lib/editor/input/index.js.map +1 -0
  149. package/lib/editor/view/AcEdBaseView.d.ts +457 -0
  150. package/lib/editor/view/AcEdBaseView.d.ts.map +1 -0
  151. package/lib/editor/view/AcEdBaseView.js +349 -0
  152. package/lib/editor/view/AcEdBaseView.js.map +1 -0
  153. package/lib/editor/view/AcEdLayerInfo.d.ts +21 -0
  154. package/lib/editor/view/AcEdLayerInfo.d.ts.map +1 -0
  155. package/lib/editor/view/AcEdLayerInfo.js +2 -0
  156. package/lib/editor/view/AcEdLayerInfo.js.map +1 -0
  157. package/lib/editor/view/index.d.ts +3 -0
  158. package/lib/editor/view/index.d.ts.map +1 -0
  159. package/lib/editor/view/index.js +3 -0
  160. package/lib/editor/view/index.js.map +1 -0
  161. package/lib/index.d.ts +5 -0
  162. package/lib/index.d.ts.map +1 -0
  163. package/lib/index.js +5 -0
  164. package/lib/index.js.map +1 -0
  165. package/lib/util/AcTrGeometryUtil.d.ts +92 -0
  166. package/lib/util/AcTrGeometryUtil.d.ts.map +1 -0
  167. package/lib/util/AcTrGeometryUtil.js +109 -0
  168. package/lib/util/AcTrGeometryUtil.js.map +1 -0
  169. package/lib/util/index.d.ts +2 -0
  170. package/lib/util/index.d.ts.map +1 -0
  171. package/lib/util/index.js +2 -0
  172. package/lib/util/index.js.map +1 -0
  173. package/lib/view/AcTrLayer.d.ts +132 -0
  174. package/lib/view/AcTrLayer.d.ts.map +1 -0
  175. package/lib/view/AcTrLayer.js +199 -0
  176. package/lib/view/AcTrLayer.js.map +1 -0
  177. package/lib/view/AcTrLayout.d.ts +218 -0
  178. package/lib/view/AcTrLayout.d.ts.map +1 -0
  179. package/lib/view/AcTrLayout.js +437 -0
  180. package/lib/view/AcTrLayout.js.map +1 -0
  181. package/lib/view/AcTrLayoutView.d.ts +115 -0
  182. package/lib/view/AcTrLayoutView.d.ts.map +1 -0
  183. package/lib/view/AcTrLayoutView.js +200 -0
  184. package/lib/view/AcTrLayoutView.js.map +1 -0
  185. package/lib/view/AcTrLayoutViewManager.d.ts +89 -0
  186. package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -0
  187. package/lib/view/AcTrLayoutViewManager.js +118 -0
  188. package/lib/view/AcTrLayoutViewManager.js.map +1 -0
  189. package/lib/view/AcTrScene.d.ts +162 -0
  190. package/lib/view/AcTrScene.d.ts.map +1 -0
  191. package/lib/view/AcTrScene.js +370 -0
  192. package/lib/view/AcTrScene.js.map +1 -0
  193. package/lib/view/AcTrView2d.d.ts +262 -0
  194. package/lib/view/AcTrView2d.d.ts.map +1 -0
  195. package/lib/view/AcTrView2d.js +772 -0
  196. package/lib/view/AcTrView2d.js.map +1 -0
  197. package/lib/view/index.d.ts +2 -0
  198. package/lib/view/index.d.ts.map +1 -0
  199. package/lib/view/index.js +2 -0
  200. package/lib/view/index.js.map +1 -0
  201. package/package.json +5 -5
@@ -0,0 +1,349 @@
1
+ import { AcCmEventManager, AcGeBox3d, AcGePoint2d } from '@mlightcad/data-model';
2
+ import { AcEdCorsorType, AcEdSelectionSet } from '../input';
3
+ import { AcEditor } from '../input/AcEditor';
4
+ /**
5
+ * Enumeration of view interaction modes.
6
+ *
7
+ * The view mode determines how the view responds to user mouse interactions:
8
+ * - In SELECTION mode, clicks select entities
9
+ * - In PAN mode, clicks and drags pan the view
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // Set to selection mode for entity picking
14
+ * view.mode = AcEdViewMode.SELECTION;
15
+ *
16
+ * // Set to pan mode for view navigation
17
+ * view.mode = AcEdViewMode.PAN;
18
+ * ```
19
+ */
20
+ export var AcEdViewMode;
21
+ (function (AcEdViewMode) {
22
+ /**
23
+ * Selection mode - mouse clicks select entities.
24
+ *
25
+ * In this mode:
26
+ * - Single clicks select individual entities
27
+ * - Drag operations can create selection boxes
28
+ * - Selected entities are highlighted with grip points
29
+ */
30
+ AcEdViewMode[AcEdViewMode["SELECTION"] = 0] = "SELECTION";
31
+ /**
32
+ * Pan mode - mouse interactions pan the view.
33
+ *
34
+ * In this mode:
35
+ * - Click and drag operations move the view
36
+ * - The cursor typically changes to indicate pan mode
37
+ * - Entity selection is disabled
38
+ */
39
+ AcEdViewMode[AcEdViewMode["PAN"] = 1] = "PAN";
40
+ })(AcEdViewMode || (AcEdViewMode = {}));
41
+ /**
42
+ * Abstract base class for all CAD view implementations.
43
+ *
44
+ * This class provides the foundation for rendering and interacting with CAD drawings.
45
+ * It manages:
46
+ * - Canvas and viewport dimensions
47
+ * - Mouse event handling and coordinate conversion
48
+ * - Entity selection and highlighting
49
+ * - View modes (selection, pan, etc.)
50
+ * - Spatial queries for entity picking
51
+ * - Hover/unhover detection with timing
52
+ *
53
+ * Concrete implementations must provide specific rendering logic and coordinate
54
+ * transformations appropriate for their rendering technology (e.g., Three.js, SVG).
55
+ *
56
+ * ## Key Responsibilities
57
+ * - **Input Management**: Handles mouse events and user interactions
58
+ * - **Selection**: Manages selected entities and visual feedback
59
+ * - **Coordinate Systems**: Converts between screen and world coordinates
60
+ * - **Spatial Queries**: Finds entities at specific locations
61
+ * - **View State**: Tracks current position, zoom, and view mode
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * class MyView extends AcEdBaseView {
66
+ * // Implement required abstract methods
67
+ * get missedData() { return { fonts: {}, images: new Map() }; }
68
+ * get mode() { return this._mode; }
69
+ * set mode(value) { this._mode = value; }
70
+ * // ... other abstract methods
71
+ * }
72
+ *
73
+ * const view = new MyView(canvasElement);
74
+ * view.events.mouseMove.addEventListener(args => {
75
+ * console.log('Mouse at world coords:', args.x, args.y);
76
+ * });
77
+ * ```
78
+ */
79
+ var AcEdBaseView = /** @class */ (function () {
80
+ /**
81
+ * Creates a new base view instance.
82
+ *
83
+ * Sets up the canvas, initializes internal state, and registers event listeners
84
+ * for mouse interactions and window resize events.
85
+ *
86
+ * @param canvas - The HTML canvas element to render into
87
+ */
88
+ function AcEdBaseView(canvas) {
89
+ var _this = this;
90
+ /** Events fired by the view for various interactions */
91
+ this.events = {
92
+ /** Fired when mouse moves over the view */
93
+ mouseMove: new AcCmEventManager(),
94
+ /** Fired when the view is resized */
95
+ viewResize: new AcCmEventManager(),
96
+ /** Fired when mouse hovers over an entity */
97
+ hover: new AcCmEventManager(),
98
+ /** Fired when mouse stops hovering over an entity */
99
+ unhover: new AcCmEventManager()
100
+ };
101
+ this._canvas = canvas;
102
+ var rect = canvas.getBoundingClientRect();
103
+ this._bbox = new AcGeBox3d();
104
+ this._width = rect.width;
105
+ this._height = rect.height;
106
+ this._curPos = new AcGePoint2d();
107
+ this._curScreenPos = new AcGePoint2d();
108
+ this._selectionSet = new AcEdSelectionSet();
109
+ this._editor = new AcEditor(this);
110
+ this._canvas.addEventListener('mousemove', function (event) { return _this.onMouseMove(event); });
111
+ this._canvas.addEventListener('mousedown', function (event) {
112
+ if (event.button === 1) {
113
+ // Middle mouse button (button === 1)
114
+ _this._editor.setCursor(AcEdCorsorType.Grab);
115
+ }
116
+ });
117
+ this._canvas.addEventListener('mouseup', function (event) {
118
+ if (event.button === 1) {
119
+ // Middle mouse button (button === 1)
120
+ _this._editor.restoreCursor();
121
+ }
122
+ });
123
+ window.addEventListener('resize', this.onWindowResize.bind(this));
124
+ this._selectionBoxSize = 4;
125
+ // Initialize hover/unhover handler
126
+ this._hoverTimer = null;
127
+ this._pauseTimer = null;
128
+ this._hoveredObjectId = null;
129
+ }
130
+ Object.defineProperty(AcEdBaseView.prototype, "editor", {
131
+ /**
132
+ * Gets the input manager for handling user interactions.
133
+ *
134
+ * The editor provides high-level methods for getting user input like
135
+ * point selection, entity selection, and cursor management.
136
+ *
137
+ * @returns The editor instance
138
+ */
139
+ get: function () {
140
+ return this._editor;
141
+ },
142
+ enumerable: false,
143
+ configurable: true
144
+ });
145
+ Object.defineProperty(AcEdBaseView.prototype, "selectionBoxSize", {
146
+ /**
147
+ * Gets the size of the selection box used for entity picking.
148
+ *
149
+ * This determines how close the mouse needs to be to an entity
150
+ * to select it, measured in screen pixels.
151
+ *
152
+ * @returns Selection box size in pixels
153
+ */
154
+ get: function () {
155
+ return this._selectionBoxSize;
156
+ },
157
+ /**
158
+ * Sets the size of the selection box used for entity picking.
159
+ *
160
+ * @param value - Selection box size in pixels
161
+ */
162
+ set: function (value) {
163
+ this._selectionBoxSize = value;
164
+ },
165
+ enumerable: false,
166
+ configurable: true
167
+ });
168
+ /**
169
+ * Set cursor type of this view
170
+ * @param cursorType Input cursor type
171
+ */
172
+ AcEdBaseView.prototype.setCursor = function (cursorType) {
173
+ this._editor.setCursor(cursorType);
174
+ };
175
+ /**
176
+ * Set callback function used to calculate size of canvas when window resized
177
+ * @param value Input callback function
178
+ */
179
+ AcEdBaseView.prototype.setCalculateSizeCallback = function (value) {
180
+ this._calculateSizeCallback = value;
181
+ };
182
+ Object.defineProperty(AcEdBaseView.prototype, "width", {
183
+ /**
184
+ * Width of canvas (not width of window) in pixel
185
+ */
186
+ get: function () {
187
+ return this._width;
188
+ },
189
+ set: function (value) {
190
+ this._width = value;
191
+ },
192
+ enumerable: false,
193
+ configurable: true
194
+ });
195
+ Object.defineProperty(AcEdBaseView.prototype, "height", {
196
+ /**
197
+ * Height of canvas (not height of window) in pixel
198
+ */
199
+ get: function () {
200
+ return this._height;
201
+ },
202
+ set: function (value) {
203
+ this._height = value;
204
+ },
205
+ enumerable: false,
206
+ configurable: true
207
+ });
208
+ Object.defineProperty(AcEdBaseView.prototype, "bbox", {
209
+ /**
210
+ * The bounding box to include all entities in this viewer
211
+ */
212
+ get: function () {
213
+ return this._bbox;
214
+ },
215
+ enumerable: false,
216
+ configurable: true
217
+ });
218
+ Object.defineProperty(AcEdBaseView.prototype, "canvas", {
219
+ /**
220
+ * The canvas HTML element used by this view
221
+ */
222
+ get: function () {
223
+ return this._canvas;
224
+ },
225
+ enumerable: false,
226
+ configurable: true
227
+ });
228
+ Object.defineProperty(AcEdBaseView.prototype, "aspect", {
229
+ get: function () {
230
+ return this._width / this._height;
231
+ },
232
+ enumerable: false,
233
+ configurable: true
234
+ });
235
+ Object.defineProperty(AcEdBaseView.prototype, "curPos", {
236
+ /**
237
+ * Postion of current mouse in world coordinate system
238
+ */
239
+ get: function () {
240
+ return this._curPos;
241
+ },
242
+ enumerable: false,
243
+ configurable: true
244
+ });
245
+ Object.defineProperty(AcEdBaseView.prototype, "curScreenPos", {
246
+ /**
247
+ * Postion of current mouse in screen coordinate system
248
+ */
249
+ get: function () {
250
+ return this._curScreenPos;
251
+ },
252
+ enumerable: false,
253
+ configurable: true
254
+ });
255
+ Object.defineProperty(AcEdBaseView.prototype, "selectionSet", {
256
+ /**
257
+ * The selection set in current view.
258
+ */
259
+ get: function () {
260
+ return this._selectionSet;
261
+ },
262
+ enumerable: false,
263
+ configurable: true
264
+ });
265
+ AcEdBaseView.prototype.onWindowResize = function () {
266
+ if (this._calculateSizeCallback) {
267
+ var _a = this._calculateSizeCallback(), width = _a.width, height = _a.height;
268
+ this._width = width;
269
+ this._height = height;
270
+ }
271
+ else {
272
+ this._width = this._canvas.clientWidth;
273
+ this._height = this._canvas.clientHeight;
274
+ }
275
+ this.events.viewResize.dispatch({
276
+ width: this._width,
277
+ height: this._height
278
+ });
279
+ };
280
+ /**
281
+ * Mouse move event handler.
282
+ * @param event Input mouse event argument
283
+ */
284
+ AcEdBaseView.prototype.onMouseMove = function (event) {
285
+ this._curScreenPos = new AcGePoint2d(event.clientX, event.clientY);
286
+ var wcsPos = this.cwcs2Wcs(this._curScreenPos);
287
+ this._curPos.copy(wcsPos);
288
+ this.events.mouseMove.dispatch({ x: wcsPos.x, y: wcsPos.y });
289
+ // Hover handler
290
+ if (this.mode == AcEdViewMode.SELECTION) {
291
+ this.startHoverTimer(wcsPos.x, wcsPos.y);
292
+ }
293
+ };
294
+ AcEdBaseView.prototype.setHoveredObjectId = function (newId) {
295
+ if (this._hoveredObjectId) {
296
+ this.events.unhover.dispatch({
297
+ id: this._hoveredObjectId,
298
+ x: this.curScreenPos.x,
299
+ y: this.curScreenPos.y
300
+ });
301
+ this.onUnhover(this._hoveredObjectId);
302
+ }
303
+ this._hoveredObjectId = newId;
304
+ if (newId) {
305
+ this.startPauseTimer(newId);
306
+ this.onHover(newId);
307
+ }
308
+ };
309
+ AcEdBaseView.prototype.hoverAt = function (x, y) {
310
+ var results = this.pick({ x: x, y: y });
311
+ if (results.length > 0) {
312
+ this.setHoveredObjectId(results[0]);
313
+ }
314
+ else {
315
+ this.setHoveredObjectId(null);
316
+ this.clearPauseTimer();
317
+ }
318
+ };
319
+ AcEdBaseView.prototype.clearHoverTimer = function () {
320
+ if (this._hoverTimer) {
321
+ clearTimeout(this._hoverTimer);
322
+ }
323
+ };
324
+ AcEdBaseView.prototype.clearPauseTimer = function () {
325
+ if (this._pauseTimer) {
326
+ clearTimeout(this._pauseTimer);
327
+ }
328
+ };
329
+ AcEdBaseView.prototype.startHoverTimer = function (x, y) {
330
+ var _this = this;
331
+ this.clearHoverTimer();
332
+ this._hoverTimer = setTimeout(function () {
333
+ _this.hoverAt(x, y);
334
+ }, 50);
335
+ };
336
+ AcEdBaseView.prototype.startPauseTimer = function (id) {
337
+ var _this = this;
338
+ this._pauseTimer = setTimeout(function () {
339
+ _this.events.hover.dispatch({
340
+ id: id,
341
+ x: _this.curScreenPos.x,
342
+ y: _this.curScreenPos.y
343
+ });
344
+ }, 500);
345
+ };
346
+ return AcEdBaseView;
347
+ }());
348
+ export { AcEdBaseView };
349
+ //# sourceMappingURL=AcEdBaseView.js.map
@@ -0,0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B,CAAS,EAAE,CAAS;QAA5C,iBAKC;QAJC,IAAI,CAAC,eAAe,EAAE,CAAA;QACtB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC5B,KAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACpB,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,CAAC;IAEO,sCAAe,GAAvB,UAAwB,EAAgB;QAAxC,iBAQC;QAPC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC5B,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;gBACzB,EAAE,EAAE,EAAE;gBACN,CAAC,EAAE,KAAI,CAAC,YAAY,CAAC,CAAC;gBACtB,CAAC,EAAE,KAAI,CAAC,YAAY,CAAC,CAAC;aACvB,CAAC,CAAA;QACJ,CAAC,EAAE,GAAG,CAAC,CAAA;IACT,CAAC;IACH,mBAAC;AAAD,CAAC,AAteD,IAseC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Describes basic layer state information within the editor view.
3
+ *
4
+ * Contains the layer's display name and common visibility/freeze flags.
5
+ * @public
6
+ */
7
+ export interface AcEdLayerInfo {
8
+ /**
9
+ * Human-readable layer name.
10
+ */
11
+ name: string;
12
+ /**
13
+ * When true, the layer is frozen (entities are hidden from display and don't participate regen.).
14
+ */
15
+ isFrozen: boolean;
16
+ /**
17
+ * When true, the layer is turned off (entities are hidden from display but still participate regen).
18
+ */
19
+ isOff: boolean;
20
+ }
21
+ //# sourceMappingURL=AcEdLayerInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdLayerInfo.d.ts","sourceRoot":"","sources":["../../../src/editor/view/AcEdLayerInfo.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAA;CACf"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AcEdLayerInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdLayerInfo.js","sourceRoot":"","sources":["../../../src/editor/view/AcEdLayerInfo.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from './AcEdBaseView';
2
+ export * from './AcEdLayerInfo';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/view/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './AcEdBaseView';
2
+ export * from './AcEdLayerInfo';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/editor/view/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from './app';
2
+ export * from './command';
3
+ export * from './editor';
4
+ export * from './view';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA"}
package/lib/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from './app';
2
+ export * from './command';
3
+ export * from './editor';
4
+ export * from './view';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA"}
@@ -0,0 +1,92 @@
1
+ import { AcGeBox2d, AcGeBox3d } from '@mlightcad/data-model';
2
+ import * as THREE from 'three';
3
+ /**
4
+ * Converts a Three.js Box3 to a CAD geometry AcGeBox3d.
5
+ *
6
+ * @param from - The Three.js Box3 to convert
7
+ * @returns The equivalent CAD geometry Box3d
8
+ */
9
+ declare const threeBox3dToGeBox3d: (from: THREE.Box3) => AcGeBox3d;
10
+ /**
11
+ * Converts a CAD geometry AcGeBox3d to a CAD geometry Box2.
12
+ *
13
+ * @param from - The CAD geometry Box3d to convert
14
+ * @returns The converted CAD geometry Box2
15
+ */
16
+ declare const geBox3dToGeBox2d: (from: AcGeBox3d) => AcGeBox2d;
17
+ /**
18
+ * Converts a CAD geometry AcGeBox3d to a Three.js Box3.
19
+ *
20
+ * @param from - The CAD geometry Box3d to convert
21
+ * @returns The equivalent Three.js Box3
22
+ */
23
+ declare const geBox3dToThreeBox3d: (from: AcGeBox3d) => THREE.Box3;
24
+ /**
25
+ * Converts a Three.js Box2 to a CAD geometry AcGeBox2d.
26
+ *
27
+ * @param from - The Three.js Box2 to convert
28
+ * @returns The equivalent CAD geometry Box2d
29
+ */
30
+ declare const threeBox2dToGeBox2d: (from: THREE.Box2) => AcGeBox2d;
31
+ /**
32
+ * Converts a CAD geometry Box2d to a Three.js Box2.
33
+ *
34
+ * @param from - The CAD geometry Box2d to convert
35
+ * @returns The equivalent Three.js Box2
36
+ */
37
+ declare const geBox2dToThreeBox2d: (from: AcGeBox2d) => THREE.Box2;
38
+ /**
39
+ * Converts a Three.js Box3 to a CAD geometry Box2d by ignoring the Z dimension.
40
+ *
41
+ * @param from - The Three.js Box3 to convert
42
+ * @returns The equivalent CAD geometry Box2d (Z dimension discarded)
43
+ */
44
+ declare const threeBox3dToGeBox2d: (from: THREE.Box3) => AcGeBox2d;
45
+ /**
46
+ * Converts a CAD geometry AcGeBox2d to a Three.js Box3 by setting Z dimension to 0.
47
+ *
48
+ * @param from - The CAD geometry Box2d to convert
49
+ * @returns The equivalent Three.js Box3 with Z=0
50
+ */
51
+ declare const geBox2dToThreeBox3d: (from: AcGeBox2d) => THREE.Box3;
52
+ /**
53
+ * Utility object containing geometry conversion functions between Three.js and CAD geometry types.
54
+ *
55
+ * This utility provides bidirectional conversion functions for bounding boxes:
56
+ * - Between 2D and 3D bounding boxes
57
+ * - Between Three.js and CAD geometry coordinate systems
58
+ * - Cross-dimensional conversions (2D ↔ 3D)
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * // Convert Three.js box to CAD geometry
63
+ * const threeBox = new THREE.Box3();
64
+ * const cadBox = AcTrGeometryUtil.threeBox3dToGeBox3d(threeBox);
65
+ *
66
+ * // Convert CAD geometry box to Three.js
67
+ * const cadBox2d = new AcGeBox2d();
68
+ * const threeBox2d = AcTrGeometryUtil.goBox2dToThreeBox2d(cadBox2d);
69
+ *
70
+ * // Cross-dimensional conversion
71
+ * const threeBox3d = new THREE.Box3();
72
+ * const cadBox2d = AcTrGeometryUtil.threeBox3dToGeBox2d(threeBox3d);
73
+ * ```
74
+ */
75
+ declare const AcTrGeometryUtil: {
76
+ /** Converts Three.js Box2 to CAD geometry AcGeBox2d */
77
+ threeBo2dToGeBox2d: (from: THREE.Box2) => AcGeBox2d;
78
+ /** Converts CAD geometry AcGeBox2d to Three.js Box2 */
79
+ geBox2dToThreeBox2d: (from: AcGeBox2d) => THREE.Box2;
80
+ /** Converts Three.js Box3 to CAD geometry AcGeBox3d */
81
+ threeBox3dToGeBox3d: (from: THREE.Box3) => AcGeBox3d;
82
+ /** Converts CAD geometry AcGeBox3d to Three.js Box3 */
83
+ geBox3dToThreeBox3d: (from: AcGeBox3d) => THREE.Box3;
84
+ /** Converts CAD geometry AcGeBox3d to CAD geometry AcGeBox2d */
85
+ goBox3dToGeBox2d: (from: AcGeBox3d) => AcGeBox2d;
86
+ /** Converts Three.js Box3 to CAD geometry Box2d (ignores Z) */
87
+ threeBox3dToGeBox2d: (from: THREE.Box3) => AcGeBox2d;
88
+ /** Converts CAD geometry AcGeBox2d to Three.js Box3 (Z=0) */
89
+ geBox2dToThreeBox3d: (from: AcGeBox2d) => THREE.Box3;
90
+ };
91
+ export { threeBox2dToGeBox2d, geBox2dToThreeBox2d, threeBox3dToGeBox3d, geBox3dToThreeBox3d, geBox3dToGeBox2d, threeBox3dToGeBox2d, geBox2dToThreeBox3d, AcTrGeometryUtil };
92
+ //# sourceMappingURL=AcTrGeometryUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrGeometryUtil.d.ts","sourceRoot":"","sources":["../../src/util/AcTrGeometryUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAmB,MAAM,uBAAuB,CAAA;AAC7E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,GAAI,MAAM,KAAK,CAAC,IAAI,cAE5C,CAAA;AAED;;;;;GAKG;AACH,QAAA,MAAM,gBAAgB,GAAI,MAAM,SAAS,cAKxC,CAAA;AAED;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,GAAI,MAAM,SAAS,eAK3C,CAAA;AAED;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,GAAI,MAAM,KAAK,CAAC,IAAI,cAE5C,CAAA;AAED;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,GAAI,MAAM,SAAS,eAK3C,CAAA;AAED;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,GAAI,MAAM,KAAK,CAAC,IAAI,cAE5C,CAAA;AAED;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,GAAI,MAAM,SAAS,eAK3C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,QAAA,MAAM,gBAAgB;IACpB,uDAAuD;+BAhEtB,KAAK,CAAC,IAAI;IAkE3C,uDAAuD;gCAxDtB,SAAS;IA0D1C,uDAAuD;gCAxGtB,KAAK,CAAC,IAAI;IA0G3C,uDAAuD;gCAnFtB,SAAS;IAqF1C,gEAAgE;6BAlGlC,SAAS;IAoGvC,+DAA+D;gCAnD9B,KAAK,CAAC,IAAI;IAqD3C,6DAA6D;gCA3C5B,SAAS;CA6C3C,CAAA;AAED,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EACjB,CAAA"}
@@ -0,0 +1,109 @@
1
+ import { AcGeBox2d, AcGeBox3d } from '@mlightcad/data-model';
2
+ import * as THREE from 'three';
3
+ /**
4
+ * Converts a Three.js Box3 to a CAD geometry AcGeBox3d.
5
+ *
6
+ * @param from - The Three.js Box3 to convert
7
+ * @returns The equivalent CAD geometry Box3d
8
+ */
9
+ var threeBox3dToGeBox3d = function (from) {
10
+ return new AcGeBox3d(from.min, from.max);
11
+ };
12
+ /**
13
+ * Converts a CAD geometry AcGeBox3d to a CAD geometry Box2.
14
+ *
15
+ * @param from - The CAD geometry Box3d to convert
16
+ * @returns The converted CAD geometry Box2
17
+ */
18
+ var geBox3dToGeBox2d = function (from) {
19
+ return new AcGeBox2d(from.min, from.max);
20
+ };
21
+ /**
22
+ * Converts a CAD geometry AcGeBox3d to a Three.js Box3.
23
+ *
24
+ * @param from - The CAD geometry Box3d to convert
25
+ * @returns The equivalent Three.js Box3
26
+ */
27
+ var geBox3dToThreeBox3d = function (from) {
28
+ return new THREE.Box3(from.min, from.max);
29
+ };
30
+ /**
31
+ * Converts a Three.js Box2 to a CAD geometry AcGeBox2d.
32
+ *
33
+ * @param from - The Three.js Box2 to convert
34
+ * @returns The equivalent CAD geometry Box2d
35
+ */
36
+ var threeBox2dToGeBox2d = function (from) {
37
+ return new AcGeBox2d(from.min, from.max);
38
+ };
39
+ /**
40
+ * Converts a CAD geometry Box2d to a Three.js Box2.
41
+ *
42
+ * @param from - The CAD geometry Box2d to convert
43
+ * @returns The equivalent Three.js Box2
44
+ */
45
+ var geBox2dToThreeBox2d = function (from) {
46
+ return new THREE.Box2(from.min, from.max);
47
+ };
48
+ /**
49
+ * Converts a Three.js Box3 to a CAD geometry Box2d by ignoring the Z dimension.
50
+ *
51
+ * @param from - The Three.js Box3 to convert
52
+ * @returns The equivalent CAD geometry Box2d (Z dimension discarded)
53
+ */
54
+ var threeBox3dToGeBox2d = function (from) {
55
+ return new AcGeBox2d(from.min, from.max);
56
+ };
57
+ /**
58
+ * Converts a CAD geometry AcGeBox2d to a Three.js Box3 by setting Z dimension to 0.
59
+ *
60
+ * @param from - The CAD geometry Box2d to convert
61
+ * @returns The equivalent Three.js Box3 with Z=0
62
+ */
63
+ var geBox2dToThreeBox3d = function (from) {
64
+ var threeBox3d = new THREE.Box3();
65
+ threeBox3d.min.set(from.min.x, from.min.y, 0);
66
+ threeBox3d.max.set(from.max.x, from.max.y, 0);
67
+ return threeBox3d;
68
+ };
69
+ /**
70
+ * Utility object containing geometry conversion functions between Three.js and CAD geometry types.
71
+ *
72
+ * This utility provides bidirectional conversion functions for bounding boxes:
73
+ * - Between 2D and 3D bounding boxes
74
+ * - Between Three.js and CAD geometry coordinate systems
75
+ * - Cross-dimensional conversions (2D ↔ 3D)
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * // Convert Three.js box to CAD geometry
80
+ * const threeBox = new THREE.Box3();
81
+ * const cadBox = AcTrGeometryUtil.threeBox3dToGeBox3d(threeBox);
82
+ *
83
+ * // Convert CAD geometry box to Three.js
84
+ * const cadBox2d = new AcGeBox2d();
85
+ * const threeBox2d = AcTrGeometryUtil.goBox2dToThreeBox2d(cadBox2d);
86
+ *
87
+ * // Cross-dimensional conversion
88
+ * const threeBox3d = new THREE.Box3();
89
+ * const cadBox2d = AcTrGeometryUtil.threeBox3dToGeBox2d(threeBox3d);
90
+ * ```
91
+ */
92
+ var AcTrGeometryUtil = {
93
+ /** Converts Three.js Box2 to CAD geometry AcGeBox2d */
94
+ threeBo2dToGeBox2d: threeBox2dToGeBox2d,
95
+ /** Converts CAD geometry AcGeBox2d to Three.js Box2 */
96
+ geBox2dToThreeBox2d: geBox2dToThreeBox2d,
97
+ /** Converts Three.js Box3 to CAD geometry AcGeBox3d */
98
+ threeBox3dToGeBox3d: threeBox3dToGeBox3d,
99
+ /** Converts CAD geometry AcGeBox3d to Three.js Box3 */
100
+ geBox3dToThreeBox3d: geBox3dToThreeBox3d,
101
+ /** Converts CAD geometry AcGeBox3d to CAD geometry AcGeBox2d */
102
+ goBox3dToGeBox2d: geBox3dToGeBox2d,
103
+ /** Converts Three.js Box3 to CAD geometry Box2d (ignores Z) */
104
+ threeBox3dToGeBox2d: threeBox3dToGeBox2d,
105
+ /** Converts CAD geometry AcGeBox2d to Three.js Box3 (Z=0) */
106
+ geBox2dToThreeBox3d: geBox2dToThreeBox3d
107
+ };
108
+ export { threeBox2dToGeBox2d, geBox2dToThreeBox2d, threeBox3dToGeBox3d, geBox3dToThreeBox3d, geBox3dToGeBox2d, threeBox3dToGeBox2d, geBox2dToThreeBox3d, AcTrGeometryUtil };
109
+ //# sourceMappingURL=AcTrGeometryUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrGeometryUtil.js","sourceRoot":"","sources":["../../src/util/AcTrGeometryUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAmB,MAAM,uBAAuB,CAAA;AAC7E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;;;GAKG;AACH,IAAM,mBAAmB,GAAG,UAAC,IAAgB;IAC3C,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1C,CAAC,CAAA;AAED;;;;;GAKG;AACH,IAAM,gBAAgB,GAAG,UAAC,IAAe;IACvC,OAAO,IAAI,SAAS,CAClB,IAAI,CAAC,GAAiC,EACtC,IAAI,CAAC,GAAiC,CACvC,CAAA;AACH,CAAC,C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B;IACxC,uDAAuD;IACvD,mBAAmB,EAAE,mBAAmB;IACxC,uDAAuD;IACvD,mBAAmB,EAAE,mBAAmB;IACxC,gEAAgE;IAChE,gBAAgB,EAAE,gBAAgB;IAClC,+DAA+D;IAC/D,mBAAmB,EAAE,mBAAmB;IACxC,6DAA6D;IAC7D,mBAAmB,EAAE,mBAAmB;CACzC,CAAA;AAED,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EACjB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './AcTrGeometryUtil';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './AcTrGeometryUtil';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}