@x-viewer/core 0.21.8 → 0.21.9
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/chunks/libredwg-web-CN6Seddu.js +9 -0
- package/dist/index.esm.js +964 -964
- package/dist/types/core/compare/BaseDxfCompareHelper.d.ts +7 -19
- package/dist/types/core/compare/DxfCompareHelper.d.ts +3 -7
- package/dist/types/core/model/Model2d.d.ts +1 -1
- package/dist/types/core/utils/CoordinateUtils.d.ts +3 -9
- package/dist/types/core/viewers/BaseViewer.d.ts +1 -2
- package/dist/types/core/viewers/Viewer2d.d.ts +19 -50
- package/package.json +1 -1
- package/dist/chunks/libredwg-web-C2alfoC2.js +0 -9
|
@@ -43,15 +43,9 @@ export declare class BaseDxfCompareHelper {
|
|
|
43
43
|
constructor(viewerCfg: Viewer2dConfig);
|
|
44
44
|
protected initSpinner(): void;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* @description {zh} 设置字体。
|
|
50
|
-
* 需要在加载dxf之前调用,不会影响已加载的文字。
|
|
51
|
-
* 支持shx或typeface格式。对于typeface,目前只支持传入1个字体文件。
|
|
52
|
-
* @param urls
|
|
53
|
-
* - {en} font file urls.
|
|
54
|
-
* - {zh} 字体文件链接。
|
|
46
|
+
* Loads fonts used when parsing DXF text. Call before loading a DXF; does not affect text that is already loaded.
|
|
47
|
+
* Supports SHX or typeface bundles; for typeface, only a single file in the array is supported for now.
|
|
48
|
+
* @param urls Font file URLs.
|
|
55
49
|
* @example
|
|
56
50
|
* ```typescript
|
|
57
51
|
* compareHelper.setFont(["https://example.com/xxx.shx"]);
|
|
@@ -68,11 +62,8 @@ export declare class BaseDxfCompareHelper {
|
|
|
68
62
|
*/
|
|
69
63
|
compare(modelCfg1: Model2dConfig, modelCfg2: Model2dConfig, compareCfg?: DxfCompareConfig, onProgress?: (event: ProgressEvent) => void): Promise<void>;
|
|
70
64
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @
|
|
73
|
-
* @returns
|
|
74
|
-
* - {en} Compare changes.
|
|
75
|
-
* - {zh} 对比变动列表。
|
|
65
|
+
* Returns the comparison diff (per-change records) from the last successful `compare`.
|
|
66
|
+
* @returns Compare changes keyed by id, or undefined if not yet compared.
|
|
76
67
|
* @example
|
|
77
68
|
* ``` typescript
|
|
78
69
|
* const changes = compareHelper.getChanges();
|
|
@@ -81,11 +72,8 @@ export declare class BaseDxfCompareHelper {
|
|
|
81
72
|
*/
|
|
82
73
|
getChanges(): Record<number, DxfChange> | undefined;
|
|
83
74
|
/**
|
|
84
|
-
*
|
|
85
|
-
* @
|
|
86
|
-
* @param changeId
|
|
87
|
-
* - {en} Change id, which is an incremental integer starts from 1.
|
|
88
|
-
* - {zh} 变动id,该id是从数字1开始自增的整数。
|
|
75
|
+
* Zooms the camera to the bounding box of a single compare change (with padding).
|
|
76
|
+
* @param changeId Change id: positive integer, starting at 1.
|
|
89
77
|
* @example
|
|
90
78
|
* ``` typescript
|
|
91
79
|
* const changeId = 1;
|
|
@@ -39,8 +39,7 @@ export declare class DxfCompareHelper extends BaseDxfCompareHelper {
|
|
|
39
39
|
constructor(viewerCfg1: Viewer2dConfig, viewerCfg2: Viewer2dConfig);
|
|
40
40
|
protected initSyncCameraEvent(): void;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @description {zh} 设置开启或关闭同步相机视角。
|
|
42
|
+
* Enables or disables synchronizing the two viewers' cameras when either one moves.
|
|
44
43
|
* @example
|
|
45
44
|
* ```typescript
|
|
46
45
|
* compareHelper.enableSyncCamera(true);
|
|
@@ -57,11 +56,8 @@ export declare class DxfCompareHelper extends BaseDxfCompareHelper {
|
|
|
57
56
|
*/
|
|
58
57
|
compare(modelCfg1: Model2dConfig, modelCfg2: Model2dConfig, compareCfg?: DxfCompareConfig, onProgress?: (event: ProgressEvent) => void): Promise<void>;
|
|
59
58
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @
|
|
62
|
-
* @param changeId
|
|
63
|
-
* - {en} Change id, which is an incremental integer starts from 1.
|
|
64
|
-
* - {zh} 变动id,该id是从数字1开始自增的整数。
|
|
59
|
+
* Zooms both viewers to the bounding box of one compare change (with padding).
|
|
60
|
+
* @param changeId Change id: positive integer starting at 1.
|
|
65
61
|
* @example
|
|
66
62
|
* ``` typescript
|
|
67
63
|
* const changeId = 1;
|
|
@@ -95,7 +95,7 @@ export declare class Model2d extends Model {
|
|
|
95
95
|
/**
|
|
96
96
|
* Sets layer visibility.
|
|
97
97
|
*/
|
|
98
|
-
setLayerVisible(layerName: string, visible: boolean,
|
|
98
|
+
setLayerVisible(layerName: string, visible: boolean, enableSmallFeatureCulling?: boolean, cameraZoom?: number): void;
|
|
99
99
|
/**
|
|
100
100
|
* Sets layer opacity.
|
|
101
101
|
*/
|
|
@@ -64,18 +64,12 @@ export declare class CoordinateUtils {
|
|
|
64
64
|
*/
|
|
65
65
|
static screen2World(vector: THREE.Vector2, camera: THREE.Camera, container: HTMLElement): THREE.Vector3;
|
|
66
66
|
/**
|
|
67
|
-
* Converts screen point to NDC
|
|
68
|
-
* @
|
|
69
|
-
* @description {zh} 标准化屏幕坐标:左下角(-1, -1), 右上角(1, 1)。
|
|
70
|
-
* @description {en} World coordinate to normalized screen coordinate(0-1).
|
|
71
|
-
* @description {zh} 世界坐标转标准化屏幕坐标(0-1)。
|
|
67
|
+
* Converts a screen pixel point to NDC: bottom-left (-1, -1), top-right (1, 1).
|
|
68
|
+
* (Related: {@link world2NormalizedScreen} maps world to 0–1 screen space.)
|
|
72
69
|
*/
|
|
73
70
|
static screen2Ndc(vector: THREE.Vector2, camera: THREE.Camera, container: HTMLElement): THREE.Vector2;
|
|
74
71
|
/**
|
|
75
|
-
*
|
|
76
|
-
* @description {zh} 标准化屏幕坐标:左上角(0, 0), 右下角(1, 1)。
|
|
77
|
-
* @description {en} World coordinate to normalized screen coordinate(0-1).
|
|
78
|
-
* @description {zh} 世界坐标转标准化屏幕坐标(0-1)。
|
|
72
|
+
* Maps a world point to normalized screen coordinates: top-left (0, 0), bottom-right (1, 1).
|
|
79
73
|
*/
|
|
80
74
|
static world2NormalizedScreen(worldCoord: THREE.Vector2 | THREE.Vector3, camera: THREE.Camera, container: HTMLElement): THREE.Vector2;
|
|
81
75
|
}
|
|
@@ -125,8 +125,7 @@ export declare abstract class BaseViewer<BaseViewerEvents extends ViewerEvents =
|
|
|
125
125
|
*/
|
|
126
126
|
getPixelSizeInWorldCoord(): number;
|
|
127
127
|
/**
|
|
128
|
-
*
|
|
129
|
-
* @description {zh} 询问用户选择一个框选区域,然后缩放到该区域。
|
|
128
|
+
* Lets the user box-select a region on screen, then zooms the camera to that region.
|
|
130
129
|
* @example
|
|
131
130
|
* ``` typescript
|
|
132
131
|
* viewer.zoomToRect();
|
|
@@ -166,23 +166,14 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
166
166
|
constructor(viewerCfg: Viewer2dConfig);
|
|
167
167
|
get camera(): THREE.OrthographicCamera;
|
|
168
168
|
/**
|
|
169
|
-
*
|
|
170
|
-
* The first loaded file
|
|
169
|
+
* Loads a DXF/DWG model.
|
|
170
|
+
* The first loaded file becomes the "master" model.
|
|
171
171
|
* Any other files are non-master, we call "overlay" model.
|
|
172
172
|
* We'll load everything of a master model, including model and paper space.
|
|
173
173
|
* For an overlay model, we'll only load its model space. And its model space can only
|
|
174
174
|
* overly to master model's model space.
|
|
175
|
-
* @
|
|
176
|
-
*
|
|
177
|
-
* 任何其他文件都是非主文件,我们称之为“叠加”模型。
|
|
178
|
-
* 我们将加载主模型的所有内容,包括模型和图纸空间。
|
|
179
|
-
* 对于叠加模型,我们只会加载其模型空间。并且它的模型空间只能叠加到主模型的模型空间上。
|
|
180
|
-
* @param modelCfg
|
|
181
|
-
* - {en} The configuration of the model to be loaded.
|
|
182
|
-
* - {zh} 要加载的模型的配置。
|
|
183
|
-
* @param onProgress
|
|
184
|
-
* - {en} A callback function to indicate the loading progress.
|
|
185
|
-
* - {zh} 用于指示加载进度的回调函数。
|
|
175
|
+
* @param modelCfg Configuration of the model to load.
|
|
176
|
+
* @param onProgress Optional callback for loading progress.
|
|
186
177
|
* @example
|
|
187
178
|
* ``` typescript
|
|
188
179
|
* const viewerCfg = {
|
|
@@ -228,11 +219,8 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
228
219
|
*/
|
|
229
220
|
getWorldPositionByMousePick(mousePosition: THREE.Vector2): THREE.Vector3 | undefined;
|
|
230
221
|
/**
|
|
231
|
-
*
|
|
232
|
-
* @
|
|
233
|
-
* @param layoutName
|
|
234
|
-
* - {en} The name of the layout to be activated.
|
|
235
|
-
* - {zh} 要激活的布局名称。
|
|
222
|
+
* Activates a layout tab (model or paper space).
|
|
223
|
+
* @param layoutName Layout name to activate.
|
|
236
224
|
* @example
|
|
237
225
|
* ```typescript
|
|
238
226
|
* viewer.activateLayout('Layout1');
|
|
@@ -258,10 +246,8 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
258
246
|
goToHomeView(): void;
|
|
259
247
|
zoomToBBox(bbox: THREE.Box3): void;
|
|
260
248
|
/**
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
* @description {zh} 获取当前视图范围。
|
|
264
|
-
* 用户可使用该接口获取当前视口范围,并在适当的场景下跳转到该视口范围。
|
|
249
|
+
* Returns the current view extent in world XY (from NDC corners).
|
|
250
|
+
* Useful to save as a viewpoint and restore the same framing later.
|
|
265
251
|
* @example
|
|
266
252
|
* ``` typescript
|
|
267
253
|
* const box = viewer.getCurrentViewExtent();
|
|
@@ -291,11 +277,7 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
291
277
|
*/
|
|
292
278
|
getHitResult(event: MouseEvent | PointerEvent | EventInfo): THREE.Vector2 | undefined;
|
|
293
279
|
/**
|
|
294
|
-
*
|
|
295
|
-
* @description {zh} 获取当前布局。
|
|
296
|
-
* @returns
|
|
297
|
-
* - {en} Active layout name or undefined.
|
|
298
|
-
* - {zh} 当前激活的布局名称或undefined。
|
|
280
|
+
* Returns the active layout name, or undefined if none.
|
|
299
281
|
* @example
|
|
300
282
|
* ``` typescript
|
|
301
283
|
* const activeLayout = viewer.getActiveLayoutName();
|
|
@@ -306,11 +288,7 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
306
288
|
zoomIn(step?: number): void;
|
|
307
289
|
zoomOut(step?: number): void;
|
|
308
290
|
/**
|
|
309
|
-
*
|
|
310
|
-
* @description {zh} 获取dxf图层。
|
|
311
|
-
* @returns
|
|
312
|
-
* - {en} Dxf layers.
|
|
313
|
-
* - {zh} dxf图层。
|
|
291
|
+
* Returns layer tables grouped by loaded model (master first, then overlays).
|
|
314
292
|
* @example
|
|
315
293
|
* ``` typescript
|
|
316
294
|
* const dxfLayers = viewer.getLayers();
|
|
@@ -329,20 +307,11 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
329
307
|
*/
|
|
330
308
|
setModelVisibility(modelId: string, visible: boolean): void;
|
|
331
309
|
/**
|
|
332
|
-
*
|
|
333
|
-
* @
|
|
334
|
-
* @param
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
* @param visible
|
|
338
|
-
* - {en} Layer's target visibility.
|
|
339
|
-
* - {zh} 图层的目标可见性。
|
|
340
|
-
* @param modelId
|
|
341
|
-
* - {en} Useful when more than one model is loaded, if not specified, will use the master model.
|
|
342
|
-
* - {zh} 当加载了多个模型时有用,如果未指定,将使用主模型。
|
|
343
|
-
* @throws Error
|
|
344
|
-
* - {en}: Throws exception if given modelId doesn't exist.
|
|
345
|
-
* - {zh} 如果给定的modelId不存在,则抛出异常。
|
|
310
|
+
* Sets visibility of a layer by name.
|
|
311
|
+
* @param layerName Layer to show or hide.
|
|
312
|
+
* @param visible Target visibility.
|
|
313
|
+
* @param modelId When multiple models are loaded, target model; defaults to the master model.
|
|
314
|
+
* @throws If `modelId` does not match any loaded model.
|
|
346
315
|
* @example
|
|
347
316
|
* ``` typescript
|
|
348
317
|
* // Hides layer "0"
|
|
@@ -367,11 +336,11 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
367
336
|
*/
|
|
368
337
|
resetLayerColor(layerName: string, modelId?: string): void;
|
|
369
338
|
/**
|
|
370
|
-
* Enables
|
|
339
|
+
* Enables small feature culling in order to improve performance.
|
|
371
340
|
*/
|
|
372
|
-
|
|
341
|
+
enableSmallFeatureCulling(enable: boolean): void;
|
|
373
342
|
/**
|
|
374
|
-
* If
|
|
343
|
+
* If small feature culling is enabled.
|
|
375
344
|
*/
|
|
376
|
-
|
|
345
|
+
isSmallFeatureCullingEnabled(): boolean;
|
|
377
346
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x-viewer/core",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.9",
|
|
4
4
|
"homepage": "https://dwg.thingraph.site/",
|
|
5
5
|
"description": "WebGL-based 2D/3D viewer engine built on Three.js. View DWG/DXF/PDF files in the browser with no server required. Supports glTF, OBJ, FBX, IFC, STL and BimTiles formats.",
|
|
6
6
|
"author": "thingraph",
|