@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
@@ -15,20 +15,52 @@ var __extends = (this && this.__extends) || (function () {
15
15
  })();
16
16
  import { AcCmColor, AcGeBox2d, AcGePoint2d } from '@mlightcad/data-model';
17
17
  import { AcEdBaseInput } from './AcEdBaseInput';
18
+ /** Default border color for the selection box */
18
19
  var BORDER_COLOR = 0xffffff;
20
+ /** Default border width for the selection box */
19
21
  var BORDER_WIDTH = '1px';
20
22
  /**
21
23
  * Selector used to select entities by a box.
24
+ *
25
+ * This class provides interactive box selection functionality for the CAD editor.
26
+ * Users can click and drag to create a selection rectangle, which is then converted
27
+ * to world coordinates for entity selection operations.
28
+ *
29
+ * The selector handles mouse events to track the selection area and provides visual
30
+ * feedback through a DOM overlay showing the selection bounds.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * const boxSelector = new AcEdBoxSelector(view);
35
+ * const selectionBox = await boxSelector.start();
36
+ * // Use selectionBox to select entities
37
+ * ```
38
+ *
22
39
  * @internal
23
40
  */
24
41
  var AcEdBoxSelector = /** @class */ (function (_super) {
25
42
  __extends(AcEdBoxSelector, _super);
43
+ /**
44
+ * Creates a new box selector instance.
45
+ *
46
+ * @param view - The view that will handle this box selection operation
47
+ */
26
48
  function AcEdBoxSelector(view) {
27
49
  var _this = _super.call(this, view) || this;
50
+ /** Whether the mouse button is currently pressed */
28
51
  _this.mouseDown = false;
52
+ /** Whether the mouse has moved since being pressed */
29
53
  _this.mouseMove = false;
54
+ /** X coordinate where mouse was initially pressed (-1 indicates invalid) */
30
55
  _this.mouseDownPositionX = -1; // -1 means invalid point
56
+ /** Y coordinate where mouse was initially pressed (-1 indicates invalid) */
31
57
  _this.mouseDownPositionY = -1;
58
+ /**
59
+ * Handles mouse down events to start box selection.
60
+ * Records the initial mouse position for the selection area.
61
+ *
62
+ * @param e - The mouse event
63
+ */
32
64
  _this.mousedown = function (e) {
33
65
  if (e.button === 0) {
34
66
  _this.mouseDown = true;
@@ -37,6 +69,12 @@ var AcEdBoxSelector = /** @class */ (function (_super) {
37
69
  _this.mouseDownPositionY = point.y;
38
70
  }
39
71
  };
72
+ /**
73
+ * Handles mouse move events to update the selection box.
74
+ * Creates and updates the visual selection rectangle as the user drags.
75
+ *
76
+ * @param e - The mouse event
77
+ */
40
78
  _this.mousemove = function (e) {
41
79
  if (!_this.mouseDown) {
42
80
  return;
@@ -53,6 +91,12 @@ var AcEdBoxSelector = /** @class */ (function (_super) {
53
91
  }
54
92
  }
55
93
  };
94
+ /**
95
+ * Handles mouse up events to complete box selection.
96
+ * Calculates the final selection area and resolves the promise with the result.
97
+ *
98
+ * @param e - The mouse event
99
+ */
56
100
  _this.mouseup = function (e) {
57
101
  if (_this.mouseDown && _this.mouseMove) {
58
102
  var point = new AcGePoint2d(e.x, e.y);
@@ -71,6 +115,11 @@ var AcEdBoxSelector = /** @class */ (function (_super) {
71
115
  _this.color = BORDER_COLOR;
72
116
  return _this;
73
117
  }
118
+ /**
119
+ * Activates the box selector.
120
+ * Sets up mouse event listeners for tracking selection area.
121
+ * Overrides the base class to add mouse event handling.
122
+ */
74
123
  AcEdBoxSelector.prototype.activate = function () {
75
124
  _super.prototype.activate.call(this);
76
125
  this.active = true;
@@ -78,6 +127,11 @@ var AcEdBoxSelector = /** @class */ (function (_super) {
78
127
  this.container.addEventListener('pointermove', this.mousemove);
79
128
  this.container.addEventListener('pointerup', this.mouseup);
80
129
  };
130
+ /**
131
+ * Deactivates the box selector.
132
+ * Removes mouse event listeners and hides the selection box.
133
+ * Overrides the base class to clean up mouse event handling.
134
+ */
81
135
  AcEdBoxSelector.prototype.deactivate = function () {
82
136
  _super.prototype.deactivate.call(this);
83
137
  this.container.removeEventListener('pointerdown', this.mousedown);
@@ -85,12 +139,25 @@ var AcEdBoxSelector = /** @class */ (function (_super) {
85
139
  this.container.removeEventListener('pointerup', this.mouseup);
86
140
  this.setRectDomVisible(false);
87
141
  };
142
+ /**
143
+ * Rejects the box selection operation.
144
+ * Cleans up the selection box DOM element.
145
+ *
146
+ * @param reason - The reason for rejecting the selection operation
147
+ */
88
148
  AcEdBoxSelector.prototype.reject = function (reason) {
89
149
  var _a;
90
150
  _super.prototype.reject.call(this, reason);
91
151
  (_a = this.boxDom) === null || _a === void 0 ? void 0 : _a.remove();
92
152
  this.boxDom = undefined;
93
153
  };
154
+ /**
155
+ * Draws the selection rectangle on screen.
156
+ * Creates or updates the DOM element representing the selection box.
157
+ *
158
+ * @param leftTop - The top-left corner of the selection rectangle
159
+ * @param rightBottom - The bottom-right corner of the selection rectangle
160
+ */
94
161
  AcEdBoxSelector.prototype.drawRect = function (leftTop, rightBottom) {
95
162
  if (!this.boxDom) {
96
163
  var color = new AcCmColor();
@@ -121,11 +188,24 @@ var AcEdBoxSelector = /** @class */ (function (_super) {
121
188
  this.boxDom.style.width = "".concat(width, "px");
122
189
  this.boxDom.style.height = "".concat(height, "px");
123
190
  };
191
+ /**
192
+ * Sets the visibility of the selection rectangle DOM element.
193
+ *
194
+ * @param visible - Whether the selection rectangle should be visible
195
+ */
124
196
  AcEdBoxSelector.prototype.setRectDomVisible = function (visible) {
125
197
  if (this.boxDom) {
126
198
  this.boxDom.style.display = visible ? 'inline-block' : 'none';
127
199
  }
128
200
  };
201
+ /**
202
+ * Converts a screen coordinate box to world coordinate system.
203
+ * Transforms the selection box from screen coordinates to world coordinates
204
+ * for use in entity selection operations.
205
+ *
206
+ * @param box - The selection box in screen coordinates
207
+ * @returns The selection box in world coordinates
208
+ */
129
209
  AcEdBoxSelector.prototype.toWcs = function (box) {
130
210
  var wcsBox = new AcGeBox2d();
131
211
  var p1 = new AcGePoint2d(box.min.x, box.min.y);
@@ -1 +1 @@
1
- {"version":3,"file":"AcEdBoxSelector.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdBoxSelector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGzE,OAAO,EAAE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AC,KAAK,CAAC,MAAM,GAAG,UAAG,MAAM,OAAI,CAAA;IAC1C,CAAC;IAED;;;;OAIG;IACK,2CAAiB,GAAzB,UAA0B,OAAgB;QACxC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAA;QAC/D,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACK,+BAAK,GAAb,UAAc,GAAc;QAC1B,IAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAA;QAC9B,IAAM,EAAE,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QAChD,IAAM,EAAE,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QAChD,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;QAC5C,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;QAC5C,OAAO,MAAM,CAAA;IACf,CAAC;IACH,sBAAC;AAAD,CAAC,AA9MD,CAAqC,aAAa,GA8MjD"}
@@ -1,36 +1,123 @@
1
+ /**
2
+ * Enumeration of cursor types available in the CAD editor.
3
+ *
4
+ * These cursor types provide visual feedback to users about the current
5
+ * operation mode or expected input type. Each cursor has a specific
6
+ * appearance and is used in different contexts.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // Set crosshair cursor for precise point input
11
+ * editor.setCursor(AcEdCorsorType.Crosshair);
12
+ *
13
+ * // Set grab cursor for pan operations
14
+ * editor.setCursor(AcEdCorsorType.Grab);
15
+ *
16
+ * // Restore default cursor
17
+ * editor.setCursor(AcEdCorsorType.NoSpecialCursor);
18
+ * ```
19
+ */
1
20
  export declare enum AcEdCorsorType {
21
+ /** No special cursor - uses browser default */
2
22
  NoSpecialCursor = -1,
23
+ /** Crosshair cursor for precise point selection */
3
24
  Crosshair = 0,
25
+ /** Rectangle cursor for area selection */
4
26
  RectCursor = 1,
27
+ /** Rubber band cursor for dynamic drawing */
5
28
  RubberBand = 2,
29
+ /** Non-rotated cursor */
6
30
  NotRotated = 3,
31
+ /** Target box cursor for object snapping */
7
32
  TargetBox = 4,
33
+ /** Rotated crosshair cursor */
8
34
  RotatedCrosshair = 5,
35
+ /** Crosshair that doesn't rotate with view */
9
36
  CrosshairNoRotate = 6,
37
+ /** Invisible cursor for hiding cursor */
10
38
  Invisible = 7,
39
+ /** Entity selection cursor */
11
40
  EntitySelect = 8,
41
+ /** Parallelogram cursor for skewed operations */
12
42
  Parallelogram = 9,
43
+ /** Entity select cursor without perspective */
13
44
  EntitySelectNoPersp = 10,
45
+ /** Cursor for pick-first or grips operations */
14
46
  PkfirstOrGrips = 11,
47
+ /** Dashed crosshair cursor */
15
48
  CrosshairDashed = 12,
49
+ /** Grab/hand cursor for panning */
16
50
  Grab = 13
17
51
  }
18
52
  /**
19
- * The class to create and manage cursor
20
- * @internal
53
+ * Manages cursor appearance and behavior for the CAD editor.
54
+ *
55
+ * This class creates and applies custom cursors to HTML elements,
56
+ * providing visual feedback for different CAD operations. It supports
57
+ * both built-in browser cursors and custom SVG-based cursors.
58
+ *
59
+ * The cursor manager maintains a cache of cursor definitions to avoid
60
+ * recreating them repeatedly, improving performance.
61
+ *
62
+ * @internal This class is for internal use by the editor system
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * const cursorManager = new AcEdCursorManager();
67
+ * const canvas = document.getElementById('canvas') as HTMLCanvasElement;
68
+ *
69
+ * // Set crosshair cursor
70
+ * cursorManager.setCursor(AcEdCorsorType.Crosshair, canvas);
71
+ *
72
+ * // Set grab cursor for panning
73
+ * cursorManager.setCursor(AcEdCorsorType.Grab, canvas);
74
+ * ```
21
75
  */
22
76
  export declare class AcEdCursorManager {
77
+ /** Cache of cursor definitions mapped by cursor type */
23
78
  private _cursorMap;
79
+ /**
80
+ * Creates a new cursor manager instance.
81
+ *
82
+ * Initializes the cursor cache and creates default cursor definitions.
83
+ */
24
84
  constructor();
85
+ /**
86
+ * Sets the cursor for the specified HTML element.
87
+ *
88
+ * Applies the appropriate cursor style based on the cursor type.
89
+ * For built-in cursor types, uses CSS cursor values. For custom
90
+ * cursor types, uses cached SVG-based cursor definitions.
91
+ *
92
+ * @param cursorType - The type of cursor to set
93
+ * @param element - The HTML element to apply the cursor to
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * const canvas = document.getElementById('canvas') as HTMLCanvasElement;
98
+ * cursorManager.setCursor(AcEdCorsorType.Crosshair, canvas);
99
+ * ```
100
+ */
25
101
  setCursor(cursorType: AcEdCorsorType, element: HTMLElement): void;
26
102
  /**
27
- * Encode SVG string to one cursor defined using url() in CSS
28
- * @param svgString Input svg string
29
- * @param xOffset Input x offset for cursor hotspot
30
- * @param yOffset Input y offset for cursor hotspot
31
- * @returns
103
+ * Encodes an SVG string into a CSS cursor URL.
104
+ *
105
+ * This method converts SVG markup into a data URI that can be used
106
+ * as a CSS cursor value, with specified hotspot coordinates.
107
+ *
108
+ * @param svgString - The SVG markup as a string
109
+ * @param xOffset - X coordinate of the cursor hotspot
110
+ * @param yOffset - Y coordinate of the cursor hotspot
111
+ * @returns CSS cursor string in url() format
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * const svgCursor = '<svg width="20" height="20">...</svg>';
116
+ * const cursorUrl = cursorManager.encodeSvgToCursor(svgCursor, 10, 10);
117
+ * element.style.cursor = cursorUrl;
118
+ * ```
32
119
  */
33
- private encodeSvg;
120
+ encodeSvgToCursor(svgString: string, xOffset: number, yOffset: number): string;
34
121
  /**
35
122
  * Create one svg icon with one rectangle plus two cross lines
36
123
  * @param rectSize Input the width and height of rectangle
@@ -1 +1 @@
1
- {"version":3,"file":"AcEdCursorManager.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdCursorManager.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,eAAe,KAAK;IACpB,SAAS,IAAI;IACb,UAAU,IAAA;IACV,UAAU,IAAA;IACV,UAAU,IAAA;IACV,SAAS,IAAA;IACT,gBAAgB,IAAA;IAChB,iBAAiB,IAAA;IACjB,SAAS,IAAA;IACT,YAAY,IAAA;IACZ,aAAa,IAAA;IACb,mBAAmB,KAAA;IACnB,cAAc,KAAA;IACd,eAAe,KAAA;IACf,IAAI,KAAA;CACL;AAED;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,UAAU,CAA6B;;IAS/C,SAAS,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW;IAa1D;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IAQjB;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;CAkB5B"}
1
+ {"version":3,"file":"AcEdCursorManager.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdCursorManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,oBAAY,cAAc;IACxB,+CAA+C;IAC/C,eAAe,KAAK;IACpB,mDAAmD;IACnD,SAAS,IAAI;IACb,0CAA0C;IAC1C,UAAU,IAAA;IACV,6CAA6C;IAC7C,UAAU,IAAA;IACV,yBAAyB;IACzB,UAAU,IAAA;IACV,4CAA4C;IAC5C,SAAS,IAAA;IACT,+BAA+B;IAC/B,gBAAgB,IAAA;IAChB,8CAA8C;IAC9C,iBAAiB,IAAA;IACjB,yCAAyC;IACzC,SAAS,IAAA;IACT,8BAA8B;IAC9B,YAAY,IAAA;IACZ,iDAAiD;IACjD,aAAa,IAAA;IACb,+CAA+C;IAC/C,mBAAmB,KAAA;IACnB,gDAAgD;IAChD,cAAc,KAAA;IACd,8BAA8B;IAC9B,eAAe,KAAA;IACf,mCAAmC;IACnC,IAAI,KAAA;CACL;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,iBAAiB;IAC5B,wDAAwD;IACxD,OAAO,CAAC,UAAU,CAA6B;IAE/C;;;;OAIG;;IASH;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW;IAa1D;;;;;;;;;;;;;;;;;OAiBG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAIrE;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;CAkB5B"}
@@ -1,30 +1,105 @@
1
+ /**
2
+ * Enumeration of cursor types available in the CAD editor.
3
+ *
4
+ * These cursor types provide visual feedback to users about the current
5
+ * operation mode or expected input type. Each cursor has a specific
6
+ * appearance and is used in different contexts.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // Set crosshair cursor for precise point input
11
+ * editor.setCursor(AcEdCorsorType.Crosshair);
12
+ *
13
+ * // Set grab cursor for pan operations
14
+ * editor.setCursor(AcEdCorsorType.Grab);
15
+ *
16
+ * // Restore default cursor
17
+ * editor.setCursor(AcEdCorsorType.NoSpecialCursor);
18
+ * ```
19
+ */
1
20
  export var AcEdCorsorType;
2
21
  (function (AcEdCorsorType) {
22
+ /** No special cursor - uses browser default */
3
23
  AcEdCorsorType[AcEdCorsorType["NoSpecialCursor"] = -1] = "NoSpecialCursor";
24
+ /** Crosshair cursor for precise point selection */
4
25
  AcEdCorsorType[AcEdCorsorType["Crosshair"] = 0] = "Crosshair";
26
+ /** Rectangle cursor for area selection */
5
27
  AcEdCorsorType[AcEdCorsorType["RectCursor"] = 1] = "RectCursor";
28
+ /** Rubber band cursor for dynamic drawing */
6
29
  AcEdCorsorType[AcEdCorsorType["RubberBand"] = 2] = "RubberBand";
30
+ /** Non-rotated cursor */
7
31
  AcEdCorsorType[AcEdCorsorType["NotRotated"] = 3] = "NotRotated";
32
+ /** Target box cursor for object snapping */
8
33
  AcEdCorsorType[AcEdCorsorType["TargetBox"] = 4] = "TargetBox";
34
+ /** Rotated crosshair cursor */
9
35
  AcEdCorsorType[AcEdCorsorType["RotatedCrosshair"] = 5] = "RotatedCrosshair";
36
+ /** Crosshair that doesn't rotate with view */
10
37
  AcEdCorsorType[AcEdCorsorType["CrosshairNoRotate"] = 6] = "CrosshairNoRotate";
38
+ /** Invisible cursor for hiding cursor */
11
39
  AcEdCorsorType[AcEdCorsorType["Invisible"] = 7] = "Invisible";
40
+ /** Entity selection cursor */
12
41
  AcEdCorsorType[AcEdCorsorType["EntitySelect"] = 8] = "EntitySelect";
42
+ /** Parallelogram cursor for skewed operations */
13
43
  AcEdCorsorType[AcEdCorsorType["Parallelogram"] = 9] = "Parallelogram";
44
+ /** Entity select cursor without perspective */
14
45
  AcEdCorsorType[AcEdCorsorType["EntitySelectNoPersp"] = 10] = "EntitySelectNoPersp";
46
+ /** Cursor for pick-first or grips operations */
15
47
  AcEdCorsorType[AcEdCorsorType["PkfirstOrGrips"] = 11] = "PkfirstOrGrips";
48
+ /** Dashed crosshair cursor */
16
49
  AcEdCorsorType[AcEdCorsorType["CrosshairDashed"] = 12] = "CrosshairDashed";
50
+ /** Grab/hand cursor for panning */
17
51
  AcEdCorsorType[AcEdCorsorType["Grab"] = 13] = "Grab";
18
52
  })(AcEdCorsorType || (AcEdCorsorType = {}));
19
53
  /**
20
- * The class to create and manage cursor
21
- * @internal
54
+ * Manages cursor appearance and behavior for the CAD editor.
55
+ *
56
+ * This class creates and applies custom cursors to HTML elements,
57
+ * providing visual feedback for different CAD operations. It supports
58
+ * both built-in browser cursors and custom SVG-based cursors.
59
+ *
60
+ * The cursor manager maintains a cache of cursor definitions to avoid
61
+ * recreating them repeatedly, improving performance.
62
+ *
63
+ * @internal This class is for internal use by the editor system
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * const cursorManager = new AcEdCursorManager();
68
+ * const canvas = document.getElementById('canvas') as HTMLCanvasElement;
69
+ *
70
+ * // Set crosshair cursor
71
+ * cursorManager.setCursor(AcEdCorsorType.Crosshair, canvas);
72
+ *
73
+ * // Set grab cursor for panning
74
+ * cursorManager.setCursor(AcEdCorsorType.Grab, canvas);
75
+ * ```
22
76
  */
23
77
  var AcEdCursorManager = /** @class */ (function () {
78
+ /**
79
+ * Creates a new cursor manager instance.
80
+ *
81
+ * Initializes the cursor cache and creates default cursor definitions.
82
+ */
24
83
  function AcEdCursorManager() {
25
84
  this._cursorMap = new Map();
26
85
  this._cursorMap.set(AcEdCorsorType.Crosshair, this.createRectCrossIcon(10, 10));
27
86
  }
87
+ /**
88
+ * Sets the cursor for the specified HTML element.
89
+ *
90
+ * Applies the appropriate cursor style based on the cursor type.
91
+ * For built-in cursor types, uses CSS cursor values. For custom
92
+ * cursor types, uses cached SVG-based cursor definitions.
93
+ *
94
+ * @param cursorType - The type of cursor to set
95
+ * @param element - The HTML element to apply the cursor to
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * const canvas = document.getElementById('canvas') as HTMLCanvasElement;
100
+ * cursorManager.setCursor(AcEdCorsorType.Crosshair, canvas);
101
+ * ```
102
+ */
28
103
  AcEdCursorManager.prototype.setCursor = function (cursorType, element) {
29
104
  if (cursorType <= AcEdCorsorType.NoSpecialCursor) {
30
105
  element.style.cursor = 'default';
@@ -40,15 +115,24 @@ var AcEdCursorManager = /** @class */ (function () {
40
115
  }
41
116
  };
42
117
  /**
43
- * Encode SVG string to one cursor defined using url() in CSS
44
- * @param svgString Input svg string
45
- * @param xOffset Input x offset for cursor hotspot
46
- * @param yOffset Input y offset for cursor hotspot
47
- * @returns
118
+ * Encodes an SVG string into a CSS cursor URL.
119
+ *
120
+ * This method converts SVG markup into a data URI that can be used
121
+ * as a CSS cursor value, with specified hotspot coordinates.
122
+ *
123
+ * @param svgString - The SVG markup as a string
124
+ * @param xOffset - X coordinate of the cursor hotspot
125
+ * @param yOffset - Y coordinate of the cursor hotspot
126
+ * @returns CSS cursor string in url() format
127
+ *
128
+ * @example
129
+ * ```typescript
130
+ * const svgCursor = '<svg width="20" height="20">...</svg>';
131
+ * const cursorUrl = cursorManager.encodeSvgToCursor(svgCursor, 10, 10);
132
+ * element.style.cursor = cursorUrl;
133
+ * ```
48
134
  */
49
- AcEdCursorManager.prototype.encodeSvg = function (svgString, xOffset, yOffset) {
50
- if (xOffset === void 0) { xOffset = 0; }
51
- if (yOffset === void 0) { yOffset = 0; }
135
+ AcEdCursorManager.prototype.encodeSvgToCursor = function (svgString, xOffset, yOffset) {
52
136
  return "url('data:image/svg+xml;base64,".concat(btoa(svgString), "') ").concat(xOffset, " ").concat(yOffset, ", auto");
53
137
  };
54
138
  /**
@@ -63,7 +147,7 @@ var AcEdCursorManager = /** @class */ (function () {
63
147
  var halfSize = rectSize / 2;
64
148
  var svgSize = rectSize + 2 * lineLength;
65
149
  var svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(svgSize, "\" height=\"").concat(svgSize, "\" viewBox=\"0 0 ").concat(svgSize, " ").concat(svgSize, "\">\n <rect x=\"").concat(lineLength, "\" y=\"").concat(lineLength, "\" width=\"").concat(rectSize, "\" height=\"").concat(rectSize, "\" fill=\"none\" stroke=\"").concat(lineColor, "\" />\n <line x1=\"").concat(halfSize + lineLength, "\" y1=\"0\" x2=\"").concat(halfSize + lineLength, "\" y2=\"").concat(lineLength, "\" stroke=\"").concat(lineColor, "\" />\n <line x1=\"").concat(rectSize + lineLength, "\" y1=\"").concat(halfSize + lineLength, "\" x2=\"").concat(rectSize + 2 * lineLength, "\" y2=\"").concat(halfSize + lineLength, "\" stroke=\"").concat(lineColor, "\" />\n <line x1=\"").concat(halfSize + lineLength, "\" y1=\"").concat(rectSize + lineLength, "\" x2=\"").concat(halfSize + lineLength, "\" y2=\"").concat(rectSize + 2 * lineLength, "\" stroke=\"").concat(lineColor, "\" />\n <line x1=\"0\" y1=\"").concat(halfSize + lineLength, "\" x2=\"").concat(lineLength, "\" y2=\"").concat(halfSize + lineLength, "\" stroke=\"").concat(lineColor, "\" />\n </svg>\n ");
66
- return this.encodeSvg(svg, halfSize + lineLength, halfSize + lineLength);
150
+ return this.encodeSvgToCursor(svg, halfSize + lineLength, halfSize + lineLength);
67
151
  };
68
152
  return AcEdCursorManager;
69
153
  }());
@@ -1 +1 @@
1
- {"version":3,"file":"AcEdCursorManager.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdCursorManager.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAgBX;AAhBD,WAAY,cAAc;IACxB,0EAAoB,CAAA;IACpB,6DAAa,CAAA;IACb,+DAAU,CAAA;IACV,+DAAU,CAAA;IACV,+DAAU,CAAA;IACV,6DAAS,CAAA;IACT,2EAAgB,CAAA;IAChB,6EAAiB,CAAA;IACjB,6DAAS,CAAA;IACT,mEAAY,CAAA;IACZ,qEAAa,CAAA;IACb,kFAAmB,CAAA;IACnB,wEAAc,CAAA;IACd,0EAAe,CAAA;IACf,oDAAI,CAAA;AACN,CAAC,EAhBW,cAAc,KAAd,cAAc,QAgBzB;AAED;;;GAGG;AACH;IAEE;QACE,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAA;QAC3B,IAAI,CAAC,UAAU,CAAC,GAAG,CACjB,cAAc,CAAC,SAAS,EACxB,IAAI,CAAC,mBAAmB,CAAC,EAAE,EAAE,EAAE,CAAC,CACjC,CAAA;IACH,CAAC;IAED,qCAAS,GAAT,UAAU,UAA0B,EAAE,OAAoB;QACxD,IAAI,UAAU,IAAI,cAAc,CAAC,eAAe,EAAE,CAAC;YACjD,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAA;QAClC,CAAC;aAAM,IAAI,UAAU,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC;YAC7C,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;QAC/B,CAAC;aAAM,CAAC;YACN,IAAM,MAAM,GAAG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CAAC,GAAG,EAAE,QAAQ,GAAG,UAAU,EAAE,QAAQ,GAAG,UAAU,CAAC,CAAA;IAC1E,CAAC;IACH,wBAAC;AAAD,CAAC,AA/DD,IA+DC"}
1
+ {"version":3,"file":"AcEdCursorManager.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdCursorManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAN,IAAY,cA+BX;AA/BD,WAAY,cAAc;IACxB,+CAA+C;IAC/C,0EAAoB,CAAA;IACpB,mDAAmD;IACnD,6DAAa,CAAA;IACb,0CAA0C;IAC1C,+DAAU,CAAA;IACV,6CAA6C;IAC7C,+DAAU,CAAA;IACV,yBAAyB;IACzB,+DAAU,CAAA;IACV,4CAA4C;IAC5C,6DAAS,CAAA;IACT,+BAA+B;IAC/B,2EAAgB,CAAA;IAChB,8CAA8C;IAC9C,6EAAiB,CAAA;IACjB,yCAAyC;IACzC,6DAAS,CAAA;IACT,8BAA8B;IAC9B,mEAAY,CAAA;IACZ,iDAAiD;IACjD,qEAAa,CAAA;IACb,+CAA+C;IAC/C,kFAAmB,CAAA;IACnB,gDAAgD;IAChD,wEAAc,CAAA;IACd,8BAA8B;IAC9B,0EAAe,CAAA;IACf,mCAAmC;IACnC,oDAAI,CAAA;AACN,CAAC,EA/BW,cAAc,KAAd,cAAc,QA+BzB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IAIE;;;;OAIG;IACH;QACE,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAA;QAC3B,IAAI,CAAC,UAAU,CAAC,GAAG,CACjB,cAAc,CAAC,SAAS,EACxB,IAAI,CAAC,mBAAmB,CAAC,EAAE,EAAE,EAAE,CAAC,CACjC,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,qCAAS,GAAT,UAAU,UAA0B,EAAE,OAAoB;QACxD,IAAI,UAAU,IAAI,cAAc,CAAC,eAAe,EAAE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AAQ,GAAG,UAAU,qBAAS,QAAQ,GAAG,CAAC,GAAG,UAAU,yBAAa,SAAS,gDAClI,QAAQ,GAAG,UAAU,qBAAS,UAAU,qBAAS,QAAQ,GAAG,UAAU,yBAAa,SAAS,8BAElH,CAAA;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,QAAQ,GAAG,UAAU,EAAE,QAAQ,GAAG,UAAU,CAAC,CAAA;IAClF,CAAC;IACH,wBAAC;AAAD,CAAC,AA7FD,IA6FC"}
@@ -2,13 +2,50 @@ import { AcGePoint2d } from '@mlightcad/data-model';
2
2
  import { AcEdBaseView } from '../view/AcEdBaseView';
3
3
  import { AcEdBaseInput } from './AcEdBaseInput';
4
4
  /**
5
- * Class used to input one point
5
+ * Class used to input one point from user interaction.
6
+ *
7
+ * This class provides functionality for capturing a single point input from the user
8
+ * by handling mouse click events. When the user clicks on the canvas, the click
9
+ * coordinates are converted from screen coordinates to world coordinates and
10
+ * returned as the result.
11
+ *
12
+ * The input operation can be canceled by pressing the Escape key (handled by the base class).
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const pointInput = new AcEdInputPoint(view);
17
+ * const point = await pointInput.start();
18
+ * console.log(`User clicked at: ${point.x}, ${point.y}`);
19
+ * ```
20
+ *
6
21
  * @internal
7
22
  */
8
23
  export declare class AcEdInputPoint extends AcEdBaseInput<AcGePoint2d> {
24
+ /**
25
+ * Creates a new point input instance.
26
+ *
27
+ * @param view - The view that will handle this point input operation
28
+ */
9
29
  constructor(view: AcEdBaseView);
30
+ /**
31
+ * Activates the point input operation.
32
+ * Sets up the click event listener to capture user point selection.
33
+ * Overrides the base class to add click event handling.
34
+ */
10
35
  activate(): void;
36
+ /**
37
+ * Deactivates the point input operation.
38
+ * Removes the click event listener.
39
+ * Overrides the base class to clean up click event handling.
40
+ */
11
41
  deactivate(): void;
42
+ /**
43
+ * Handles mouse click events to capture the selected point.
44
+ * Converts the click coordinates from screen space to world coordinates
45
+ * and resolves the input operation with the resulting point.
46
+ *
47
+ * @param event - The mouse click event containing the screen coordinates
48
+ */
12
49
  private onClick;
13
50
  }
14
51
  //# sourceMappingURL=AcEdInputPoint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AcEdInputPoint.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdInputPoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;GAGG;AACH,qBAAa,cAAe,SAAQ,aAAa,CAAC,WAAW,CAAC;gBAChD,IAAI,EAAE,YAAY;IAI9B,QAAQ;IAKR,UAAU;IAKV,OAAO,CAAC,OAAO,CAEd;CACF"}
1
+ {"version":3,"file":"AcEdInputPoint.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdInputPoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,cAAe,SAAQ,aAAa,CAAC,WAAW,CAAC;IAC5D;;;;OAIG;gBACS,IAAI,EAAE,YAAY;IAI9B;;;;OAIG;IACH,QAAQ;IAKR;;;;OAIG;IACH,UAAU;IAKV;;;;;;OAMG;IACH,OAAO,CAAC,OAAO,CAEd;CACF"}
@@ -15,22 +15,59 @@ var __extends = (this && this.__extends) || (function () {
15
15
  })();
16
16
  import { AcEdBaseInput } from './AcEdBaseInput';
17
17
  /**
18
- * Class used to input one point
18
+ * Class used to input one point from user interaction.
19
+ *
20
+ * This class provides functionality for capturing a single point input from the user
21
+ * by handling mouse click events. When the user clicks on the canvas, the click
22
+ * coordinates are converted from screen coordinates to world coordinates and
23
+ * returned as the result.
24
+ *
25
+ * The input operation can be canceled by pressing the Escape key (handled by the base class).
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const pointInput = new AcEdInputPoint(view);
30
+ * const point = await pointInput.start();
31
+ * console.log(`User clicked at: ${point.x}, ${point.y}`);
32
+ * ```
33
+ *
19
34
  * @internal
20
35
  */
21
36
  var AcEdInputPoint = /** @class */ (function (_super) {
22
37
  __extends(AcEdInputPoint, _super);
38
+ /**
39
+ * Creates a new point input instance.
40
+ *
41
+ * @param view - The view that will handle this point input operation
42
+ */
23
43
  function AcEdInputPoint(view) {
24
44
  var _this = _super.call(this, view) || this;
45
+ /**
46
+ * Handles mouse click events to capture the selected point.
47
+ * Converts the click coordinates from screen space to world coordinates
48
+ * and resolves the input operation with the resulting point.
49
+ *
50
+ * @param event - The mouse click event containing the screen coordinates
51
+ */
25
52
  _this.onClick = function (event) {
26
53
  _this.resolve(_this.view.cwcs2Wcs({ x: event.clientX, y: event.clientY }));
27
54
  };
28
55
  return _this;
29
56
  }
57
+ /**
58
+ * Activates the point input operation.
59
+ * Sets up the click event listener to capture user point selection.
60
+ * Overrides the base class to add click event handling.
61
+ */
30
62
  AcEdInputPoint.prototype.activate = function () {
31
63
  _super.prototype.activate.call(this);
32
64
  this.view.canvas.addEventListener('click', this.onClick);
33
65
  };
66
+ /**
67
+ * Deactivates the point input operation.
68
+ * Removes the click event listener.
69
+ * Overrides the base class to clean up click event handling.
70
+ */
34
71
  AcEdInputPoint.prototype.deactivate = function () {
35
72
  _super.prototype.deactivate.call(this);
36
73
  this.view.canvas.removeEventListener('click', this.onClick);
@@ -1 +1 @@
1
- {"version":3,"file":"AcEdInputPoint.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdInputPoint.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;GAGG;AACH;IAAoC,kCAA0B;IAC5D,wBAAY,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