@mlightcad/cad-simple-viewer 1.0.0
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/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/index.js +2422 -0
- package/dist/index.umd.cjs +9 -0
- package/lib/app/AcApContext.d.ts +15 -0
- package/lib/app/AcApContext.d.ts.map +1 -0
- package/lib/app/AcApContext.js +56 -0
- package/lib/app/AcApContext.js.map +1 -0
- package/lib/app/AcApDocCreator.d.ts +17 -0
- package/lib/app/AcApDocCreator.d.ts.map +1 -0
- package/lib/app/AcApDocCreator.js +140 -0
- package/lib/app/AcApDocCreator.js.map +1 -0
- package/lib/app/AcApDocManager.d.ts +60 -0
- package/lib/app/AcApDocManager.d.ts.map +1 -0
- package/lib/app/AcApDocManager.js +275 -0
- package/lib/app/AcApDocManager.js.map +1 -0
- package/lib/app/AcApDocument.d.ts +27 -0
- package/lib/app/AcApDocument.d.ts.map +1 -0
- package/lib/app/AcApDocument.js +165 -0
- package/lib/app/AcApDocument.js.map +1 -0
- package/lib/app/AcApFontLoader.d.ts +20 -0
- package/lib/app/AcApFontLoader.d.ts.map +1 -0
- package/lib/app/AcApFontLoader.js +135 -0
- package/lib/app/AcApFontLoader.js.map +1 -0
- package/lib/app/AcApSettingManager.d.ts +44 -0
- package/lib/app/AcApSettingManager.d.ts.map +1 -0
- package/lib/app/AcApSettingManager.js +122 -0
- package/lib/app/AcApSettingManager.js.map +1 -0
- package/lib/app/index.d.ts +5 -0
- package/lib/app/index.d.ts.map +1 -0
- package/lib/app/index.js +5 -0
- package/lib/app/index.js.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts +6 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.js +30 -0
- package/lib/command/AcApConvertToSvgCmd.js.map +1 -0
- package/lib/command/AcApOpenCmd.d.ts +6 -0
- package/lib/command/AcApOpenCmd.d.ts.map +1 -0
- package/lib/command/AcApOpenCmd.js +29 -0
- package/lib/command/AcApOpenCmd.js.map +1 -0
- package/lib/command/AcApPanCmd.d.ts +6 -0
- package/lib/command/AcApPanCmd.d.ts.map +1 -0
- package/lib/command/AcApPanCmd.js +30 -0
- package/lib/command/AcApPanCmd.js.map +1 -0
- package/lib/command/AcApQNewCmd.d.ts +6 -0
- package/lib/command/AcApQNewCmd.d.ts.map +1 -0
- package/lib/command/AcApQNewCmd.js +30 -0
- package/lib/command/AcApQNewCmd.js.map +1 -0
- package/lib/command/AcApSelectCmd.d.ts +6 -0
- package/lib/command/AcApSelectCmd.d.ts.map +1 -0
- package/lib/command/AcApSelectCmd.js +30 -0
- package/lib/command/AcApSelectCmd.js.map +1 -0
- package/lib/command/AcApSvgConvertor.d.ts +5 -0
- package/lib/command/AcApSvgConvertor.d.ts.map +1 -0
- package/lib/command/AcApSvgConvertor.js +55 -0
- package/lib/command/AcApSvgConvertor.js.map +1 -0
- package/lib/command/AcApZoomCmd.d.ts +6 -0
- package/lib/command/AcApZoomCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomCmd.js +28 -0
- package/lib/command/AcApZoomCmd.js.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts +11 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.js +101 -0
- package/lib/command/AcApZoomToBoxCmd.js.map +1 -0
- package/lib/command/index.d.ts +10 -0
- package/lib/command/index.d.ts.map +1 -0
- package/lib/command/index.js +10 -0
- package/lib/command/index.js.map +1 -0
- package/lib/editor/command/AcEdCommand.d.ts +42 -0
- package/lib/editor/command/AcEdCommand.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommand.js +60 -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 +66 -0
- package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommandStack.js +192 -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/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 +34 -0
- package/lib/editor/global/eventBus.d.ts.map +1 -0
- package/lib/editor/global/eventBus.js +3 -0
- package/lib/editor/global/eventBus.js.map +1 -0
- package/lib/editor/global/index.d.ts +3 -0
- package/lib/editor/global/index.d.ts.map +1 -0
- package/lib/editor/global/index.js +3 -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 +25 -0
- package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -0
- package/lib/editor/input/AcEdBaseInput.js +105 -0
- package/lib/editor/input/AcEdBaseInput.js.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts +27 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.js +140 -0
- package/lib/editor/input/AcEdBoxSelector.js.map +1 -0
- package/lib/editor/input/AcEdCursorManager.d.ts +43 -0
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -0
- package/lib/editor/input/AcEdCursorManager.js +71 -0
- package/lib/editor/input/AcEdCursorManager.js.map +1 -0
- package/lib/editor/input/AcEdInputPoint.d.ts +14 -0
- package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -0
- package/lib/editor/input/AcEdInputPoint.js +41 -0
- package/lib/editor/input/AcEdInputPoint.js.map +1 -0
- package/lib/editor/input/AcEdJig.d.ts +14 -0
- package/lib/editor/input/AcEdJig.d.ts.map +1 -0
- package/lib/editor/input/AcEdJig.js +92 -0
- package/lib/editor/input/AcEdJig.js.map +1 -0
- package/lib/editor/input/AcEdJigLoop.d.ts +14 -0
- package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -0
- package/lib/editor/input/AcEdJigLoop.js +43 -0
- package/lib/editor/input/AcEdJigLoop.js.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts +26 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.js +63 -0
- package/lib/editor/input/AcEdSelectionSet.js.map +1 -0
- package/lib/editor/input/AcEditor.d.ts +27 -0
- package/lib/editor/input/AcEditor.d.ts.map +1 -0
- package/lib/editor/input/AcEditor.js +103 -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 +261 -0
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -0
- package/lib/editor/view/AcEdBaseView.js +260 -0
- package/lib/editor/view/AcEdBaseView.js.map +1 -0
- package/lib/editor/view/index.d.ts +2 -0
- package/lib/editor/view/index.d.ts.map +1 -0
- package/lib/editor/view/index.js +2 -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 +18 -0
- package/lib/util/AcTrGeometryUtil.d.ts.map +1 -0
- package/lib/util/AcTrGeometryUtil.js +33 -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 +97 -0
- package/lib/view/AcTrLayer.d.ts.map +1 -0
- package/lib/view/AcTrLayer.js +170 -0
- package/lib/view/AcTrLayer.js.map +1 -0
- package/lib/view/AcTrLayout.d.ts +114 -0
- package/lib/view/AcTrLayout.d.ts.map +1 -0
- package/lib/view/AcTrLayout.js +344 -0
- package/lib/view/AcTrLayout.js.map +1 -0
- package/lib/view/AcTrLayoutView.d.ts +57 -0
- package/lib/view/AcTrLayoutView.d.ts.map +1 -0
- package/lib/view/AcTrLayoutView.js +151 -0
- package/lib/view/AcTrLayoutView.js.map +1 -0
- package/lib/view/AcTrLayoutViewManager.d.ts +43 -0
- package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -0
- package/lib/view/AcTrLayoutViewManager.js +74 -0
- package/lib/view/AcTrLayoutViewManager.js.map +1 -0
- package/lib/view/AcTrScene.d.ts +115 -0
- package/lib/view/AcTrScene.d.ts.map +1 -0
- package/lib/view/AcTrScene.js +319 -0
- package/lib/view/AcTrScene.js.map +1 -0
- package/lib/view/AcTrView2d.d.ts +160 -0
- package/lib/view/AcTrView2d.d.ts.map +1 -0
- package/lib/view/AcTrView2d.js +473 -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 +55 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { AcCmEventManager, AcDbEntity, AcDbObjectId, AcGeBox2d, AcGeBox3d, AcGePoint2d, AcGePoint2dLike } from '@mlightcad/data-model';
|
|
2
|
+
import { AcEdCorsorType, AcEdSelectionSet } from '../input';
|
|
3
|
+
import { AcEditor } from '../input/AcEditor';
|
|
4
|
+
/**
|
|
5
|
+
* Item returned by spatial query
|
|
6
|
+
*/
|
|
7
|
+
export interface AcEdSpatialQueryResultItem {
|
|
8
|
+
minX: number;
|
|
9
|
+
minY: number;
|
|
10
|
+
maxX: number;
|
|
11
|
+
maxY: number;
|
|
12
|
+
id: AcDbObjectId;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Interface to define arguments of mouse event events.
|
|
16
|
+
*/
|
|
17
|
+
export interface AcEdMouseEventArgs {
|
|
18
|
+
/**
|
|
19
|
+
* X coordinate value of current mouse in the world coordinate system
|
|
20
|
+
*/
|
|
21
|
+
x: number;
|
|
22
|
+
/**
|
|
23
|
+
* Y coordinate value of current mouse in the world coordinate system
|
|
24
|
+
*/
|
|
25
|
+
y: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Interface to define arguments of view resized events.
|
|
29
|
+
*/
|
|
30
|
+
export interface AcEdViewResizedEventArgs {
|
|
31
|
+
/**
|
|
32
|
+
* New width of the resized view.
|
|
33
|
+
*/
|
|
34
|
+
width: number;
|
|
35
|
+
/**
|
|
36
|
+
* New height of the resized view.
|
|
37
|
+
*/
|
|
38
|
+
height: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Interface to define arguments of hover events.
|
|
42
|
+
*/
|
|
43
|
+
export interface AcEdViewHoverEventArgs {
|
|
44
|
+
/**
|
|
45
|
+
* X coordinate value of current mouse in the screen coordinate system
|
|
46
|
+
*/
|
|
47
|
+
x: number;
|
|
48
|
+
/**
|
|
49
|
+
* Y coordinate value of current mouse in the screen coordinate system
|
|
50
|
+
*/
|
|
51
|
+
y: number;
|
|
52
|
+
/**
|
|
53
|
+
* Object id of the hovered entity
|
|
54
|
+
*/
|
|
55
|
+
id: AcDbObjectId;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* View mode
|
|
59
|
+
*/
|
|
60
|
+
export declare enum AcEdViewMode {
|
|
61
|
+
/**
|
|
62
|
+
* Click to select
|
|
63
|
+
*/
|
|
64
|
+
SELECTION = 0,
|
|
65
|
+
/**
|
|
66
|
+
* Click to move
|
|
67
|
+
*/
|
|
68
|
+
PAN = 1
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Represents missed data when rendering entities in the drawing
|
|
72
|
+
*/
|
|
73
|
+
export interface AcEdMissedData {
|
|
74
|
+
fonts: Record<string, number>;
|
|
75
|
+
images: Map<string, string>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Type of callback function used to calculate size of canvas when window resized
|
|
79
|
+
*/
|
|
80
|
+
export type AcEdCalculateSizeCallback = () => {
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
};
|
|
84
|
+
export declare abstract class AcEdBaseView {
|
|
85
|
+
private _width;
|
|
86
|
+
private _height;
|
|
87
|
+
private _calculateSizeCallback?;
|
|
88
|
+
private _bbox;
|
|
89
|
+
private _curPos;
|
|
90
|
+
private _curScreenPos;
|
|
91
|
+
private _selectionSet;
|
|
92
|
+
private _editor;
|
|
93
|
+
private _selectionBoxSize;
|
|
94
|
+
private _hoverTimer;
|
|
95
|
+
private _pauseTimer;
|
|
96
|
+
private _hoveredObjectId;
|
|
97
|
+
protected _canvas: HTMLCanvasElement;
|
|
98
|
+
readonly events: {
|
|
99
|
+
mouseMove: AcCmEventManager<AcEdMouseEventArgs>;
|
|
100
|
+
viewResize: AcCmEventManager<AcEdViewResizedEventArgs>;
|
|
101
|
+
hover: AcCmEventManager<AcEdViewHoverEventArgs>;
|
|
102
|
+
unhover: AcCmEventManager<AcEdViewHoverEventArgs>;
|
|
103
|
+
};
|
|
104
|
+
constructor(canvas: HTMLCanvasElement);
|
|
105
|
+
/**
|
|
106
|
+
* The input manager
|
|
107
|
+
*/
|
|
108
|
+
get editor(): AcEditor;
|
|
109
|
+
/**
|
|
110
|
+
* The size of selection box in pixel unit
|
|
111
|
+
*/
|
|
112
|
+
get selectionBoxSize(): number;
|
|
113
|
+
set selectionBoxSize(value: number);
|
|
114
|
+
/**
|
|
115
|
+
* The missed data such as fonts, images, and xrefs.
|
|
116
|
+
*/
|
|
117
|
+
abstract get missedData(): AcEdMissedData;
|
|
118
|
+
/**
|
|
119
|
+
* The view mode of the current view
|
|
120
|
+
*/
|
|
121
|
+
abstract get mode(): AcEdViewMode;
|
|
122
|
+
abstract set mode(value: AcEdViewMode);
|
|
123
|
+
/**
|
|
124
|
+
* The center point of the current view
|
|
125
|
+
*/
|
|
126
|
+
abstract get center(): AcGePoint2d;
|
|
127
|
+
abstract set center(value: AcGePoint2d);
|
|
128
|
+
/**
|
|
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
|
|
133
|
+
*/
|
|
134
|
+
abstract cwcs2Wcs(point: AcGePoint2dLike): AcGePoint2d;
|
|
135
|
+
/**
|
|
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
|
|
140
|
+
*/
|
|
141
|
+
abstract wcs2Cwcs(point: AcGePoint2dLike): AcGePoint2d;
|
|
142
|
+
abstract zoomTo(box: AcGeBox2d, margin: number): void;
|
|
143
|
+
abstract zoomToFit(): void;
|
|
144
|
+
/**
|
|
145
|
+
* Search entities intersected or contained in the specified bounding box.
|
|
146
|
+
* @param box Input the query bounding box
|
|
147
|
+
* @returns Return query results
|
|
148
|
+
*/
|
|
149
|
+
abstract search(box: AcGeBox2d | AcGeBox3d): AcEdSpatialQueryResultItem[];
|
|
150
|
+
/**
|
|
151
|
+
* Pick entities intersected with the specified point in the world coordinate
|
|
152
|
+
* system.
|
|
153
|
+
* @param point Input the point to pick objects. If not provided, the position
|
|
154
|
+
* of current cursor is used.
|
|
155
|
+
* @returns Return ids of entities intersected with the specified point
|
|
156
|
+
*/
|
|
157
|
+
abstract pick(point?: AcGePoint2dLike): AcDbObjectId[];
|
|
158
|
+
/**
|
|
159
|
+
* Select entities intersected with the specified bounding box in the world
|
|
160
|
+
* coordinate system, add them to the current selection set, and highlight
|
|
161
|
+
* them.
|
|
162
|
+
* @param box Input one bounding box in the world coordinate system.
|
|
163
|
+
*/
|
|
164
|
+
abstract selectByBox(box: AcGeBox2d): void;
|
|
165
|
+
/**
|
|
166
|
+
* Select entities intersected with the specified point in the world coordinate
|
|
167
|
+
* system, add them to the current selection set, and highlight them.
|
|
168
|
+
* @param box Input one point in the world coordinate system.
|
|
169
|
+
*/
|
|
170
|
+
abstract select(point?: AcGePoint2dLike): void;
|
|
171
|
+
/**
|
|
172
|
+
* Clear the scene
|
|
173
|
+
*/
|
|
174
|
+
abstract clear(): void;
|
|
175
|
+
/**
|
|
176
|
+
* Add the specified entity in drawing database into the current scene and draw it
|
|
177
|
+
* @param entity Input the entity to add into the current scene
|
|
178
|
+
*/
|
|
179
|
+
abstract addEntity(entity: AcDbEntity): void;
|
|
180
|
+
/**
|
|
181
|
+
* Update the specified entity
|
|
182
|
+
* @param entity Input the entity to update
|
|
183
|
+
*/
|
|
184
|
+
abstract updateEntity(entity: AcDbEntity): void;
|
|
185
|
+
/**
|
|
186
|
+
* Select the specified entities
|
|
187
|
+
*/
|
|
188
|
+
abstract highlight(ids: AcDbObjectId[]): void;
|
|
189
|
+
/**
|
|
190
|
+
* Unhighlight the specified entities
|
|
191
|
+
*/
|
|
192
|
+
abstract unhighlight(ids: AcDbObjectId[]): void;
|
|
193
|
+
/**
|
|
194
|
+
* Set layer's visibility
|
|
195
|
+
* @param layerName Input layer name
|
|
196
|
+
* @param visible Input visibility of the layer
|
|
197
|
+
*/
|
|
198
|
+
abstract setLayerVisibility(layerName: string, visible: boolean): void;
|
|
199
|
+
/**
|
|
200
|
+
* Called when hovering the specified entity
|
|
201
|
+
*/
|
|
202
|
+
protected abstract onHover(id: AcDbObjectId): void;
|
|
203
|
+
/**
|
|
204
|
+
* Called when unhovering the specified entity
|
|
205
|
+
*/
|
|
206
|
+
protected abstract onUnhover(id: AcDbObjectId): void;
|
|
207
|
+
/**
|
|
208
|
+
* Set cursor type of this view
|
|
209
|
+
* @param cursorType Input cursor type
|
|
210
|
+
*/
|
|
211
|
+
setCursor(cursorType: AcEdCorsorType): void;
|
|
212
|
+
/**
|
|
213
|
+
* Set callback function used to calculate size of canvas when window resized
|
|
214
|
+
* @param value Input callback function
|
|
215
|
+
*/
|
|
216
|
+
setCalculateSizeCallback(value: AcEdCalculateSizeCallback): void;
|
|
217
|
+
/**
|
|
218
|
+
* Width of canvas (not width of window) in pixel
|
|
219
|
+
*/
|
|
220
|
+
get width(): number;
|
|
221
|
+
set width(value: number);
|
|
222
|
+
/**
|
|
223
|
+
* Height of canvas (not height of window) in pixel
|
|
224
|
+
*/
|
|
225
|
+
get height(): number;
|
|
226
|
+
set height(value: number);
|
|
227
|
+
/**
|
|
228
|
+
* The bounding box to include all entities in this viewer
|
|
229
|
+
*/
|
|
230
|
+
get bbox(): AcGeBox3d;
|
|
231
|
+
/**
|
|
232
|
+
* The canvas HTML element used by this view
|
|
233
|
+
*/
|
|
234
|
+
get canvas(): HTMLCanvasElement;
|
|
235
|
+
get aspect(): number;
|
|
236
|
+
/**
|
|
237
|
+
* Postion of current mouse in world coordinate system
|
|
238
|
+
*/
|
|
239
|
+
get curPos(): AcGePoint2d;
|
|
240
|
+
/**
|
|
241
|
+
* Postion of current mouse in screen coordinate system
|
|
242
|
+
*/
|
|
243
|
+
get curScreenPos(): AcGePoint2d;
|
|
244
|
+
/**
|
|
245
|
+
* The selection set in current view.
|
|
246
|
+
*/
|
|
247
|
+
get selectionSet(): AcEdSelectionSet;
|
|
248
|
+
protected onWindowResize(): void;
|
|
249
|
+
/**
|
|
250
|
+
* Mouse move event handler.
|
|
251
|
+
* @param event Input mouse event argument
|
|
252
|
+
*/
|
|
253
|
+
private onMouseMove;
|
|
254
|
+
private setHoveredObjectId;
|
|
255
|
+
private hoverAt;
|
|
256
|
+
private clearHoverTimer;
|
|
257
|
+
private clearPauseTimer;
|
|
258
|
+
private startHoverTimer;
|
|
259
|
+
private startPauseTimer;
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=AcEdBaseView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,CAAC,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SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAEtE;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI;IAElD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI;IAEpD;;;OAGG;IACH,SAAS,CAAC,UAAU,EAAE,cAAc;IAIpC;;;OAGG;IACH,wBAAwB,CAAC,KAAK,EAAE,yBAAyB;IAIzD;;OAEG;IACH,IAAI,KAAK,IAGQ,MAAM,CADtB;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAEtB;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"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { AcCmEventManager, AcGeBox3d, AcGePoint2d } from '@mlightcad/data-model';
|
|
2
|
+
import { AcEdCorsorType, AcEdSelectionSet } from '../input';
|
|
3
|
+
import { AcEditor } from '../input/AcEditor';
|
|
4
|
+
/**
|
|
5
|
+
* View mode
|
|
6
|
+
*/
|
|
7
|
+
export var AcEdViewMode;
|
|
8
|
+
(function (AcEdViewMode) {
|
|
9
|
+
/**
|
|
10
|
+
* Click to select
|
|
11
|
+
*/
|
|
12
|
+
AcEdViewMode[AcEdViewMode["SELECTION"] = 0] = "SELECTION";
|
|
13
|
+
/**
|
|
14
|
+
* Click to move
|
|
15
|
+
*/
|
|
16
|
+
AcEdViewMode[AcEdViewMode["PAN"] = 1] = "PAN";
|
|
17
|
+
})(AcEdViewMode || (AcEdViewMode = {}));
|
|
18
|
+
var AcEdBaseView = /** @class */ (function () {
|
|
19
|
+
function AcEdBaseView(canvas) {
|
|
20
|
+
var _this = this;
|
|
21
|
+
this.events = {
|
|
22
|
+
mouseMove: new AcCmEventManager(),
|
|
23
|
+
viewResize: new AcCmEventManager(),
|
|
24
|
+
hover: new AcCmEventManager(),
|
|
25
|
+
unhover: new AcCmEventManager()
|
|
26
|
+
};
|
|
27
|
+
this._canvas = canvas;
|
|
28
|
+
var rect = canvas.getBoundingClientRect();
|
|
29
|
+
this._bbox = new AcGeBox3d();
|
|
30
|
+
this._width = rect.width;
|
|
31
|
+
this._height = rect.height;
|
|
32
|
+
this._curPos = new AcGePoint2d();
|
|
33
|
+
this._curScreenPos = new AcGePoint2d();
|
|
34
|
+
this._selectionSet = new AcEdSelectionSet();
|
|
35
|
+
this._editor = new AcEditor(this);
|
|
36
|
+
this._canvas.addEventListener('mousemove', function (event) { return _this.onMouseMove(event); });
|
|
37
|
+
this._canvas.addEventListener('mousedown', function (event) {
|
|
38
|
+
if (event.button === 1) {
|
|
39
|
+
// Middle mouse button (button === 1)
|
|
40
|
+
_this._editor.setCursor(AcEdCorsorType.Grab);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
this._canvas.addEventListener('mouseup', function (event) {
|
|
44
|
+
if (event.button === 1) {
|
|
45
|
+
// Middle mouse button (button === 1)
|
|
46
|
+
_this._editor.restoreCursor();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
window.addEventListener('resize', this.onWindowResize.bind(this));
|
|
50
|
+
this._selectionBoxSize = 4;
|
|
51
|
+
// Initialize hover/unhover handler
|
|
52
|
+
this._hoverTimer = null;
|
|
53
|
+
this._pauseTimer = null;
|
|
54
|
+
this._hoveredObjectId = null;
|
|
55
|
+
}
|
|
56
|
+
Object.defineProperty(AcEdBaseView.prototype, "editor", {
|
|
57
|
+
/**
|
|
58
|
+
* The input manager
|
|
59
|
+
*/
|
|
60
|
+
get: function () {
|
|
61
|
+
return this._editor;
|
|
62
|
+
},
|
|
63
|
+
enumerable: false,
|
|
64
|
+
configurable: true
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(AcEdBaseView.prototype, "selectionBoxSize", {
|
|
67
|
+
/**
|
|
68
|
+
* The size of selection box in pixel unit
|
|
69
|
+
*/
|
|
70
|
+
get: function () {
|
|
71
|
+
return this._selectionBoxSize;
|
|
72
|
+
},
|
|
73
|
+
set: function (value) {
|
|
74
|
+
this._selectionBoxSize = value;
|
|
75
|
+
},
|
|
76
|
+
enumerable: false,
|
|
77
|
+
configurable: true
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* Set cursor type of this view
|
|
81
|
+
* @param cursorType Input cursor type
|
|
82
|
+
*/
|
|
83
|
+
AcEdBaseView.prototype.setCursor = function (cursorType) {
|
|
84
|
+
this._editor.setCursor(cursorType);
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Set callback function used to calculate size of canvas when window resized
|
|
88
|
+
* @param value Input callback function
|
|
89
|
+
*/
|
|
90
|
+
AcEdBaseView.prototype.setCalculateSizeCallback = function (value) {
|
|
91
|
+
this._calculateSizeCallback = value;
|
|
92
|
+
};
|
|
93
|
+
Object.defineProperty(AcEdBaseView.prototype, "width", {
|
|
94
|
+
/**
|
|
95
|
+
* Width of canvas (not width of window) in pixel
|
|
96
|
+
*/
|
|
97
|
+
get: function () {
|
|
98
|
+
return this._width;
|
|
99
|
+
},
|
|
100
|
+
set: function (value) {
|
|
101
|
+
this._width = value;
|
|
102
|
+
},
|
|
103
|
+
enumerable: false,
|
|
104
|
+
configurable: true
|
|
105
|
+
});
|
|
106
|
+
Object.defineProperty(AcEdBaseView.prototype, "height", {
|
|
107
|
+
/**
|
|
108
|
+
* Height of canvas (not height of window) in pixel
|
|
109
|
+
*/
|
|
110
|
+
get: function () {
|
|
111
|
+
return this._height;
|
|
112
|
+
},
|
|
113
|
+
set: function (value) {
|
|
114
|
+
this._height = value;
|
|
115
|
+
},
|
|
116
|
+
enumerable: false,
|
|
117
|
+
configurable: true
|
|
118
|
+
});
|
|
119
|
+
Object.defineProperty(AcEdBaseView.prototype, "bbox", {
|
|
120
|
+
/**
|
|
121
|
+
* The bounding box to include all entities in this viewer
|
|
122
|
+
*/
|
|
123
|
+
get: function () {
|
|
124
|
+
return this._bbox;
|
|
125
|
+
},
|
|
126
|
+
enumerable: false,
|
|
127
|
+
configurable: true
|
|
128
|
+
});
|
|
129
|
+
Object.defineProperty(AcEdBaseView.prototype, "canvas", {
|
|
130
|
+
/**
|
|
131
|
+
* The canvas HTML element used by this view
|
|
132
|
+
*/
|
|
133
|
+
get: function () {
|
|
134
|
+
return this._canvas;
|
|
135
|
+
},
|
|
136
|
+
enumerable: false,
|
|
137
|
+
configurable: true
|
|
138
|
+
});
|
|
139
|
+
Object.defineProperty(AcEdBaseView.prototype, "aspect", {
|
|
140
|
+
get: function () {
|
|
141
|
+
return this._width / this._height;
|
|
142
|
+
},
|
|
143
|
+
enumerable: false,
|
|
144
|
+
configurable: true
|
|
145
|
+
});
|
|
146
|
+
Object.defineProperty(AcEdBaseView.prototype, "curPos", {
|
|
147
|
+
/**
|
|
148
|
+
* Postion of current mouse in world coordinate system
|
|
149
|
+
*/
|
|
150
|
+
get: function () {
|
|
151
|
+
return this._curPos;
|
|
152
|
+
},
|
|
153
|
+
enumerable: false,
|
|
154
|
+
configurable: true
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(AcEdBaseView.prototype, "curScreenPos", {
|
|
157
|
+
/**
|
|
158
|
+
* Postion of current mouse in screen coordinate system
|
|
159
|
+
*/
|
|
160
|
+
get: function () {
|
|
161
|
+
return this._curScreenPos;
|
|
162
|
+
},
|
|
163
|
+
enumerable: false,
|
|
164
|
+
configurable: true
|
|
165
|
+
});
|
|
166
|
+
Object.defineProperty(AcEdBaseView.prototype, "selectionSet", {
|
|
167
|
+
/**
|
|
168
|
+
* The selection set in current view.
|
|
169
|
+
*/
|
|
170
|
+
get: function () {
|
|
171
|
+
return this._selectionSet;
|
|
172
|
+
},
|
|
173
|
+
enumerable: false,
|
|
174
|
+
configurable: true
|
|
175
|
+
});
|
|
176
|
+
AcEdBaseView.prototype.onWindowResize = function () {
|
|
177
|
+
if (this._calculateSizeCallback) {
|
|
178
|
+
var _a = this._calculateSizeCallback(), width = _a.width, height = _a.height;
|
|
179
|
+
this._width = width;
|
|
180
|
+
this._height = height;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
this._width = this._canvas.clientWidth;
|
|
184
|
+
this._height = this._canvas.clientHeight;
|
|
185
|
+
}
|
|
186
|
+
this.events.viewResize.dispatch({
|
|
187
|
+
width: this._width,
|
|
188
|
+
height: this._height
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Mouse move event handler.
|
|
193
|
+
* @param event Input mouse event argument
|
|
194
|
+
*/
|
|
195
|
+
AcEdBaseView.prototype.onMouseMove = function (event) {
|
|
196
|
+
this._curScreenPos = new AcGePoint2d(event.clientX, event.clientY);
|
|
197
|
+
var wcsPos = this.cwcs2Wcs(this._curScreenPos);
|
|
198
|
+
this._curPos.copy(wcsPos);
|
|
199
|
+
this.events.mouseMove.dispatch({ x: wcsPos.x, y: wcsPos.y });
|
|
200
|
+
// Hover handler
|
|
201
|
+
if (this.mode == AcEdViewMode.SELECTION) {
|
|
202
|
+
this.startHoverTimer(wcsPos.x, wcsPos.y);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
AcEdBaseView.prototype.setHoveredObjectId = function (newId) {
|
|
206
|
+
if (this._hoveredObjectId) {
|
|
207
|
+
this.events.unhover.dispatch({
|
|
208
|
+
id: this._hoveredObjectId,
|
|
209
|
+
x: this.curScreenPos.x,
|
|
210
|
+
y: this.curScreenPos.y
|
|
211
|
+
});
|
|
212
|
+
this.onUnhover(this._hoveredObjectId);
|
|
213
|
+
}
|
|
214
|
+
this._hoveredObjectId = newId;
|
|
215
|
+
if (newId) {
|
|
216
|
+
this.startPauseTimer(newId);
|
|
217
|
+
this.onHover(newId);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
AcEdBaseView.prototype.hoverAt = function (x, y) {
|
|
221
|
+
var results = this.pick({ x: x, y: y });
|
|
222
|
+
if (results.length > 0) {
|
|
223
|
+
this.setHoveredObjectId(results[0]);
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
this.setHoveredObjectId(null);
|
|
227
|
+
this.clearPauseTimer();
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
AcEdBaseView.prototype.clearHoverTimer = function () {
|
|
231
|
+
if (this._hoverTimer) {
|
|
232
|
+
clearTimeout(this._hoverTimer);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
AcEdBaseView.prototype.clearPauseTimer = function () {
|
|
236
|
+
if (this._pauseTimer) {
|
|
237
|
+
clearTimeout(this._pauseTimer);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
AcEdBaseView.prototype.startHoverTimer = function (x, y) {
|
|
241
|
+
var _this = this;
|
|
242
|
+
this.clearHoverTimer();
|
|
243
|
+
this._hoverTimer = setTimeout(function () {
|
|
244
|
+
_this.hoverAt(x, y);
|
|
245
|
+
}, 50);
|
|
246
|
+
};
|
|
247
|
+
AcEdBaseView.prototype.startPauseTimer = function (id) {
|
|
248
|
+
var _this = this;
|
|
249
|
+
this._pauseTimer = setTimeout(function () {
|
|
250
|
+
_this.events.hover.dispatch({
|
|
251
|
+
id: id,
|
|
252
|
+
x: _this.curScreenPos.x,
|
|
253
|
+
y: _this.curScreenPos.y
|
|
254
|
+
});
|
|
255
|
+
}, 500);
|
|
256
|
+
};
|
|
257
|
+
return AcEdBaseView;
|
|
258
|
+
}());
|
|
259
|
+
export { AcEdBaseView };
|
|
260
|
+
//# sourceMappingURL=AcEdBaseView.js.map
|
|
@@ -0,0 +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,EAAE,IAAI,gBAAgB,EAAsB;YACrD,UAAU,EAAE,IAAI,gBAAgB,EAA4B;YAC5D,KAAK,EAAE,IAAI,gBAAgB,EAA0B;YACrD,OAAO,EAAE,IAAI,gBAAgB,EAA0B;SACxD,CAAA;QAGC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,IAAM,IAAI,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAA;QAC3C,IAAI,CAAC,KAAK,GAAG,IAAI,SAAS,EAAE,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAA;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAA;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;QAChC,IAAI,CAAC,aAAa,GAAG,IAAI,WAAW,EAAE,CAAA;QACtC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C,IAAI,CAAC,eAAe,EAAE,CAAA;QACtB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC5B,KAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACpB,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,CAAC;IAEO,sCAAe,GAAvB,UAAwB,EAAgB;QAAxC,iBAQC;QAPC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC5B,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;gBACzB,EAAE,EAAE,EAAE;gBACN,CAAC,EAAE,KAAI,CAAC,YAAY,CAAC,CAAC;gBACtB,CAAC,EAAE,KAAI,CAAC,YAAY,CAAC,CAAC;aACvB,CAAC,CAAA;QACJ,CAAC,EAAE,GAAG,CAAC,CAAA;IACT,CAAC;IACH,mBAAC;AAAD,CAAC,AAvVD,IAuVC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/view/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/editor/view/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA"}
|
package/lib/index.js
ADDED
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AcGeBox2d, AcGeBox3d } from '@mlightcad/data-model';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
declare const threeBox3dToGeBox3d: (from: THREE.Box3) => AcGeBox3d;
|
|
4
|
+
declare const goBox3dToThreeBox3d: (from: AcGeBox3d) => THREE.Box3;
|
|
5
|
+
declare const threeBo2dToGeBox2d: (from: THREE.Box2) => AcGeBox2d;
|
|
6
|
+
declare const goBox2dToThreeBox2d: (from: AcGeBox2d) => THREE.Box2;
|
|
7
|
+
declare const threeBox3dToGeBox2d: (from: THREE.Box3) => AcGeBox2d;
|
|
8
|
+
declare const goBox2dToThreeBox3d: (from: AcGeBox2d) => THREE.Box3;
|
|
9
|
+
declare const AcTrGeometryUtil: {
|
|
10
|
+
threeBo2dToGeBox2d: (from: THREE.Box2) => AcGeBox2d;
|
|
11
|
+
goBox2dToThreeBox2d: (from: AcGeBox2d) => THREE.Box2;
|
|
12
|
+
threeBox3dToGeBox3d: (from: THREE.Box3) => AcGeBox3d;
|
|
13
|
+
goBox3dToThreeBox3d: (from: AcGeBox3d) => THREE.Box3;
|
|
14
|
+
threeBox3dToGeBox2d: (from: THREE.Box3) => AcGeBox2d;
|
|
15
|
+
goBox2dToThreeBox3d: (from: AcGeBox2d) => THREE.Box3;
|
|
16
|
+
};
|
|
17
|
+
export { threeBo2dToGeBox2d, goBox2dToThreeBox2d, threeBox3dToGeBox3d, goBox3dToThreeBox3d, threeBox3dToGeBox2d, goBox2dToThreeBox3d, AcTrGeometryUtil };
|
|
18
|
+
//# sourceMappingURL=AcTrGeometryUtil.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcTrGeometryUtil.d.ts","sourceRoot":"","sources":["../../src/util/AcTrGeometryUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,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"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AcGeBox2d, AcGeBox3d } from '@mlightcad/data-model';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
var threeBox3dToGeBox3d = function (from) {
|
|
4
|
+
return new AcGeBox3d(from.min, from.max);
|
|
5
|
+
};
|
|
6
|
+
var goBox3dToThreeBox3d = function (from) {
|
|
7
|
+
return new THREE.Box3(from.min, from.max);
|
|
8
|
+
};
|
|
9
|
+
var threeBo2dToGeBox2d = function (from) {
|
|
10
|
+
return new AcGeBox2d(from.min, from.max);
|
|
11
|
+
};
|
|
12
|
+
var goBox2dToThreeBox2d = function (from) {
|
|
13
|
+
return new THREE.Box2(from.min, from.max);
|
|
14
|
+
};
|
|
15
|
+
var threeBox3dToGeBox2d = function (from) {
|
|
16
|
+
return new AcGeBox2d(from.min, from.max);
|
|
17
|
+
};
|
|
18
|
+
var goBox2dToThreeBox3d = function (from) {
|
|
19
|
+
var threeBox3d = new THREE.Box3();
|
|
20
|
+
threeBox3d.min.set(from.min.x, from.min.y, 0);
|
|
21
|
+
threeBox3d.max.set(from.max.x, from.max.y, 0);
|
|
22
|
+
return threeBox3d;
|
|
23
|
+
};
|
|
24
|
+
var AcTrGeometryUtil = {
|
|
25
|
+
threeBo2dToGeBox2d: threeBo2dToGeBox2d,
|
|
26
|
+
goBox2dToThreeBox2d: goBox2dToThreeBox2d,
|
|
27
|
+
threeBox3dToGeBox3d: threeBox3dToGeBox3d,
|
|
28
|
+
goBox3dToThreeBox3d: goBox3dToThreeBox3d,
|
|
29
|
+
threeBox3dToGeBox2d: threeBox3dToGeBox2d,
|
|
30
|
+
goBox2dToThreeBox3d: goBox2dToThreeBox3d
|
|
31
|
+
};
|
|
32
|
+
export { threeBo2dToGeBox2d, goBox2dToThreeBox2d, threeBox3dToGeBox3d, goBox3dToThreeBox3d, threeBox3dToGeBox2d, goBox2dToThreeBox3d, AcTrGeometryUtil };
|
|
33
|
+
//# sourceMappingURL=AcTrGeometryUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcTrGeometryUtil.js","sourceRoot":"","sources":["../../src/util/AcTrGeometryUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,IAAM,mBAAmB,GAAG,UAAC,IAAgB;IAC3C,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1C,CAAC,CAAA;AAED,IAAM,mBAAmB,GAAG,UAAC,IAAe;IAC1C,OAAO,IAAI,KAAK,CAAC,IAAI,CACnB,IAAI,CAAC,GAA+B,EACpC,IAAI,CAAC,GAA+B,CACrC,CAAA;AACH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
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|