@mlightcad/cad-simple-viewer 1.2.2 → 1.2.3
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/__vite-browser-external-l0sNRNKZ-l0sNRNKZ.js +1 -0
- package/dist/index.js +40205 -0
- package/dist/index.umd.cjs +333 -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 +3 -3
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
var __values = (this && this.__values) || function(o) {
|
|
2
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
3
|
+
if (m) return m.call(o);
|
|
4
|
+
if (o && typeof o.length === "number") return {
|
|
5
|
+
next: function () {
|
|
6
|
+
if (o && i >= o.length) o = void 0;
|
|
7
|
+
return { value: o && o[i++], done: !o };
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
|
+
};
|
|
12
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
import * as THREE from 'three';
|
|
29
|
+
import { AcTrLayout } from './AcTrLayout';
|
|
30
|
+
/**
|
|
31
|
+
* Three.js scene manager for CAD drawings with hierarchical organization.
|
|
32
|
+
*
|
|
33
|
+
* The scene manages the complete visual representation of a CAD drawing using
|
|
34
|
+
* a hierarchical structure that mirrors CAD data organization:
|
|
35
|
+
*
|
|
36
|
+
* ```
|
|
37
|
+
* Scene
|
|
38
|
+
* └── Layout (AcTrLayout) - Paper space or model space
|
|
39
|
+
* └── Layer (AcTrLayer) - Drawing layers for organization
|
|
40
|
+
* └── Entity (AcTrEntity) - Individual CAD entities (lines, arcs, etc.)
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* ## Key Responsibilities
|
|
44
|
+
* - **Layout Management**: Handles multiple layouts (model space and paper spaces)
|
|
45
|
+
* - **Layer Organization**: Manages layer visibility and entity grouping
|
|
46
|
+
* - **Entity Rendering**: Provides access to all renderable CAD entities
|
|
47
|
+
* - **Spatial Queries**: Calculates bounding boxes and spatial relationships
|
|
48
|
+
* - **Three.js Integration**: Maintains the underlying Three.js scene
|
|
49
|
+
*
|
|
50
|
+
* The scene automatically manages the active layout and provides efficient
|
|
51
|
+
* access to entities for rendering, selection, and spatial operations.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const scene = new AcTrScene();
|
|
56
|
+
*
|
|
57
|
+
* // Set up model space
|
|
58
|
+
* scene.modelSpaceBtrId = modelSpaceId;
|
|
59
|
+
*
|
|
60
|
+
* // Add entities to layers
|
|
61
|
+
* const entity = new AcTrLine(...);
|
|
62
|
+
* scene.addEntity(entity, layerName);
|
|
63
|
+
*
|
|
64
|
+
* // Get all visible entities for rendering
|
|
65
|
+
* const entities = scene.getAllEntities();
|
|
66
|
+
*
|
|
67
|
+
* // Get scene bounds for zoom operations
|
|
68
|
+
* const bounds = scene.box;
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
var AcTrScene = /** @class */ (function () {
|
|
72
|
+
/**
|
|
73
|
+
* Creates a new CAD scene instance.
|
|
74
|
+
*
|
|
75
|
+
* Initializes the Three.js scene and layout management structures.
|
|
76
|
+
*/
|
|
77
|
+
function AcTrScene() {
|
|
78
|
+
this._scene = new THREE.Scene();
|
|
79
|
+
this._layers = new Map();
|
|
80
|
+
this._layouts = new Map();
|
|
81
|
+
this._activeLayoutBtrId = '';
|
|
82
|
+
this._modelSpaceBtrId = '';
|
|
83
|
+
}
|
|
84
|
+
Object.defineProperty(AcTrScene.prototype, "layers", {
|
|
85
|
+
/**
|
|
86
|
+
* The layers in this scene
|
|
87
|
+
*/
|
|
88
|
+
get: function () {
|
|
89
|
+
return this._layers;
|
|
90
|
+
},
|
|
91
|
+
enumerable: false,
|
|
92
|
+
configurable: true
|
|
93
|
+
});
|
|
94
|
+
Object.defineProperty(AcTrScene.prototype, "layouts", {
|
|
95
|
+
/**
|
|
96
|
+
* The layouts in this scene
|
|
97
|
+
*/
|
|
98
|
+
get: function () {
|
|
99
|
+
return this._layouts;
|
|
100
|
+
},
|
|
101
|
+
enumerable: false,
|
|
102
|
+
configurable: true
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(AcTrScene.prototype, "box", {
|
|
105
|
+
/**
|
|
106
|
+
* The bounding box of the visibile objects in this secene
|
|
107
|
+
*/
|
|
108
|
+
get: function () {
|
|
109
|
+
var _a;
|
|
110
|
+
return (_a = this.activeLayout) === null || _a === void 0 ? void 0 : _a.box;
|
|
111
|
+
},
|
|
112
|
+
enumerable: false,
|
|
113
|
+
configurable: true
|
|
114
|
+
});
|
|
115
|
+
Object.defineProperty(AcTrScene.prototype, "internalScene", {
|
|
116
|
+
/**
|
|
117
|
+
* The scene object of THREE.js. This is internally used only. Try to avoid using it.
|
|
118
|
+
*/
|
|
119
|
+
get: function () {
|
|
120
|
+
return this._scene;
|
|
121
|
+
},
|
|
122
|
+
enumerable: false,
|
|
123
|
+
configurable: true
|
|
124
|
+
});
|
|
125
|
+
Object.defineProperty(AcTrScene.prototype, "modelSpaceBtrId", {
|
|
126
|
+
/**
|
|
127
|
+
* The block table record id of the model space
|
|
128
|
+
*/
|
|
129
|
+
get: function () {
|
|
130
|
+
return this._modelSpaceBtrId;
|
|
131
|
+
},
|
|
132
|
+
set: function (value) {
|
|
133
|
+
this._modelSpaceBtrId = value;
|
|
134
|
+
if (!this._layouts.has(value)) {
|
|
135
|
+
throw new Error("[AcTrScene] No layout assiciated with the specified block table record id '".concat(value, "'!"));
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
enumerable: false,
|
|
139
|
+
configurable: true
|
|
140
|
+
});
|
|
141
|
+
Object.defineProperty(AcTrScene.prototype, "activeLayoutBtrId", {
|
|
142
|
+
/**
|
|
143
|
+
* The block table record id associated with the current active layout
|
|
144
|
+
*/
|
|
145
|
+
get: function () {
|
|
146
|
+
return this._activeLayoutBtrId;
|
|
147
|
+
},
|
|
148
|
+
set: function (value) {
|
|
149
|
+
this._activeLayoutBtrId = value;
|
|
150
|
+
this._layouts.forEach(function (layout, key) {
|
|
151
|
+
layout.visible = value == key;
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
enumerable: false,
|
|
155
|
+
configurable: true
|
|
156
|
+
});
|
|
157
|
+
Object.defineProperty(AcTrScene.prototype, "activeLayout", {
|
|
158
|
+
/**
|
|
159
|
+
* Get active layout
|
|
160
|
+
*/
|
|
161
|
+
get: function () {
|
|
162
|
+
if (this._activeLayoutBtrId && this._layouts.has(this._activeLayoutBtrId)) {
|
|
163
|
+
return this._layouts.get(this._activeLayoutBtrId);
|
|
164
|
+
}
|
|
165
|
+
return undefined;
|
|
166
|
+
},
|
|
167
|
+
enumerable: false,
|
|
168
|
+
configurable: true
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(AcTrScene.prototype, "modelSpaceLayout", {
|
|
171
|
+
/**
|
|
172
|
+
* Get the layout of the model space
|
|
173
|
+
*/
|
|
174
|
+
get: function () {
|
|
175
|
+
if (this._modelSpaceBtrId && this._layouts.has(this._modelSpaceBtrId)) {
|
|
176
|
+
return this._layouts.get(this._modelSpaceBtrId);
|
|
177
|
+
}
|
|
178
|
+
return undefined;
|
|
179
|
+
},
|
|
180
|
+
enumerable: false,
|
|
181
|
+
configurable: true
|
|
182
|
+
});
|
|
183
|
+
Object.defineProperty(AcTrScene.prototype, "stats", {
|
|
184
|
+
/**
|
|
185
|
+
* The statistics of this scene
|
|
186
|
+
*/
|
|
187
|
+
get: function () {
|
|
188
|
+
var layouts = [];
|
|
189
|
+
this._layouts.forEach(function (layout) { return layouts.push(layout.stats); });
|
|
190
|
+
return {
|
|
191
|
+
layouts: layouts
|
|
192
|
+
};
|
|
193
|
+
},
|
|
194
|
+
enumerable: false,
|
|
195
|
+
configurable: true
|
|
196
|
+
});
|
|
197
|
+
/**
|
|
198
|
+
* Add one empty layout with the specified block table record id as the its key
|
|
199
|
+
* @param ownerId Input the block table record id associated with this layout
|
|
200
|
+
* @returns Return the newly created empty layout
|
|
201
|
+
*/
|
|
202
|
+
AcTrScene.prototype.addEmptyLayout = function (ownerId) {
|
|
203
|
+
var layout = new AcTrLayout();
|
|
204
|
+
this._layouts.set(ownerId, layout);
|
|
205
|
+
this._scene.add(layout.internalObject);
|
|
206
|
+
layout.visible = ownerId == this._activeLayoutBtrId;
|
|
207
|
+
this._layers.forEach(function (layer) {
|
|
208
|
+
layout.addLayer(layer);
|
|
209
|
+
});
|
|
210
|
+
return layout;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Clear scene
|
|
214
|
+
* @returns Return this scene
|
|
215
|
+
*/
|
|
216
|
+
AcTrScene.prototype.clear = function () {
|
|
217
|
+
var _this = this;
|
|
218
|
+
this._layouts.forEach(function (layout) {
|
|
219
|
+
_this._scene.remove(layout.internalObject);
|
|
220
|
+
layout.clear();
|
|
221
|
+
});
|
|
222
|
+
this._layouts.clear();
|
|
223
|
+
this._layers.clear();
|
|
224
|
+
this._scene.clear();
|
|
225
|
+
return this;
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Hover the specified entities
|
|
229
|
+
*/
|
|
230
|
+
AcTrScene.prototype.hover = function (ids) {
|
|
231
|
+
var activeLayout = this.activeLayout;
|
|
232
|
+
if (activeLayout) {
|
|
233
|
+
this.activeLayout.hover(ids);
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
return false;
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* Unhover the specified entities
|
|
240
|
+
*/
|
|
241
|
+
AcTrScene.prototype.unhover = function (ids) {
|
|
242
|
+
var activeLayout = this.activeLayout;
|
|
243
|
+
if (activeLayout) {
|
|
244
|
+
this.activeLayout.unhover(ids);
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
return false;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Select the specified entities
|
|
251
|
+
*/
|
|
252
|
+
AcTrScene.prototype.select = function (ids) {
|
|
253
|
+
var activeLayout = this.activeLayout;
|
|
254
|
+
if (activeLayout) {
|
|
255
|
+
this.activeLayout.select(ids);
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
return false;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Unselect the specified entities
|
|
262
|
+
*/
|
|
263
|
+
AcTrScene.prototype.unselect = function (ids) {
|
|
264
|
+
var activeLayout = this.activeLayout;
|
|
265
|
+
if (activeLayout) {
|
|
266
|
+
this.activeLayout.unselect(ids);
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
return false;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Search entities intersected or contained in the specified bounding box.
|
|
273
|
+
* @param box Input the query bounding box
|
|
274
|
+
* @returns Return query results
|
|
275
|
+
*/
|
|
276
|
+
AcTrScene.prototype.search = function (box) {
|
|
277
|
+
var activeLayout = this.activeLayout;
|
|
278
|
+
return activeLayout ? activeLayout === null || activeLayout === void 0 ? void 0 : activeLayout.search(box) : [];
|
|
279
|
+
};
|
|
280
|
+
AcTrScene.prototype.addLayer = function (layer) {
|
|
281
|
+
this._layers.set(layer.name, layer);
|
|
282
|
+
this._layouts.forEach(function (layout) {
|
|
283
|
+
layout.addLayer(layer);
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
AcTrScene.prototype.updateLayer = function (layer) {
|
|
287
|
+
this._layers.set(layer.name, layer);
|
|
288
|
+
this._layouts.forEach(function (layout) {
|
|
289
|
+
layout.updateLayer(layer);
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* Add one AutoCAD entity into this scene. If the layout associated with this entity doesn't exist,
|
|
294
|
+
* then create one layout, add this layout into this scene, and add the entity into the layout.
|
|
295
|
+
* @param entity Input AutoCAD entity to be added into scene.
|
|
296
|
+
* @param extendBbox Input the flag whether to extend the bounding box of this scene by union the bounding box
|
|
297
|
+
* of the specified entity.
|
|
298
|
+
* @returns Return this scene
|
|
299
|
+
*/
|
|
300
|
+
AcTrScene.prototype.addEntity = function (entity, extendBbox) {
|
|
301
|
+
if (extendBbox === void 0) { extendBbox = true; }
|
|
302
|
+
var ownerId = entity.ownerId;
|
|
303
|
+
if (ownerId) {
|
|
304
|
+
var layout = this._layouts.get(ownerId);
|
|
305
|
+
if (!layout) {
|
|
306
|
+
layout = this.addEmptyLayout(ownerId);
|
|
307
|
+
}
|
|
308
|
+
layout.addEntity(entity, extendBbox);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
console.warn('[AcTrSecene] The owner id of one entity cannot be empty!');
|
|
312
|
+
}
|
|
313
|
+
return this;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Remove the specified entity from this scene.
|
|
317
|
+
* @param objectId Input the object id of the entity to remove
|
|
318
|
+
* @returns Return true if remove the specified entity successfully. Otherwise, return false.
|
|
319
|
+
*/
|
|
320
|
+
AcTrScene.prototype.remove = function (objectId) {
|
|
321
|
+
var e_1, _a;
|
|
322
|
+
try {
|
|
323
|
+
for (var _b = __values(this._layouts), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
324
|
+
var _d = __read(_c.value, 2), _1 = _d[0], layout = _d[1];
|
|
325
|
+
if (layout.remove(objectId))
|
|
326
|
+
return true;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
330
|
+
finally {
|
|
331
|
+
try {
|
|
332
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
333
|
+
}
|
|
334
|
+
finally { if (e_1) throw e_1.error; }
|
|
335
|
+
}
|
|
336
|
+
return false;
|
|
337
|
+
};
|
|
338
|
+
/**
|
|
339
|
+
* Update the specified entity in this scene.
|
|
340
|
+
* @param objectId Input the entity to update
|
|
341
|
+
* @returns Return true if update the specified entity successfully. Otherwise, return false.
|
|
342
|
+
*/
|
|
343
|
+
AcTrScene.prototype.update = function (entity) {
|
|
344
|
+
var e_2, _a;
|
|
345
|
+
try {
|
|
346
|
+
for (var _b = __values(this._layouts), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
347
|
+
var _d = __read(_c.value, 2), _2 = _d[0], layout = _d[1];
|
|
348
|
+
if (layout.updateEntity(entity))
|
|
349
|
+
return true;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
353
|
+
finally {
|
|
354
|
+
try {
|
|
355
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
356
|
+
}
|
|
357
|
+
finally { if (e_2) throw e_2.error; }
|
|
358
|
+
}
|
|
359
|
+
return false;
|
|
360
|
+
};
|
|
361
|
+
AcTrScene.prototype.setSnapObject = function (object) {
|
|
362
|
+
this._layouts.forEach(function (layout) {
|
|
363
|
+
layout.setSnapObject(object);
|
|
364
|
+
});
|
|
365
|
+
return this;
|
|
366
|
+
};
|
|
367
|
+
return AcTrScene;
|
|
368
|
+
}());
|
|
369
|
+
export { AcTrScene };
|
|
370
|
+
//# sourceMappingURL=AcTrScene.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcTrScene.js","sourceRoot":"","sources":["../../src/view/AcTrScene.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAA;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH;IAYE;;;;OAIG;IACH;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAA;QAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAA;QACzB,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAA;QAC5B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAA;IAC5B,CAAC;IAKD,sBAAI,6BAAM;QAHV;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,OAAO,CAAA;QACrB,CAAC;;;OAAA;IAKD,sBAAI,8BAAO;QAHX;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,QAAQ,CAAA;QACtB,CAAC;;;OAAA;IAKD,sBAAI,0BAAG;QAHP;;WAEG;aACH;;YACE,OAAO,MAAA,IAAI,CAAC,YAAY,0CAAE,GAAG,CAAA;QAC/B,CAAC;;;OAAA;IAKD,sBAAI,oCAAa;QAHjB;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,MAAM,CAAA;QACpB,CAAC;;;OAAA;IAKD,sBAAI,sCAAe;QAHnB;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,gBAAgB,CAAA;QAC9B,CAAC;aACD,UAAoB,KAAmB;YACrC,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAA;YAC7B,IA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A,SAAA,IAAI,CAAC,QAAQ,CAAA,gBAAA,4BAAE,CAAC;gBAA/B,IAAA,KAAA,mBAAW,EAAV,EAAC,QAAA,EAAE,MAAM,QAAA;gBACnB,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC;oBAAE,OAAO,IAAI,CAAA;YAC9C,CAAC;;;;;;;;;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,iCAAa,GAAb,UAAc,MAAkB;QAC9B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,MAAM;YAC1B,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QAC9B,CAAC,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;IACH,gBAAC;AAAD,CAAC,AA7QD,IA6QC"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { AcDbEntity, AcDbLayerTableRecord, AcDbLayout, AcDbObjectId, AcGeBox2d, AcGeBox3d, AcGePoint2d, AcGePoint2dLike } from '@mlightcad/data-model';
|
|
2
|
+
import { AcTrRenderer } from '@mlightcad/three-renderer';
|
|
3
|
+
import { AcEdBaseView, AcEdCalculateSizeCallback, AcEdViewMode } from '../editor';
|
|
4
|
+
import { AcTrLayoutView } from './AcTrLayoutView';
|
|
5
|
+
import { AcTrScene } from './AcTrScene';
|
|
6
|
+
/**
|
|
7
|
+
* Options to customize view
|
|
8
|
+
*/
|
|
9
|
+
export interface AcTrView2dOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Canvas HTML element used by renderer
|
|
12
|
+
*/
|
|
13
|
+
canvas?: HTMLCanvasElement;
|
|
14
|
+
/**
|
|
15
|
+
* Callback function used to calculate size of canvas when window resized
|
|
16
|
+
*/
|
|
17
|
+
calculateSizeCallback?: AcEdCalculateSizeCallback;
|
|
18
|
+
/**
|
|
19
|
+
* Background color
|
|
20
|
+
*/
|
|
21
|
+
background?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Default view option values
|
|
25
|
+
*/
|
|
26
|
+
export declare const DEFAULT_VIEW_2D_OPTIONS: AcTrView2dOptions;
|
|
27
|
+
/**
|
|
28
|
+
* A 2D CAD viewer component that renders CAD drawings using Three.js.
|
|
29
|
+
*
|
|
30
|
+
* This class extends {@link AcEdBaseView} and provides functionality for:
|
|
31
|
+
* - Rendering 2D CAD drawings with Three.js WebGL renderer
|
|
32
|
+
* - Handling user interactions (pan, zoom, select)
|
|
33
|
+
* - Managing layouts, layers, and entities
|
|
34
|
+
* - Supporting various CAD file formats (DWG, DXF)
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const viewer = new AcTrView2d({
|
|
39
|
+
* canvas: document.getElementById('canvas') as HTMLCanvasElement,
|
|
40
|
+
* background: 0x000000,
|
|
41
|
+
* calculateSizeCallback: () => ({
|
|
42
|
+
* width: window.innerWidth,
|
|
43
|
+
* height: window.innerHeight
|
|
44
|
+
* })
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare class AcTrView2d extends AcEdBaseView {
|
|
49
|
+
/** The Three.js renderer wrapper for CAD rendering */
|
|
50
|
+
private _renderer;
|
|
51
|
+
/** Manager for layout views and viewport handling */
|
|
52
|
+
private _layoutViewManager;
|
|
53
|
+
/** The 3D scene containing all CAD entities organized by layouts and layers */
|
|
54
|
+
private _scene;
|
|
55
|
+
/** Flag indicating if the view needs to be re-rendered */
|
|
56
|
+
private _isDirty;
|
|
57
|
+
/** Performance monitoring statistics display */
|
|
58
|
+
private _stats;
|
|
59
|
+
/** Map of missing raster images during rendering */
|
|
60
|
+
private _missedImages;
|
|
61
|
+
/** The number of entities waiting for processing */
|
|
62
|
+
private _numOfEntitiesToProcess;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a new 2D CAD viewer instance.
|
|
65
|
+
*
|
|
66
|
+
* @param options - Configuration options for the viewer
|
|
67
|
+
* @param options.canvas - Optional HTML canvas element. If not provided, a new canvas will be created
|
|
68
|
+
* @param options.calculateSizeCallback - Optional callback function to calculate canvas size on window resize
|
|
69
|
+
* @param options.background - Optional background color as hex number (default: 0x000000)
|
|
70
|
+
*/
|
|
71
|
+
constructor(options?: AcTrView2dOptions);
|
|
72
|
+
/**
|
|
73
|
+
* Initializes the viewer after renderer and camera are created.
|
|
74
|
+
*
|
|
75
|
+
* This method sets up the initial cursor and can be overridden by child classes
|
|
76
|
+
* to add custom initialization logic.
|
|
77
|
+
*
|
|
78
|
+
* @protected
|
|
79
|
+
*/
|
|
80
|
+
initialize(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Gets the current view mode (selection or pan).
|
|
83
|
+
*
|
|
84
|
+
* @returns The current view mode
|
|
85
|
+
* @inheritdoc
|
|
86
|
+
*/
|
|
87
|
+
get mode(): AcEdViewMode;
|
|
88
|
+
/**
|
|
89
|
+
* Sets the view mode (selection or pan).
|
|
90
|
+
*
|
|
91
|
+
* @param value - The view mode to set
|
|
92
|
+
*/
|
|
93
|
+
set mode(value: AcEdViewMode);
|
|
94
|
+
/**
|
|
95
|
+
* Gets the Three.js renderer wrapper used for CAD rendering.
|
|
96
|
+
*
|
|
97
|
+
* @returns The renderer instance
|
|
98
|
+
*/
|
|
99
|
+
get renderer(): AcTrRenderer;
|
|
100
|
+
/**
|
|
101
|
+
* Gets whether the view needs to be re-rendered.
|
|
102
|
+
*
|
|
103
|
+
* @returns True if the view is dirty and needs re-rendering
|
|
104
|
+
*/
|
|
105
|
+
get isDirty(): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Sets whether the view needs to be re-rendered.
|
|
108
|
+
*
|
|
109
|
+
* @param value - True to mark the view as needing re-rendering
|
|
110
|
+
*/
|
|
111
|
+
set isDirty(value: boolean);
|
|
112
|
+
/**
|
|
113
|
+
* Gets information about missing data during rendering (fonts and images).
|
|
114
|
+
*
|
|
115
|
+
* @returns Object containing maps of missing fonts and images
|
|
116
|
+
*/
|
|
117
|
+
get missedData(): {
|
|
118
|
+
fonts: Record<string, number>;
|
|
119
|
+
images: Map<string, string>;
|
|
120
|
+
};
|
|
121
|
+
get center(): AcGePoint2d;
|
|
122
|
+
set center(value: AcGePoint2d);
|
|
123
|
+
/**
|
|
124
|
+
* Gets the background color of the view.
|
|
125
|
+
*
|
|
126
|
+
* The color is represented as a 24-bit hexadecimal RGB number, e.g.,
|
|
127
|
+
* `0x000000` for black.
|
|
128
|
+
*/
|
|
129
|
+
get backgroundColor(): number;
|
|
130
|
+
/**
|
|
131
|
+
* Sets the background color of the view.
|
|
132
|
+
*
|
|
133
|
+
* @param value - The background color as a 24-bit hexadecimal RGB number
|
|
134
|
+
*/
|
|
135
|
+
set backgroundColor(value: number);
|
|
136
|
+
/**
|
|
137
|
+
* The block table record id of the model space
|
|
138
|
+
*/
|
|
139
|
+
get modelSpaceBtrId(): AcDbObjectId;
|
|
140
|
+
set modelSpaceBtrId(value: AcDbObjectId);
|
|
141
|
+
/**
|
|
142
|
+
* The block table record id associated with the active layout
|
|
143
|
+
*/
|
|
144
|
+
get activeLayoutBtrId(): string;
|
|
145
|
+
set activeLayoutBtrId(value: string);
|
|
146
|
+
/**
|
|
147
|
+
* The active layout view
|
|
148
|
+
*/
|
|
149
|
+
get activeLayoutView(): AcTrLayoutView;
|
|
150
|
+
/**
|
|
151
|
+
* The statistics of the current scene
|
|
152
|
+
*/
|
|
153
|
+
get stats(): {
|
|
154
|
+
layouts: import("./AcTrLayout").AcTrLayoutStats[];
|
|
155
|
+
};
|
|
156
|
+
animate(): void;
|
|
157
|
+
/**
|
|
158
|
+
* @inheritdoc
|
|
159
|
+
*/
|
|
160
|
+
cwcs2Wcs(point: AcGePoint2dLike): AcGePoint2d;
|
|
161
|
+
/**
|
|
162
|
+
* @inheritdoc
|
|
163
|
+
*/
|
|
164
|
+
wcs2Cwcs(point: AcGePoint2dLike): AcGePoint2d;
|
|
165
|
+
/**
|
|
166
|
+
* @inheritdoc
|
|
167
|
+
*/
|
|
168
|
+
zoomTo(box: AcGeBox2d, margin?: number): void;
|
|
169
|
+
/**
|
|
170
|
+
* Re-render points with latest point style settings
|
|
171
|
+
* @param displayMode Input display mode of points
|
|
172
|
+
*/
|
|
173
|
+
rerenderPoints(displayMode: number): void;
|
|
174
|
+
/**
|
|
175
|
+
* @inheritdoc
|
|
176
|
+
*/
|
|
177
|
+
zoomToFit(timeout?: number): void;
|
|
178
|
+
/**
|
|
179
|
+
* @inheritdoc
|
|
180
|
+
*/
|
|
181
|
+
pick(point?: AcGePoint2dLike): string[];
|
|
182
|
+
/**
|
|
183
|
+
* @inheritdoc
|
|
184
|
+
*/
|
|
185
|
+
search(box: AcGeBox2d | AcGeBox3d): import("../editor").AcEdSpatialQueryResultItem[];
|
|
186
|
+
/**
|
|
187
|
+
* @inheritdoc
|
|
188
|
+
*/
|
|
189
|
+
select(point?: AcGePoint2dLike): void;
|
|
190
|
+
/**
|
|
191
|
+
* @inheritdoc
|
|
192
|
+
*/
|
|
193
|
+
selectByBox(box: AcGeBox2d): void;
|
|
194
|
+
/**
|
|
195
|
+
* @inheritdoc
|
|
196
|
+
*/
|
|
197
|
+
addLayer(layer: AcDbLayerTableRecord): void;
|
|
198
|
+
/**
|
|
199
|
+
* @inheritdoc
|
|
200
|
+
*/
|
|
201
|
+
updateLayer(layer: AcDbLayerTableRecord): void;
|
|
202
|
+
/**
|
|
203
|
+
* @inheritdoc
|
|
204
|
+
*/
|
|
205
|
+
addEntity(entity: AcDbEntity | AcDbEntity[]): void;
|
|
206
|
+
/**
|
|
207
|
+
* Remove the specified entity from this view.
|
|
208
|
+
* @param objectId Input the object id of the entity to remove
|
|
209
|
+
*/
|
|
210
|
+
removeEntity(objectId: AcDbObjectId): void;
|
|
211
|
+
/**
|
|
212
|
+
* @inheritdoc
|
|
213
|
+
*/
|
|
214
|
+
updateEntity(entity: AcDbEntity | AcDbEntity[]): void;
|
|
215
|
+
/**
|
|
216
|
+
* @inheritdoc
|
|
217
|
+
*/
|
|
218
|
+
addLayout(layout: AcDbLayout): void;
|
|
219
|
+
/**
|
|
220
|
+
* @inheritdoc
|
|
221
|
+
*/
|
|
222
|
+
clear(): void;
|
|
223
|
+
/**
|
|
224
|
+
* @inheritdoc
|
|
225
|
+
*/
|
|
226
|
+
highlight(ids: AcDbObjectId[]): void;
|
|
227
|
+
/**
|
|
228
|
+
* @inheritdoc
|
|
229
|
+
*/
|
|
230
|
+
unhighlight(ids: AcDbObjectId[]): void;
|
|
231
|
+
/**
|
|
232
|
+
* @inheritdoc
|
|
233
|
+
*/
|
|
234
|
+
protected onHover(id: AcDbObjectId): void;
|
|
235
|
+
/**
|
|
236
|
+
* @inheritdoc
|
|
237
|
+
*/
|
|
238
|
+
protected onUnhover(id: AcDbObjectId): void;
|
|
239
|
+
protected createScene(): AcTrScene;
|
|
240
|
+
private createStats;
|
|
241
|
+
protected onWindowResize(): void;
|
|
242
|
+
/**
|
|
243
|
+
* Create the layout view with the specified block table record id.
|
|
244
|
+
* @param layoutBtrId Input the block table record id associated with the layout view.
|
|
245
|
+
*/
|
|
246
|
+
private createLayoutViewIfNeeded;
|
|
247
|
+
/**
|
|
248
|
+
* Show or hide stats component
|
|
249
|
+
* @param show If it is true, show stats component. Otherwise, hide stats component.
|
|
250
|
+
* Default value is false.
|
|
251
|
+
*/
|
|
252
|
+
private toggleStatsVisibility;
|
|
253
|
+
/**
|
|
254
|
+
* Converts the specified database entities to three entities
|
|
255
|
+
* @param entities - The database entities
|
|
256
|
+
* @returns The converted three entities
|
|
257
|
+
*/
|
|
258
|
+
private batchConvert;
|
|
259
|
+
private handleGroup;
|
|
260
|
+
private decreaseNumOfEntitiesToProcess;
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=AcTrView2d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcTrView2d.d.ts","sourceRoot":"","sources":["../../src/view/AcTrView2d.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,oBAAoB,EACpB,UAAU,EACV,YAAY,EA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