@mlightcad/cad-simple-viewer 1.0.0 → 1.0.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 (136) hide show
  1. package/README.md +296 -2
  2. package/dist/index.js +1348 -122
  3. package/dist/index.umd.cjs +2 -2
  4. package/lib/app/AcApContext.d.ts +45 -3
  5. package/lib/app/AcApContext.d.ts.map +1 -1
  6. package/lib/app/AcApContext.js +43 -3
  7. package/lib/app/AcApContext.js.map +1 -1
  8. package/lib/app/AcApDocCreator.d.ts +68 -2
  9. package/lib/app/AcApDocCreator.d.ts.map +1 -1
  10. package/lib/app/AcApDocCreator.js +67 -2
  11. package/lib/app/AcApDocCreator.js.map +1 -1
  12. package/lib/app/AcApDocManager.d.ts +227 -12
  13. package/lib/app/AcApDocManager.d.ts.map +1 -1
  14. package/lib/app/AcApDocManager.js +229 -17
  15. package/lib/app/AcApDocManager.js.map +1 -1
  16. package/lib/app/AcApDocument.d.ts +77 -3
  17. package/lib/app/AcApDocument.d.ts.map +1 -1
  18. package/lib/app/AcApDocument.js +75 -3
  19. package/lib/app/AcApDocument.js.map +1 -1
  20. package/lib/app/AcApFontLoader.d.ts +32 -0
  21. package/lib/app/AcApFontLoader.d.ts.map +1 -1
  22. package/lib/app/AcApFontLoader.js +30 -0
  23. package/lib/app/AcApFontLoader.js.map +1 -1
  24. package/lib/app/AcApSettingManager.d.ts +191 -3
  25. package/lib/app/AcApSettingManager.d.ts.map +1 -1
  26. package/lib/app/AcApSettingManager.js +161 -0
  27. package/lib/app/AcApSettingManager.js.map +1 -1
  28. package/lib/command/AcApConvertToSvgCmd.d.ts +26 -0
  29. package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -1
  30. package/lib/command/AcApConvertToSvgCmd.js +26 -0
  31. package/lib/command/AcApConvertToSvgCmd.js.map +1 -1
  32. package/lib/command/AcApOpenCmd.d.ts +31 -0
  33. package/lib/command/AcApOpenCmd.d.ts.map +1 -1
  34. package/lib/command/AcApOpenCmd.js +31 -0
  35. package/lib/command/AcApOpenCmd.js.map +1 -1
  36. package/lib/command/AcApPanCmd.d.ts +25 -0
  37. package/lib/command/AcApPanCmd.d.ts.map +1 -1
  38. package/lib/command/AcApPanCmd.js +25 -0
  39. package/lib/command/AcApPanCmd.js.map +1 -1
  40. package/lib/command/AcApQNewCmd.d.ts +26 -0
  41. package/lib/command/AcApQNewCmd.d.ts.map +1 -1
  42. package/lib/command/AcApQNewCmd.js +26 -0
  43. package/lib/command/AcApQNewCmd.js.map +1 -1
  44. package/lib/command/AcApSelectCmd.d.ts +26 -0
  45. package/lib/command/AcApSelectCmd.d.ts.map +1 -1
  46. package/lib/command/AcApSelectCmd.js +26 -0
  47. package/lib/command/AcApSelectCmd.js.map +1 -1
  48. package/lib/command/AcApSvgConvertor.d.ts +48 -0
  49. package/lib/command/AcApSvgConvertor.d.ts.map +1 -1
  50. package/lib/command/AcApSvgConvertor.js +48 -0
  51. package/lib/command/AcApSvgConvertor.js.map +1 -1
  52. package/lib/command/AcApZoomCmd.d.ts +29 -0
  53. package/lib/command/AcApZoomCmd.d.ts.map +1 -1
  54. package/lib/command/AcApZoomCmd.js +29 -0
  55. package/lib/command/AcApZoomCmd.js.map +1 -1
  56. package/lib/command/AcApZoomToBoxCmd.d.ts +57 -0
  57. package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -1
  58. package/lib/command/AcApZoomToBoxCmd.js +57 -0
  59. package/lib/command/AcApZoomToBoxCmd.js.map +1 -1
  60. package/lib/editor/command/AcEdCommand.d.ts +118 -9
  61. package/lib/editor/command/AcEdCommand.d.ts.map +1 -1
  62. package/lib/editor/command/AcEdCommand.js +113 -9
  63. package/lib/editor/command/AcEdCommand.js.map +1 -1
  64. package/lib/editor/command/AcEdCommandStack.d.ts +59 -5
  65. package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -1
  66. package/lib/editor/command/AcEdCommandStack.js +48 -5
  67. package/lib/editor/command/AcEdCommandStack.js.map +1 -1
  68. package/lib/editor/global/eventBus.d.ts +76 -7
  69. package/lib/editor/global/eventBus.d.ts.map +1 -1
  70. package/lib/editor/global/eventBus.js +38 -0
  71. package/lib/editor/global/eventBus.js.map +1 -1
  72. package/lib/editor/input/AcEdBaseInput.d.ts +65 -1
  73. package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -1
  74. package/lib/editor/input/AcEdBaseInput.js +62 -1
  75. package/lib/editor/input/AcEdBaseInput.js.map +1 -1
  76. package/lib/editor/input/AcEdBoxSelector.d.ts +81 -0
  77. package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -1
  78. package/lib/editor/input/AcEdBoxSelector.js +80 -0
  79. package/lib/editor/input/AcEdBoxSelector.js.map +1 -1
  80. package/lib/editor/input/AcEdCursorManager.d.ts +95 -8
  81. package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
  82. package/lib/editor/input/AcEdCursorManager.js +95 -11
  83. package/lib/editor/input/AcEdCursorManager.js.map +1 -1
  84. package/lib/editor/input/AcEdInputPoint.d.ts +38 -1
  85. package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -1
  86. package/lib/editor/input/AcEdInputPoint.js +38 -1
  87. package/lib/editor/input/AcEdInputPoint.js.map +1 -1
  88. package/lib/editor/input/AcEdJig.d.ts +166 -0
  89. package/lib/editor/input/AcEdJig.d.ts.map +1 -1
  90. package/lib/editor/input/AcEdJig.js +164 -0
  91. package/lib/editor/input/AcEdJig.js.map +1 -1
  92. package/lib/editor/input/AcEdJigLoop.d.ts +49 -0
  93. package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -1
  94. package/lib/editor/input/AcEdJigLoop.js +48 -0
  95. package/lib/editor/input/AcEdJigLoop.js.map +1 -1
  96. package/lib/editor/input/AcEdSelectionSet.d.ts +122 -2
  97. package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -1
  98. package/lib/editor/input/AcEdSelectionSet.js +117 -1
  99. package/lib/editor/input/AcEdSelectionSet.js.map +1 -1
  100. package/lib/editor/input/AcEditor.d.ts +90 -6
  101. package/lib/editor/input/AcEditor.d.ts.map +1 -1
  102. package/lib/editor/input/AcEditor.js +86 -6
  103. package/lib/editor/input/AcEditor.js.map +1 -1
  104. package/lib/editor/view/AcEdBaseView.d.ts +163 -16
  105. package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
  106. package/lib/editor/view/AcEdBaseView.js +94 -5
  107. package/lib/editor/view/AcEdBaseView.js.map +1 -1
  108. package/lib/util/AcTrGeometryUtil.d.ts +65 -0
  109. package/lib/util/AcTrGeometryUtil.d.ts.map +1 -1
  110. package/lib/util/AcTrGeometryUtil.js +65 -0
  111. package/lib/util/AcTrGeometryUtil.js.map +1 -1
  112. package/lib/view/AcTrLayer.d.ts +40 -5
  113. package/lib/view/AcTrLayer.d.ts.map +1 -1
  114. package/lib/view/AcTrLayer.js +34 -5
  115. package/lib/view/AcTrLayer.js.map +1 -1
  116. package/lib/view/AcTrLayout.d.ts +122 -23
  117. package/lib/view/AcTrLayout.d.ts.map +1 -1
  118. package/lib/view/AcTrLayout.js +103 -23
  119. package/lib/view/AcTrLayout.js.map +1 -1
  120. package/lib/view/AcTrLayoutView.d.ts +74 -16
  121. package/lib/view/AcTrLayoutView.d.ts.map +1 -1
  122. package/lib/view/AcTrLayoutView.js +65 -16
  123. package/lib/view/AcTrLayoutView.js.map +1 -1
  124. package/lib/view/AcTrLayoutViewManager.d.ts +58 -12
  125. package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -1
  126. package/lib/view/AcTrLayoutViewManager.js +56 -12
  127. package/lib/view/AcTrLayoutViewManager.js.map +1 -1
  128. package/lib/view/AcTrScene.d.ts +48 -4
  129. package/lib/view/AcTrScene.d.ts.map +1 -1
  130. package/lib/view/AcTrScene.js +44 -4
  131. package/lib/view/AcTrScene.js.map +1 -1
  132. package/lib/view/AcTrView2d.d.ts +71 -0
  133. package/lib/view/AcTrView2d.d.ts.map +1 -1
  134. package/lib/view/AcTrView2d.js +65 -0
  135. package/lib/view/AcTrView2d.js.map +1 -1
  136. package/package.json +8 -4
@@ -55,15 +55,38 @@ export interface AcEdViewHoverEventArgs {
55
55
  id: AcDbObjectId;
56
56
  }
57
57
  /**
58
- * View mode
58
+ * Enumeration of view interaction modes.
59
+ *
60
+ * The view mode determines how the view responds to user mouse interactions:
61
+ * - In SELECTION mode, clicks select entities
62
+ * - In PAN mode, clicks and drags pan the view
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * // Set to selection mode for entity picking
67
+ * view.mode = AcEdViewMode.SELECTION;
68
+ *
69
+ * // Set to pan mode for view navigation
70
+ * view.mode = AcEdViewMode.PAN;
71
+ * ```
59
72
  */
60
73
  export declare enum AcEdViewMode {
61
74
  /**
62
- * Click to select
75
+ * Selection mode - mouse clicks select entities.
76
+ *
77
+ * In this mode:
78
+ * - Single clicks select individual entities
79
+ * - Drag operations can create selection boxes
80
+ * - Selected entities are highlighted with grip points
63
81
  */
64
82
  SELECTION = 0,
65
83
  /**
66
- * Click to move
84
+ * Pan mode - mouse interactions pan the view.
85
+ *
86
+ * In this mode:
87
+ * - Click and drag operations move the view
88
+ * - The cursor typically changes to indicate pan mode
89
+ * - Entity selection is disabled
67
90
  */
68
91
  PAN = 1
69
92
  }
@@ -81,62 +104,186 @@ export type AcEdCalculateSizeCallback = () => {
81
104
  width: number;
82
105
  height: number;
83
106
  };
107
+ /**
108
+ * Abstract base class for all CAD view implementations.
109
+ *
110
+ * This class provides the foundation for rendering and interacting with CAD drawings.
111
+ * It manages:
112
+ * - Canvas and viewport dimensions
113
+ * - Mouse event handling and coordinate conversion
114
+ * - Entity selection and highlighting
115
+ * - View modes (selection, pan, etc.)
116
+ * - Spatial queries for entity picking
117
+ * - Hover/unhover detection with timing
118
+ *
119
+ * Concrete implementations must provide specific rendering logic and coordinate
120
+ * transformations appropriate for their rendering technology (e.g., Three.js, SVG).
121
+ *
122
+ * ## Key Responsibilities
123
+ * - **Input Management**: Handles mouse events and user interactions
124
+ * - **Selection**: Manages selected entities and visual feedback
125
+ * - **Coordinate Systems**: Converts between screen and world coordinates
126
+ * - **Spatial Queries**: Finds entities at specific locations
127
+ * - **View State**: Tracks current position, zoom, and view mode
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * class MyView extends AcEdBaseView {
132
+ * // Implement required abstract methods
133
+ * get missedData() { return { fonts: {}, images: new Map() }; }
134
+ * get mode() { return this._mode; }
135
+ * set mode(value) { this._mode = value; }
136
+ * // ... other abstract methods
137
+ * }
138
+ *
139
+ * const view = new MyView(canvasElement);
140
+ * view.events.mouseMove.addEventListener(args => {
141
+ * console.log('Mouse at world coords:', args.x, args.y);
142
+ * });
143
+ * ```
144
+ */
84
145
  export declare abstract class AcEdBaseView {
146
+ /** Current viewport width in pixels */
85
147
  private _width;
148
+ /** Current viewport height in pixels */
86
149
  private _height;
150
+ /** Optional callback to calculate canvas size on resize */
87
151
  private _calculateSizeCallback?;
152
+ /** Bounding box of all entities in the view */
88
153
  private _bbox;
154
+ /** Current mouse position in world coordinates */
89
155
  private _curPos;
156
+ /** Current mouse position in screen coordinates */
90
157
  private _curScreenPos;
158
+ /** Set of currently selected entities */
91
159
  private _selectionSet;
160
+ /** Input manager for handling user interactions */
92
161
  private _editor;
162
+ /** Size of selection box in pixels for entity picking */
93
163
  private _selectionBoxSize;
164
+ /** Timer for hover detection delay */
94
165
  private _hoverTimer;
166
+ /** Timer for hover pause detection */
95
167
  private _pauseTimer;
168
+ /** ID of currently hovered entity */
96
169
  private _hoveredObjectId;
170
+ /** The HTML canvas element for rendering */
97
171
  protected _canvas: HTMLCanvasElement;
172
+ /** Events fired by the view for various interactions */
98
173
  readonly events: {
174
+ /** Fired when mouse moves over the view */
99
175
  mouseMove: AcCmEventManager<AcEdMouseEventArgs>;
176
+ /** Fired when the view is resized */
100
177
  viewResize: AcCmEventManager<AcEdViewResizedEventArgs>;
178
+ /** Fired when mouse hovers over an entity */
101
179
  hover: AcCmEventManager<AcEdViewHoverEventArgs>;
180
+ /** Fired when mouse stops hovering over an entity */
102
181
  unhover: AcCmEventManager<AcEdViewHoverEventArgs>;
103
182
  };
183
+ /**
184
+ * Creates a new base view instance.
185
+ *
186
+ * Sets up the canvas, initializes internal state, and registers event listeners
187
+ * for mouse interactions and window resize events.
188
+ *
189
+ * @param canvas - The HTML canvas element to render into
190
+ */
104
191
  constructor(canvas: HTMLCanvasElement);
105
192
  /**
106
- * The input manager
193
+ * Gets the input manager for handling user interactions.
194
+ *
195
+ * The editor provides high-level methods for getting user input like
196
+ * point selection, entity selection, and cursor management.
197
+ *
198
+ * @returns The editor instance
107
199
  */
108
200
  get editor(): AcEditor;
109
201
  /**
110
- * The size of selection box in pixel unit
202
+ * Gets the size of the selection box used for entity picking.
203
+ *
204
+ * This determines how close the mouse needs to be to an entity
205
+ * to select it, measured in screen pixels.
206
+ *
207
+ * @returns Selection box size in pixels
111
208
  */
112
209
  get selectionBoxSize(): number;
210
+ /**
211
+ * Sets the size of the selection box used for entity picking.
212
+ *
213
+ * @param value - Selection box size in pixels
214
+ */
113
215
  set selectionBoxSize(value: number);
114
216
  /**
115
- * The missed data such as fonts, images, and xrefs.
217
+ * Gets information about missing data during rendering.
218
+ *
219
+ * This includes fonts that couldn't be loaded and images that are
220
+ * missing or inaccessible. Implementations should track and report
221
+ * this information to help users understand rendering issues.
222
+ *
223
+ * @returns Object containing missing fonts and images
116
224
  */
117
225
  abstract get missedData(): AcEdMissedData;
118
226
  /**
119
- * The view mode of the current view
227
+ * Gets the current view mode.
228
+ *
229
+ * The view mode determines how the view responds to user interactions:
230
+ * - SELECTION: Click to select entities
231
+ * - PAN: Click and drag to pan the view
232
+ *
233
+ * @returns The current view mode
120
234
  */
121
235
  abstract get mode(): AcEdViewMode;
236
+ /**
237
+ * Sets the current view mode.
238
+ *
239
+ * @param value - The view mode to set
240
+ */
122
241
  abstract set mode(value: AcEdViewMode);
123
242
  /**
124
- * The center point of the current view
243
+ * Gets the center point of the current view in world coordinates.
244
+ *
245
+ * @returns The view center point
125
246
  */
126
247
  abstract get center(): AcGePoint2d;
248
+ /**
249
+ * Sets the center point of the current view in world coordinates.
250
+ *
251
+ * @param value - The new center point
252
+ */
127
253
  abstract set center(value: AcGePoint2d);
128
254
  /**
129
- * Convert point cooridinate from the client window coordinate system to the world coordinate system.
130
- * The origin of the client window coordinate system is the left-top corner of the client window.
131
- * @param point Input point to convert
132
- * @returns Return point coordinate in the world coordinate system
255
+ * Converts a point from client window coordinates to world coordinates.
256
+ *
257
+ * The client window coordinate system has its origin at the top-left corner
258
+ * of the canvas, with Y increasing downward. World coordinates use the
259
+ * CAD coordinate system with Y typically increasing upward.
260
+ *
261
+ * @param point - Point in client window coordinates
262
+ * @returns Point in world coordinates
263
+ *
264
+ * @example
265
+ * ```typescript
266
+ * const screenPoint = { x: 100, y: 200 }; // 100px right, 200px down
267
+ * const worldPoint = view.cwcs2Wcs(screenPoint);
268
+ * console.log('World coordinates:', worldPoint.x, worldPoint.y);
269
+ * ```
133
270
  */
134
271
  abstract cwcs2Wcs(point: AcGePoint2dLike): AcGePoint2d;
135
272
  /**
136
- * Convert point cooridinate from the world coordinate system to the client window coordinate system.
137
- * The origin of the client window coordinate system is the left-top corner of the client window.
138
- * @param point Input point to convert
139
- * @returns Return point coordinate in the client window coordinate system
273
+ * Converts a point from world coordinates to client window coordinates.
274
+ *
275
+ * This is the inverse of `cwcs2Wcs()`, converting from the CAD world
276
+ * coordinate system to screen pixel coordinates.
277
+ *
278
+ * @param point - Point in world coordinates
279
+ * @returns Point in client window coordinates
280
+ *
281
+ * @example
282
+ * ```typescript
283
+ * const worldPoint = new AcGePoint2d(10, 20); // CAD coordinates
284
+ * const screenPoint = view.wcs2Cwcs(worldPoint);
285
+ * console.log('Screen position:', screenPoint.x, screenPoint.y);
286
+ * ```
140
287
  */
141
288
  abstract wcs2Cwcs(point: AcGePoint2dLike): AcGePoint2d;
142
289
  abstract zoomTo(box: AcGeBox2d, margin: number): void;
@@ -1 +1 @@
1
- {"version":3,"file":"AcEdBaseView.d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tB;IAED;;OAEG;IACH,IAAI,MAAM,IAGQ,MAAM,CADvB;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAEvB;IAED;;OAEG;IACH,IAAI,IAAI,cAEP;IAED;;OAEG;IACH,IAAI,MAAM,sBAET;IAED,IAAI,MAAM,WAET;IAED;;OAEG;IACH,IAAI,MAAM,gBAET;IAED;;OAEG;IACH,IAAI,YAAY,gBAEf;IAED;;OAEG;IACH,IAAI,YAAY,qBAEf;IAED,SAAS,CAAC,cAAc;IAexB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,eAAe;CASxB"}
1
+ {"version":3,"file":"AcEdBaseView.d.ts","sourceRoot":"","sources":["../../../src/editor/view/AcEdBaseView.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,EACT,WAAW,EACX,eAAe,EAChB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,YAAY,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,CAAC,EAAE,MAAM,CAAA;IACT;;OAEG;IACH,CAAC,EAAE,MAAM,CAAA;CACV;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,KAAK,EA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AAM,gBAET;IAED;;OAEG;IACH,IAAI,YAAY,gBAEf;IAED;;OAEG;IACH,IAAI,YAAY,qBAEf;IAED,SAAS,CAAC,cAAc;IAexB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,eAAe;CASxB"}
@@ -2,26 +2,100 @@ import { AcCmEventManager, AcGeBox3d, AcGePoint2d } from '@mlightcad/data-model'
2
2
  import { AcEdCorsorType, AcEdSelectionSet } from '../input';
3
3
  import { AcEditor } from '../input/AcEditor';
4
4
  /**
5
- * View mode
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
+ * ```
6
19
  */
7
20
  export var AcEdViewMode;
8
21
  (function (AcEdViewMode) {
9
22
  /**
10
- * Click to select
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
11
29
  */
12
30
  AcEdViewMode[AcEdViewMode["SELECTION"] = 0] = "SELECTION";
13
31
  /**
14
- * Click to move
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
15
38
  */
16
39
  AcEdViewMode[AcEdViewMode["PAN"] = 1] = "PAN";
17
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
+ */
18
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
+ */
19
88
  function AcEdBaseView(canvas) {
20
89
  var _this = this;
90
+ /** Events fired by the view for various interactions */
21
91
  this.events = {
92
+ /** Fired when mouse moves over the view */
22
93
  mouseMove: new AcCmEventManager(),
94
+ /** Fired when the view is resized */
23
95
  viewResize: new AcCmEventManager(),
96
+ /** Fired when mouse hovers over an entity */
24
97
  hover: new AcCmEventManager(),
98
+ /** Fired when mouse stops hovering over an entity */
25
99
  unhover: new AcCmEventManager()
26
100
  };
27
101
  this._canvas = canvas;
@@ -55,7 +129,12 @@ var AcEdBaseView = /** @class */ (function () {
55
129
  }
56
130
  Object.defineProperty(AcEdBaseView.prototype, "editor", {
57
131
  /**
58
- * The input manager
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
59
138
  */
60
139
  get: function () {
61
140
  return this._editor;
@@ -65,11 +144,21 @@ var AcEdBaseView = /** @class */ (function () {
65
144
  });
66
145
  Object.defineProperty(AcEdBaseView.prototype, "selectionBoxSize", {
67
146
  /**
68
- * The size of selection box in pixel unit
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
69
153
  */
70
154
  get: function () {
71
155
  return this._selectionBoxSize;
72
156
  },
157
+ /**
158
+ * Sets the size of the selection box used for entity picking.
159
+ *
160
+ * @param value - Selection box size in pixels
161
+ */
73
162
  set: function (value) {
74
163
  this._selectionBoxSize = value;
75
164
  },
@@ -1 +1 @@
1
- {"version":3,"file":"AcEdBaseView.js","sourceRoot":"","sources":["../../../src/editor/view/AcEdBaseView.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAIhB,SAAS,EACT,WAAW,EAEZ,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AA2D5C;;GAEG;AACH,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB;;OAEG;IACH,yDAAa,CAAA;IACb;;OAEG;IACH,6CAAO,CAAA;AACT,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB;AAeD;IAyBE,sBAAY,MAAyB;QAArC,iBA8BC;QArCe,WAAM,GAAG;YACvB,SAAS,EAA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AC,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,AAhbD,IAgbC"}
@@ -1,17 +1,82 @@
1
1
  import { AcGeBox2d, AcGeBox3d } from '@mlightcad/data-model';
2
2
  import * as THREE from 'three';
3
+ /**
4
+ * Converts a Three.js Box3 to a CAD geometry Box3d.
5
+ *
6
+ * @param from - The Three.js Box3 to convert
7
+ * @returns The equivalent CAD geometry Box3d
8
+ */
3
9
  declare const threeBox3dToGeBox3d: (from: THREE.Box3) => AcGeBox3d;
10
+ /**
11
+ * Converts a CAD geometry Box3d to a Three.js Box3.
12
+ *
13
+ * @param from - The CAD geometry Box3d to convert
14
+ * @returns The equivalent Three.js Box3
15
+ */
4
16
  declare const goBox3dToThreeBox3d: (from: AcGeBox3d) => THREE.Box3;
17
+ /**
18
+ * Converts a Three.js Box2 to a CAD geometry Box2d.
19
+ *
20
+ * @param from - The Three.js Box2 to convert
21
+ * @returns The equivalent CAD geometry Box2d
22
+ */
5
23
  declare const threeBo2dToGeBox2d: (from: THREE.Box2) => AcGeBox2d;
24
+ /**
25
+ * Converts a CAD geometry Box2d to a Three.js Box2.
26
+ *
27
+ * @param from - The CAD geometry Box2d to convert
28
+ * @returns The equivalent Three.js Box2
29
+ */
6
30
  declare const goBox2dToThreeBox2d: (from: AcGeBox2d) => THREE.Box2;
31
+ /**
32
+ * Converts a Three.js Box3 to a CAD geometry Box2d by ignoring the Z dimension.
33
+ *
34
+ * @param from - The Three.js Box3 to convert
35
+ * @returns The equivalent CAD geometry Box2d (Z dimension discarded)
36
+ */
7
37
  declare const threeBox3dToGeBox2d: (from: THREE.Box3) => AcGeBox2d;
38
+ /**
39
+ * Converts a CAD geometry Box2d to a Three.js Box3 by setting Z dimension to 0.
40
+ *
41
+ * @param from - The CAD geometry Box2d to convert
42
+ * @returns The equivalent Three.js Box3 with Z=0
43
+ */
8
44
  declare const goBox2dToThreeBox3d: (from: AcGeBox2d) => THREE.Box3;
45
+ /**
46
+ * Utility object containing geometry conversion functions between Three.js and CAD geometry types.
47
+ *
48
+ * This utility provides bidirectional conversion functions for bounding boxes:
49
+ * - Between 2D and 3D bounding boxes
50
+ * - Between Three.js and CAD geometry coordinate systems
51
+ * - Cross-dimensional conversions (2D ↔ 3D)
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * // Convert Three.js box to CAD geometry
56
+ * const threeBox = new THREE.Box3();
57
+ * const cadBox = AcTrGeometryUtil.threeBox3dToGeBox3d(threeBox);
58
+ *
59
+ * // Convert CAD geometry box to Three.js
60
+ * const cadBox2d = new AcGeBox2d();
61
+ * const threeBox2d = AcTrGeometryUtil.goBox2dToThreeBox2d(cadBox2d);
62
+ *
63
+ * // Cross-dimensional conversion
64
+ * const threeBox3d = new THREE.Box3();
65
+ * const cadBox2d = AcTrGeometryUtil.threeBox3dToGeBox2d(threeBox3d);
66
+ * ```
67
+ */
9
68
  declare const AcTrGeometryUtil: {
69
+ /** Converts Three.js Box2 to CAD geometry Box2d */
10
70
  threeBo2dToGeBox2d: (from: THREE.Box2) => AcGeBox2d;
71
+ /** Converts CAD geometry Box2d to Three.js Box2 */
11
72
  goBox2dToThreeBox2d: (from: AcGeBox2d) => THREE.Box2;
73
+ /** Converts Three.js Box3 to CAD geometry Box3d */
12
74
  threeBox3dToGeBox3d: (from: THREE.Box3) => AcGeBox3d;
75
+ /** Converts CAD geometry Box3d to Three.js Box3 */
13
76
  goBox3dToThreeBox3d: (from: AcGeBox3d) => THREE.Box3;
77
+ /** Converts Three.js Box3 to CAD geometry Box2d (ignores Z) */
14
78
  threeBox3dToGeBox2d: (from: THREE.Box3) => AcGeBox2d;
79
+ /** Converts CAD geometry Box2d to Three.js Box3 (Z=0) */
15
80
  goBox2dToThreeBox3d: (from: AcGeBox2d) => THREE.Box3;
16
81
  };
17
82
  export { threeBo2dToGeBox2d, goBox2dToThreeBox2d, threeBox3dToGeBox3d, goBox3dToThreeBox3d, threeBox3dToGeBox2d, goBox2dToThreeBox3d, AcTrGeometryUtil };
@@ -1 +1 @@
1
- {"version":3,"file":"AcTrGeometryUtil.d.ts","sourceRoot":"","sources":["../../src/util/AcTrGeometryUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,QAAA,MAAM,mBAAmB,GAAI,MAAM,KAAK,CAAC,IAAI,cAE5C,CAAA;AAED,QAAA,MAAM,mBAAmB,GAAI,MAAM,SAAS,eAK3C,CAAA;AAED,QAAA,MAAM,kBAAkB,GAAI,MAAM,KAAK,CAAC,IAAI,cAE3C,CAAA;AAED,QAAA,MAAM,mBAAmB,GAAI,MAAM,SAAS,eAK3C,CAAA;AAED,QAAA,MAAM,mBAAmB,GAAI,MAAM,KAAK,CAAC,IAAI,cAE5C,CAAA;AAED,QAAA,MAAM,mBAAmB,GAAI,MAAM,SAAS,eAK3C,CAAA;AAED,QAAA,MAAM,gBAAgB;+BAtBY,KAAK,CAAC,IAAI;gCAIT,SAAS;gCAfT,KAAK,CAAC,IAAI;gCAIV,SAAS;gCAkBT,KAAK,CAAC,IAAI;gCAIV,SAAS;CAc3C,CAAA;AAED,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EACjB,CAAA"}
1
+ {"version":3,"file":"AcTrGeometryUtil.d.ts","sourceRoot":"","sources":["../../src/util/AcTrGeometryUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;;;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,kBAAkB,GAAI,MAAM,KAAK,CAAC,IAAI,cAE3C,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,mDAAmD;+BAhEnB,KAAK,CAAC,IAAI;IAkE1C,mDAAmD;gCAxDlB,SAAS;IA0D1C,mDAAmD;gCA3FlB,KAAK,CAAC,IAAI;IA6F3C,mDAAmD;gCAnFlB,SAAS;IAqF1C,+DAA+D;gCAjD9B,KAAK,CAAC,IAAI;IAmD3C,yDAAyD;gCAzCxB,SAAS;CA2C3C,CAAA;AAED,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EACjB,CAAA"}
@@ -1,32 +1,97 @@
1
1
  import { AcGeBox2d, AcGeBox3d } from '@mlightcad/data-model';
2
2
  import * as THREE from 'three';
3
+ /**
4
+ * Converts a Three.js Box3 to a CAD geometry Box3d.
5
+ *
6
+ * @param from - The Three.js Box3 to convert
7
+ * @returns The equivalent CAD geometry Box3d
8
+ */
3
9
  var threeBox3dToGeBox3d = function (from) {
4
10
  return new AcGeBox3d(from.min, from.max);
5
11
  };
12
+ /**
13
+ * Converts a CAD geometry Box3d to a Three.js Box3.
14
+ *
15
+ * @param from - The CAD geometry Box3d to convert
16
+ * @returns The equivalent Three.js Box3
17
+ */
6
18
  var goBox3dToThreeBox3d = function (from) {
7
19
  return new THREE.Box3(from.min, from.max);
8
20
  };
21
+ /**
22
+ * Converts a Three.js Box2 to a CAD geometry Box2d.
23
+ *
24
+ * @param from - The Three.js Box2 to convert
25
+ * @returns The equivalent CAD geometry Box2d
26
+ */
9
27
  var threeBo2dToGeBox2d = function (from) {
10
28
  return new AcGeBox2d(from.min, from.max);
11
29
  };
30
+ /**
31
+ * Converts a CAD geometry Box2d to a Three.js Box2.
32
+ *
33
+ * @param from - The CAD geometry Box2d to convert
34
+ * @returns The equivalent Three.js Box2
35
+ */
12
36
  var goBox2dToThreeBox2d = function (from) {
13
37
  return new THREE.Box2(from.min, from.max);
14
38
  };
39
+ /**
40
+ * Converts a Three.js Box3 to a CAD geometry Box2d by ignoring the Z dimension.
41
+ *
42
+ * @param from - The Three.js Box3 to convert
43
+ * @returns The equivalent CAD geometry Box2d (Z dimension discarded)
44
+ */
15
45
  var threeBox3dToGeBox2d = function (from) {
16
46
  return new AcGeBox2d(from.min, from.max);
17
47
  };
48
+ /**
49
+ * Converts a CAD geometry Box2d to a Three.js Box3 by setting Z dimension to 0.
50
+ *
51
+ * @param from - The CAD geometry Box2d to convert
52
+ * @returns The equivalent Three.js Box3 with Z=0
53
+ */
18
54
  var goBox2dToThreeBox3d = function (from) {
19
55
  var threeBox3d = new THREE.Box3();
20
56
  threeBox3d.min.set(from.min.x, from.min.y, 0);
21
57
  threeBox3d.max.set(from.max.x, from.max.y, 0);
22
58
  return threeBox3d;
23
59
  };
60
+ /**
61
+ * Utility object containing geometry conversion functions between Three.js and CAD geometry types.
62
+ *
63
+ * This utility provides bidirectional conversion functions for bounding boxes:
64
+ * - Between 2D and 3D bounding boxes
65
+ * - Between Three.js and CAD geometry coordinate systems
66
+ * - Cross-dimensional conversions (2D ↔ 3D)
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * // Convert Three.js box to CAD geometry
71
+ * const threeBox = new THREE.Box3();
72
+ * const cadBox = AcTrGeometryUtil.threeBox3dToGeBox3d(threeBox);
73
+ *
74
+ * // Convert CAD geometry box to Three.js
75
+ * const cadBox2d = new AcGeBox2d();
76
+ * const threeBox2d = AcTrGeometryUtil.goBox2dToThreeBox2d(cadBox2d);
77
+ *
78
+ * // Cross-dimensional conversion
79
+ * const threeBox3d = new THREE.Box3();
80
+ * const cadBox2d = AcTrGeometryUtil.threeBox3dToGeBox2d(threeBox3d);
81
+ * ```
82
+ */
24
83
  var AcTrGeometryUtil = {
84
+ /** Converts Three.js Box2 to CAD geometry Box2d */
25
85
  threeBo2dToGeBox2d: threeBo2dToGeBox2d,
86
+ /** Converts CAD geometry Box2d to Three.js Box2 */
26
87
  goBox2dToThreeBox2d: goBox2dToThreeBox2d,
88
+ /** Converts Three.js Box3 to CAD geometry Box3d */
27
89
  threeBox3dToGeBox3d: threeBox3dToGeBox3d,
90
+ /** Converts CAD geometry Box3d to Three.js Box3 */
28
91
  goBox3dToThreeBox3d: goBox3dToThreeBox3d,
92
+ /** Converts Three.js Box3 to CAD geometry Box2d (ignores Z) */
29
93
  threeBox3dToGeBox2d: threeBox3dToGeBox2d,
94
+ /** Converts CAD geometry Box2d to Three.js Box3 (Z=0) */
30
95
  goBox2dToThreeBox3d: goBox2dToThreeBox3d
31
96
  };
32
97
  export { threeBo2dToGeBox2d, goBox2dToThreeBox2d, threeBox3dToGeBox3d, goBox3dToThreeBox3d, threeBox3dToGeBox2d, goBox2dToThreeBox3d, AcTrGeometryUtil };
@@ -1 +1 @@
1
- {"version":3,"file":"AcTrGeometryUtil.js","sour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