@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.
- package/dist/index.js +33647 -0
- package/dist/index.umd.cjs +295 -0
- package/dist/libredwg-parser-worker.js +15458 -0
- package/dist/mtext-renderer-worker.js +29930 -0
- package/lib/app/AcApContext.d.ts +57 -0
- package/lib/app/AcApContext.d.ts.map +1 -0
- package/lib/app/AcApContext.js +106 -0
- package/lib/app/AcApContext.js.map +1 -0
- package/lib/app/AcApDocManager.d.ts +291 -0
- package/lib/app/AcApDocManager.d.ts.map +1 -0
- package/lib/app/AcApDocManager.js +498 -0
- package/lib/app/AcApDocManager.js.map +1 -0
- package/lib/app/AcApDocument.d.ts +101 -0
- package/lib/app/AcApDocument.d.ts.map +1 -0
- package/lib/app/AcApDocument.js +237 -0
- package/lib/app/AcApDocument.js.map +1 -0
- package/lib/app/AcApFontLoader.d.ts +54 -0
- package/lib/app/AcApFontLoader.d.ts.map +1 -0
- package/lib/app/AcApFontLoader.js +151 -0
- package/lib/app/AcApFontLoader.js.map +1 -0
- package/lib/app/AcApGlobalFunc.d.ts +26 -0
- package/lib/app/AcApGlobalFunc.d.ts.map +1 -0
- package/lib/app/AcApGlobalFunc.js +66 -0
- package/lib/app/AcApGlobalFunc.js.map +1 -0
- package/lib/app/AcApSettingManager.d.ts +232 -0
- package/lib/app/AcApSettingManager.d.ts.map +1 -0
- package/lib/app/AcApSettingManager.js +283 -0
- package/lib/app/AcApSettingManager.js.map +1 -0
- package/lib/app/index.d.ts +6 -0
- package/lib/app/index.d.ts.map +1 -0
- package/lib/app/index.js +6 -0
- package/lib/app/index.js.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts +32 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.js +56 -0
- package/lib/command/AcApConvertToSvgCmd.js.map +1 -0
- package/lib/command/AcApOpenCmd.d.ts +37 -0
- package/lib/command/AcApOpenCmd.d.ts.map +1 -0
- package/lib/command/AcApOpenCmd.js +60 -0
- package/lib/command/AcApOpenCmd.js.map +1 -0
- package/lib/command/AcApPanCmd.d.ts +31 -0
- package/lib/command/AcApPanCmd.d.ts.map +1 -0
- package/lib/command/AcApPanCmd.js +55 -0
- package/lib/command/AcApPanCmd.js.map +1 -0
- package/lib/command/AcApQNewCmd.d.ts +32 -0
- package/lib/command/AcApQNewCmd.d.ts.map +1 -0
- package/lib/command/AcApQNewCmd.js +56 -0
- package/lib/command/AcApQNewCmd.js.map +1 -0
- package/lib/command/AcApRegenCmd.d.ts +21 -0
- package/lib/command/AcApRegenCmd.d.ts.map +1 -0
- package/lib/command/AcApRegenCmd.js +45 -0
- package/lib/command/AcApRegenCmd.js.map +1 -0
- package/lib/command/AcApSelectCmd.d.ts +32 -0
- package/lib/command/AcApSelectCmd.d.ts.map +1 -0
- package/lib/command/AcApSelectCmd.js +56 -0
- package/lib/command/AcApSelectCmd.js.map +1 -0
- package/lib/command/AcApSvgConvertor.d.ts +53 -0
- package/lib/command/AcApSvgConvertor.d.ts.map +1 -0
- package/lib/command/AcApSvgConvertor.js +103 -0
- package/lib/command/AcApSvgConvertor.js.map +1 -0
- package/lib/command/AcApZoomCmd.d.ts +35 -0
- package/lib/command/AcApZoomCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomCmd.js +57 -0
- package/lib/command/AcApZoomCmd.js.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts +68 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.js +158 -0
- package/lib/command/AcApZoomToBoxCmd.js.map +1 -0
- package/lib/command/index.d.ts +11 -0
- package/lib/command/index.d.ts.map +1 -0
- package/lib/command/index.js +11 -0
- package/lib/command/index.js.map +1 -0
- package/lib/editor/command/AcEdCommand.d.ts +151 -0
- package/lib/editor/command/AcEdCommand.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommand.js +164 -0
- package/lib/editor/command/AcEdCommand.js.map +1 -0
- package/lib/editor/command/AcEdCommandIterator.d.ts +36 -0
- package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommandIterator.js +65 -0
- package/lib/editor/command/AcEdCommandIterator.js.map +1 -0
- package/lib/editor/command/AcEdCommandStack.d.ts +120 -0
- package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommandStack.js +235 -0
- package/lib/editor/command/AcEdCommandStack.js.map +1 -0
- package/lib/editor/command/index.d.ts +3 -0
- package/lib/editor/command/index.d.ts.map +1 -0
- package/lib/editor/command/index.js +3 -0
- package/lib/editor/command/index.js.map +1 -0
- package/lib/editor/global/AcEdConditionWaiter.d.ts +51 -0
- package/lib/editor/global/AcEdConditionWaiter.d.ts.map +1 -0
- package/lib/editor/global/AcEdConditionWaiter.js +87 -0
- package/lib/editor/global/AcEdConditionWaiter.js.map +1 -0
- package/lib/editor/global/AcEdGlobalFunc.d.ts +8 -0
- package/lib/editor/global/AcEdGlobalFunc.d.ts.map +1 -0
- package/lib/editor/global/AcEdGlobalFunc.js +14 -0
- package/lib/editor/global/AcEdGlobalFunc.js.map +1 -0
- package/lib/editor/global/AcEdMessage.d.ts +5 -0
- package/lib/editor/global/AcEdMessage.d.ts.map +1 -0
- package/lib/editor/global/AcEdMessage.js +6 -0
- package/lib/editor/global/AcEdMessage.js.map +1 -0
- package/lib/editor/global/eventBus.d.ts +103 -0
- package/lib/editor/global/eventBus.d.ts.map +1 -0
- package/lib/editor/global/eventBus.js +41 -0
- package/lib/editor/global/eventBus.js.map +1 -0
- package/lib/editor/global/index.d.ts +4 -0
- package/lib/editor/global/index.d.ts.map +1 -0
- package/lib/editor/global/index.js +4 -0
- package/lib/editor/global/index.js.map +1 -0
- package/lib/editor/index.d.ts +5 -0
- package/lib/editor/index.d.ts.map +1 -0
- package/lib/editor/index.js +5 -0
- package/lib/editor/index.js.map +1 -0
- package/lib/editor/input/AcEdBaseInput.d.ts +89 -0
- package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -0
- package/lib/editor/input/AcEdBaseInput.js +166 -0
- package/lib/editor/input/AcEdBaseInput.js.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts +108 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.js +220 -0
- package/lib/editor/input/AcEdBoxSelector.js.map +1 -0
- package/lib/editor/input/AcEdCursorManager.d.ts +130 -0
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -0
- package/lib/editor/input/AcEdCursorManager.js +155 -0
- package/lib/editor/input/AcEdCursorManager.js.map +1 -0
- package/lib/editor/input/AcEdInputPoint.d.ts +51 -0
- package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -0
- package/lib/editor/input/AcEdInputPoint.js +78 -0
- package/lib/editor/input/AcEdInputPoint.js.map +1 -0
- package/lib/editor/input/AcEdJig.d.ts +180 -0
- package/lib/editor/input/AcEdJig.d.ts.map +1 -0
- package/lib/editor/input/AcEdJig.js +256 -0
- package/lib/editor/input/AcEdJig.js.map +1 -0
- package/lib/editor/input/AcEdJigLoop.d.ts +63 -0
- package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -0
- package/lib/editor/input/AcEdJigLoop.js +91 -0
- package/lib/editor/input/AcEdJigLoop.js.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts +146 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.js +179 -0
- package/lib/editor/input/AcEdSelectionSet.js.map +1 -0
- package/lib/editor/input/AcEditor.d.ts +111 -0
- package/lib/editor/input/AcEditor.d.ts.map +1 -0
- package/lib/editor/input/AcEditor.js +183 -0
- package/lib/editor/input/AcEditor.js.map +1 -0
- package/lib/editor/input/index.d.ts +5 -0
- package/lib/editor/input/index.d.ts.map +1 -0
- package/lib/editor/input/index.js +5 -0
- package/lib/editor/input/index.js.map +1 -0
- package/lib/editor/view/AcEdBaseView.d.ts +457 -0
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -0
- package/lib/editor/view/AcEdBaseView.js +349 -0
- package/lib/editor/view/AcEdBaseView.js.map +1 -0
- package/lib/editor/view/AcEdLayerInfo.d.ts +21 -0
- package/lib/editor/view/AcEdLayerInfo.d.ts.map +1 -0
- package/lib/editor/view/AcEdLayerInfo.js +2 -0
- package/lib/editor/view/AcEdLayerInfo.js.map +1 -0
- package/lib/editor/view/index.d.ts +3 -0
- package/lib/editor/view/index.d.ts.map +1 -0
- package/lib/editor/view/index.js +3 -0
- package/lib/editor/view/index.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/lib/util/AcTrGeometryUtil.d.ts +92 -0
- package/lib/util/AcTrGeometryUtil.d.ts.map +1 -0
- package/lib/util/AcTrGeometryUtil.js +109 -0
- package/lib/util/AcTrGeometryUtil.js.map +1 -0
- package/lib/util/index.d.ts +2 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +2 -0
- package/lib/util/index.js.map +1 -0
- package/lib/view/AcTrLayer.d.ts +132 -0
- package/lib/view/AcTrLayer.d.ts.map +1 -0
- package/lib/view/AcTrLayer.js +199 -0
- package/lib/view/AcTrLayer.js.map +1 -0
- package/lib/view/AcTrLayout.d.ts +218 -0
- package/lib/view/AcTrLayout.d.ts.map +1 -0
- package/lib/view/AcTrLayout.js +437 -0
- package/lib/view/AcTrLayout.js.map +1 -0
- package/lib/view/AcTrLayoutView.d.ts +115 -0
- package/lib/view/AcTrLayoutView.d.ts.map +1 -0
- package/lib/view/AcTrLayoutView.js +200 -0
- package/lib/view/AcTrLayoutView.js.map +1 -0
- package/lib/view/AcTrLayoutViewManager.d.ts +89 -0
- package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -0
- package/lib/view/AcTrLayoutViewManager.js +118 -0
- package/lib/view/AcTrLayoutViewManager.js.map +1 -0
- package/lib/view/AcTrScene.d.ts +162 -0
- package/lib/view/AcTrScene.d.ts.map +1 -0
- package/lib/view/AcTrScene.js +370 -0
- package/lib/view/AcTrScene.js.map +1 -0
- package/lib/view/AcTrView2d.d.ts +262 -0
- package/lib/view/AcTrView2d.d.ts.map +1 -0
- package/lib/view/AcTrView2d.js +772 -0
- package/lib/view/AcTrView2d.js.map +1 -0
- package/lib/view/index.d.ts +2 -0
- package/lib/view/index.d.ts.map +1 -0
- package/lib/view/index.js +2 -0
- package/lib/view/index.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import { AcCmColor, AcGeBox2d, AcGePoint2d } from '@mlightcad/data-model';
|
|
17
|
+
import { AcEdBaseInput } from './AcEdBaseInput';
|
|
18
|
+
/** Default border color for the selection box */
|
|
19
|
+
var BORDER_COLOR = 0xffffff;
|
|
20
|
+
/** Default border width for the selection box */
|
|
21
|
+
var BORDER_WIDTH = '1px';
|
|
22
|
+
/**
|
|
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
|
+
*
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
var AcEdBoxSelector = /** @class */ (function (_super) {
|
|
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
|
+
*/
|
|
48
|
+
function AcEdBoxSelector(view) {
|
|
49
|
+
var _this = _super.call(this, view) || this;
|
|
50
|
+
/** Whether the mouse button is currently pressed */
|
|
51
|
+
_this.mouseDown = false;
|
|
52
|
+
/** Whether the mouse has moved since being pressed */
|
|
53
|
+
_this.mouseMove = false;
|
|
54
|
+
/** X coordinate where mouse was initially pressed (-1 indicates invalid) */
|
|
55
|
+
_this.mouseDownPositionX = -1; // -1 means invalid point
|
|
56
|
+
/** Y coordinate where mouse was initially pressed (-1 indicates invalid) */
|
|
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
|
+
*/
|
|
64
|
+
_this.mousedown = function (e) {
|
|
65
|
+
if (e.button === 0) {
|
|
66
|
+
_this.mouseDown = true;
|
|
67
|
+
var point = new AcGePoint2d(e.x, e.y);
|
|
68
|
+
_this.mouseDownPositionX = point.x;
|
|
69
|
+
_this.mouseDownPositionY = point.y;
|
|
70
|
+
}
|
|
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
|
+
*/
|
|
78
|
+
_this.mousemove = function (e) {
|
|
79
|
+
if (!_this.mouseDown) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
var point = new AcGePoint2d(e.x, e.y);
|
|
83
|
+
if (_this.mouseDownPositionX >= 0 && _this.mouseDownPositionY >= 0) {
|
|
84
|
+
var TOLERANCE = 5;
|
|
85
|
+
if (Math.abs(point.x - _this.mouseDownPositionX) >= TOLERANCE ||
|
|
86
|
+
Math.abs(point.y - _this.mouseDownPositionY) >= TOLERANCE) {
|
|
87
|
+
_this.mouseMove = true;
|
|
88
|
+
var leftTop = new AcGePoint2d(Math.min(_this.mouseDownPositionX, point.x), Math.min(_this.mouseDownPositionY, point.y));
|
|
89
|
+
var rightBottom = new AcGePoint2d(Math.max(_this.mouseDownPositionX, point.x), Math.max(_this.mouseDownPositionY, point.y));
|
|
90
|
+
_this.drawRect(leftTop, rightBottom);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
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
|
+
*/
|
|
100
|
+
_this.mouseup = function (e) {
|
|
101
|
+
if (_this.mouseDown && _this.mouseMove) {
|
|
102
|
+
var point = new AcGePoint2d(e.x, e.y);
|
|
103
|
+
var min = new AcGePoint2d(Math.min(_this.mouseDownPositionX, point.x), Math.min(_this.mouseDownPositionY, point.y));
|
|
104
|
+
var max = new AcGePoint2d(Math.max(_this.mouseDownPositionX, point.x), Math.max(_this.mouseDownPositionY, point.y));
|
|
105
|
+
var bbox = new AcGeBox2d(min, max);
|
|
106
|
+
_this.resolve(_this.toWcs(bbox));
|
|
107
|
+
}
|
|
108
|
+
_this.mouseDown = false;
|
|
109
|
+
_this.mouseMove = false;
|
|
110
|
+
// reset
|
|
111
|
+
_this.mouseDownPositionX = -1;
|
|
112
|
+
_this.mouseDownPositionY = -1;
|
|
113
|
+
};
|
|
114
|
+
_this.container = view.canvas;
|
|
115
|
+
_this.color = BORDER_COLOR;
|
|
116
|
+
return _this;
|
|
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
|
+
*/
|
|
123
|
+
AcEdBoxSelector.prototype.activate = function () {
|
|
124
|
+
_super.prototype.activate.call(this);
|
|
125
|
+
this.active = true;
|
|
126
|
+
this.container.addEventListener('pointerdown', this.mousedown);
|
|
127
|
+
this.container.addEventListener('pointermove', this.mousemove);
|
|
128
|
+
this.container.addEventListener('pointerup', this.mouseup);
|
|
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
|
+
*/
|
|
135
|
+
AcEdBoxSelector.prototype.deactivate = function () {
|
|
136
|
+
_super.prototype.deactivate.call(this);
|
|
137
|
+
this.container.removeEventListener('pointerdown', this.mousedown);
|
|
138
|
+
this.container.removeEventListener('pointermove', this.mousemove);
|
|
139
|
+
this.container.removeEventListener('pointerup', this.mouseup);
|
|
140
|
+
this.setRectDomVisible(false);
|
|
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
|
+
*/
|
|
148
|
+
AcEdBoxSelector.prototype.reject = function (reason) {
|
|
149
|
+
var _a;
|
|
150
|
+
_super.prototype.reject.call(this, reason);
|
|
151
|
+
(_a = this.boxDom) === null || _a === void 0 ? void 0 : _a.remove();
|
|
152
|
+
this.boxDom = undefined;
|
|
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
|
+
*/
|
|
161
|
+
AcEdBoxSelector.prototype.drawRect = function (leftTop, rightBottom) {
|
|
162
|
+
if (!this.boxDom) {
|
|
163
|
+
var color = new AcCmColor();
|
|
164
|
+
color.color = this.color;
|
|
165
|
+
this.boxDom = document.createElement('div');
|
|
166
|
+
this.boxDom.style.cssText = "position: absolute;border: ".concat(BORDER_WIDTH, " solid ").concat(color.cssColor, ";");
|
|
167
|
+
document.body.appendChild(this.boxDom);
|
|
168
|
+
}
|
|
169
|
+
this.setRectDomVisible(true);
|
|
170
|
+
// Adjust leftTop and rightBottom position to make them always in container bounding box
|
|
171
|
+
// Otherwise, the box may exceed the container bounding box and scrollbar will be shown.
|
|
172
|
+
if (leftTop.x <= 0) {
|
|
173
|
+
leftTop.x = 0;
|
|
174
|
+
}
|
|
175
|
+
if (leftTop.y <= 0) {
|
|
176
|
+
leftTop.y = 0;
|
|
177
|
+
}
|
|
178
|
+
if (rightBottom.x >= this.container.clientWidth - 2) {
|
|
179
|
+
rightBottom.x = this.container.clientWidth - 2;
|
|
180
|
+
}
|
|
181
|
+
if (rightBottom.y >= this.container.clientHeight - 2) {
|
|
182
|
+
rightBottom.y = this.container.clientHeight - 2;
|
|
183
|
+
}
|
|
184
|
+
this.boxDom.style.left = "".concat(leftTop.x, "px");
|
|
185
|
+
this.boxDom.style.top = "".concat(leftTop.y, "px");
|
|
186
|
+
var width = Math.abs(rightBottom.x - leftTop.x);
|
|
187
|
+
var height = Math.abs(rightBottom.y - leftTop.y);
|
|
188
|
+
this.boxDom.style.width = "".concat(width, "px");
|
|
189
|
+
this.boxDom.style.height = "".concat(height, "px");
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Sets the visibility of the selection rectangle DOM element.
|
|
193
|
+
*
|
|
194
|
+
* @param visible - Whether the selection rectangle should be visible
|
|
195
|
+
*/
|
|
196
|
+
AcEdBoxSelector.prototype.setRectDomVisible = function (visible) {
|
|
197
|
+
if (this.boxDom) {
|
|
198
|
+
this.boxDom.style.display = visible ? 'inline-block' : 'none';
|
|
199
|
+
}
|
|
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
|
+
*/
|
|
209
|
+
AcEdBoxSelector.prototype.toWcs = function (box) {
|
|
210
|
+
var wcsBox = new AcGeBox2d();
|
|
211
|
+
var p1 = new AcGePoint2d(box.min.x, box.min.y);
|
|
212
|
+
var p2 = new AcGePoint2d(box.max.x, box.max.y);
|
|
213
|
+
wcsBox.expandByPoint(this.view.cwcs2Wcs(p1));
|
|
214
|
+
wcsBox.expandByPoint(this.view.cwcs2Wcs(p2));
|
|
215
|
+
return wcsBox;
|
|
216
|
+
};
|
|
217
|
+
return AcEdBoxSelector;
|
|
218
|
+
}(AcEdBaseInput));
|
|
219
|
+
export { AcEdBoxSelector };
|
|
220
|
+
//# sourceMappingURL=AcEdBoxSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdBoxSelector.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdBoxSelector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAA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E,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"}
|
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
*/
|
|
20
|
+
export declare enum AcEdCorsorType {
|
|
21
|
+
/** No special cursor - uses browser default */
|
|
22
|
+
NoSpecialCursor = -1,
|
|
23
|
+
/** Crosshair cursor for precise point selection */
|
|
24
|
+
Crosshair = 0,
|
|
25
|
+
/** Rectangle cursor for area selection */
|
|
26
|
+
RectCursor = 1,
|
|
27
|
+
/** Rubber band cursor for dynamic drawing */
|
|
28
|
+
RubberBand = 2,
|
|
29
|
+
/** Non-rotated cursor */
|
|
30
|
+
NotRotated = 3,
|
|
31
|
+
/** Target box cursor for object snapping */
|
|
32
|
+
TargetBox = 4,
|
|
33
|
+
/** Rotated crosshair cursor */
|
|
34
|
+
RotatedCrosshair = 5,
|
|
35
|
+
/** Crosshair that doesn't rotate with view */
|
|
36
|
+
CrosshairNoRotate = 6,
|
|
37
|
+
/** Invisible cursor for hiding cursor */
|
|
38
|
+
Invisible = 7,
|
|
39
|
+
/** Entity selection cursor */
|
|
40
|
+
EntitySelect = 8,
|
|
41
|
+
/** Parallelogram cursor for skewed operations */
|
|
42
|
+
Parallelogram = 9,
|
|
43
|
+
/** Entity select cursor without perspective */
|
|
44
|
+
EntitySelectNoPersp = 10,
|
|
45
|
+
/** Cursor for pick-first or grips operations */
|
|
46
|
+
PkfirstOrGrips = 11,
|
|
47
|
+
/** Dashed crosshair cursor */
|
|
48
|
+
CrosshairDashed = 12,
|
|
49
|
+
/** Grab/hand cursor for panning */
|
|
50
|
+
Grab = 13
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
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
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare class AcEdCursorManager {
|
|
77
|
+
/** Cache of cursor definitions mapped by cursor type */
|
|
78
|
+
private _cursorMap;
|
|
79
|
+
/**
|
|
80
|
+
* Creates a new cursor manager instance.
|
|
81
|
+
*
|
|
82
|
+
* Initializes the cursor cache and creates default cursor definitions.
|
|
83
|
+
*/
|
|
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
|
+
*/
|
|
101
|
+
setCursor(cursorType: AcEdCorsorType, element: HTMLElement): void;
|
|
102
|
+
/**
|
|
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
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
encodeSvgToCursor(svgString: string, xOffset: number, yOffset: number): string;
|
|
121
|
+
/**
|
|
122
|
+
* Create one svg icon with one rectangle plus two cross lines
|
|
123
|
+
* @param rectSize Input the width and height of rectangle
|
|
124
|
+
* @param crossLineLength Input the length of one cross line
|
|
125
|
+
* @param lineColor Input line color
|
|
126
|
+
* @returns Return svg string of the icon
|
|
127
|
+
*/
|
|
128
|
+
private createRectCrossIcon;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=AcEdCursorManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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;CAsB5B"}
|
|
@@ -0,0 +1,155 @@
|
|
|
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
|
+
*/
|
|
20
|
+
export var AcEdCorsorType;
|
|
21
|
+
(function (AcEdCorsorType) {
|
|
22
|
+
/** No special cursor - uses browser default */
|
|
23
|
+
AcEdCorsorType[AcEdCorsorType["NoSpecialCursor"] = -1] = "NoSpecialCursor";
|
|
24
|
+
/** Crosshair cursor for precise point selection */
|
|
25
|
+
AcEdCorsorType[AcEdCorsorType["Crosshair"] = 0] = "Crosshair";
|
|
26
|
+
/** Rectangle cursor for area selection */
|
|
27
|
+
AcEdCorsorType[AcEdCorsorType["RectCursor"] = 1] = "RectCursor";
|
|
28
|
+
/** Rubber band cursor for dynamic drawing */
|
|
29
|
+
AcEdCorsorType[AcEdCorsorType["RubberBand"] = 2] = "RubberBand";
|
|
30
|
+
/** Non-rotated cursor */
|
|
31
|
+
AcEdCorsorType[AcEdCorsorType["NotRotated"] = 3] = "NotRotated";
|
|
32
|
+
/** Target box cursor for object snapping */
|
|
33
|
+
AcEdCorsorType[AcEdCorsorType["TargetBox"] = 4] = "TargetBox";
|
|
34
|
+
/** Rotated crosshair cursor */
|
|
35
|
+
AcEdCorsorType[AcEdCorsorType["RotatedCrosshair"] = 5] = "RotatedCrosshair";
|
|
36
|
+
/** Crosshair that doesn't rotate with view */
|
|
37
|
+
AcEdCorsorType[AcEdCorsorType["CrosshairNoRotate"] = 6] = "CrosshairNoRotate";
|
|
38
|
+
/** Invisible cursor for hiding cursor */
|
|
39
|
+
AcEdCorsorType[AcEdCorsorType["Invisible"] = 7] = "Invisible";
|
|
40
|
+
/** Entity selection cursor */
|
|
41
|
+
AcEdCorsorType[AcEdCorsorType["EntitySelect"] = 8] = "EntitySelect";
|
|
42
|
+
/** Parallelogram cursor for skewed operations */
|
|
43
|
+
AcEdCorsorType[AcEdCorsorType["Parallelogram"] = 9] = "Parallelogram";
|
|
44
|
+
/** Entity select cursor without perspective */
|
|
45
|
+
AcEdCorsorType[AcEdCorsorType["EntitySelectNoPersp"] = 10] = "EntitySelectNoPersp";
|
|
46
|
+
/** Cursor for pick-first or grips operations */
|
|
47
|
+
AcEdCorsorType[AcEdCorsorType["PkfirstOrGrips"] = 11] = "PkfirstOrGrips";
|
|
48
|
+
/** Dashed crosshair cursor */
|
|
49
|
+
AcEdCorsorType[AcEdCorsorType["CrosshairDashed"] = 12] = "CrosshairDashed";
|
|
50
|
+
/** Grab/hand cursor for panning */
|
|
51
|
+
AcEdCorsorType[AcEdCorsorType["Grab"] = 13] = "Grab";
|
|
52
|
+
})(AcEdCorsorType || (AcEdCorsorType = {}));
|
|
53
|
+
/**
|
|
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
|
+
* ```
|
|
76
|
+
*/
|
|
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
|
+
*/
|
|
83
|
+
function AcEdCursorManager() {
|
|
84
|
+
this._cursorMap = new Map();
|
|
85
|
+
this._cursorMap.set(AcEdCorsorType.Crosshair, this.createRectCrossIcon(10, 10));
|
|
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
|
+
*/
|
|
103
|
+
AcEdCursorManager.prototype.setCursor = function (cursorType, element) {
|
|
104
|
+
if (cursorType <= AcEdCorsorType.NoSpecialCursor) {
|
|
105
|
+
element.style.cursor = 'default';
|
|
106
|
+
}
|
|
107
|
+
else if (cursorType == AcEdCorsorType.Grab) {
|
|
108
|
+
element.style.cursor = 'grab';
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
var cursor = this._cursorMap.get(cursorType);
|
|
112
|
+
if (cursor) {
|
|
113
|
+
element.style.cursor = cursor;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
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
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
AcEdCursorManager.prototype.encodeSvgToCursor = function (svgString, xOffset, yOffset) {
|
|
136
|
+
return "url('data:image/svg+xml;base64,".concat(btoa(svgString), "') ").concat(xOffset, " ").concat(yOffset, ", auto");
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Create one svg icon with one rectangle plus two cross lines
|
|
140
|
+
* @param rectSize Input the width and height of rectangle
|
|
141
|
+
* @param crossLineLength Input the length of one cross line
|
|
142
|
+
* @param lineColor Input line color
|
|
143
|
+
* @returns Return svg string of the icon
|
|
144
|
+
*/
|
|
145
|
+
AcEdCursorManager.prototype.createRectCrossIcon = function (rectSize, lineLength, lineColor) {
|
|
146
|
+
if (lineColor === void 0) { lineColor = 'white'; }
|
|
147
|
+
var halfSize = rectSize / 2;
|
|
148
|
+
var svgSize = rectSize + 2 * lineLength;
|
|
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 ");
|
|
150
|
+
return this.encodeSvgToCursor(svg, halfSize + lineLength, halfSize + lineLength);
|
|
151
|
+
};
|
|
152
|
+
return AcEdCursorManager;
|
|
153
|
+
}());
|
|
154
|
+
export { AcEdCursorManager };
|
|
155
|
+
//# sourceMappingURL=AcEdCursorManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,CAAC;YACjD,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAA;QAClC,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S,gDAClI,QAAQ,GAAG,UAAU,qBAAS,UAAU,qBAAS,QAAQ,GAAG,UAAU,yBAAa,SAAS,8BAElH,CAAA;QACD,OAAO,IAAI,CAAC,iBAAiB,CAC3B,GAAG,EACH,QAAQ,GAAG,UAAU,EACrB,QAAQ,GAAG,UAAU,CACtB,CAAA;IACH,CAAC;IACH,wBAAC;AAAD,CAAC,AAjGD,IAiGC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { AcGePoint2d } from '@mlightcad/data-model';
|
|
2
|
+
import { AcEdBaseView } from '../view/AcEdBaseView';
|
|
3
|
+
import { AcEdBaseInput } from './AcEdBaseInput';
|
|
4
|
+
/**
|
|
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
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
49
|
+
private onClick;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=AcEdInputPoint.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;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"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import { AcEdBaseInput } from './AcEdBaseInput';
|
|
17
|
+
/**
|
|
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
|
+
*
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
var AcEdInputPoint = /** @class */ (function (_super) {
|
|
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
|
+
*/
|
|
43
|
+
function AcEdInputPoint(view) {
|
|
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
|
+
*/
|
|
52
|
+
_this.onClick = function (event) {
|
|
53
|
+
_this.resolve(_this.view.cwcs2Wcs({ x: event.clientX, y: event.clientY }));
|
|
54
|
+
};
|
|
55
|
+
return _this;
|
|
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
|
+
*/
|
|
62
|
+
AcEdInputPoint.prototype.activate = function () {
|
|
63
|
+
_super.prototype.activate.call(this);
|
|
64
|
+
this.view.canvas.addEventListener('click', this.onClick);
|
|
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
|
+
*/
|
|
71
|
+
AcEdInputPoint.prototype.deactivate = function () {
|
|
72
|
+
_super.prototype.deactivate.call(this);
|
|
73
|
+
this.view.canvas.removeEventListener('click', this.onClick);
|
|
74
|
+
};
|
|
75
|
+
return AcEdInputPoint;
|
|
76
|
+
}(AcEdBaseInput));
|
|
77
|
+
export { AcEdInputPoint };
|
|
78
|
+
//# sourceMappingURL=AcEdInputPoint.js.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAAoC,kCAA0B;IAC5D;;;;OAIG;IACH,wBAAY,IAAkB;QAC5B,YAAA,MAAK,YAAC,IAAI,CAAC,SAAA;QAuBb;;;;;;WAMG;QACK,aAAO,GAAG,UAAC,KAAiB;YAClC,KAAI,CAAC,OAAO,CAAC,KAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;QAC1E,CAAC,CAAA;;IA/BD,CAAC;IAED;;;;OAIG;IACH,iCAAQ,GAAR;QACE,gBAAK,CAAC,QAAQ,WAAE,CAAA;QAChB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAC1D,CAAC;IAED;;;;OAIG;IACH,mCAAU,GAAV;QACE,gBAAK,CAAC,UAAU,WAAE,CAAA;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAC7D,CAAC;IAYH,qBAAC;AAAD,CAAC,AAxCD,CAAoC,aAAa,GAwChD"}
|