@x-viewer/core 0.21.8 → 0.21.10
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-DUxwgT_X.js +9 -0
- package/dist/index.esm.js +964 -964
- package/dist/types/core/camera-controls/CameraControls.d.ts +1 -1
- package/dist/types/core/compare/BaseDxfCompareHelper.d.ts +7 -19
- package/dist/types/core/compare/DxfCompareHelper.d.ts +3 -7
- package/dist/types/core/controls/OrbitControls.d.ts +10 -0
- package/dist/types/core/dxf/DxfLoader.d.ts +2 -15
- package/dist/types/core/helpers/OSnapHelper.d.ts +1 -1
- package/dist/types/core/loaders/DaeLoader.d.ts +2 -2
- package/dist/types/core/loaders/DwgModelLoader.d.ts +45 -0
- package/dist/types/core/loaders/FbxLoader.d.ts +2 -2
- package/dist/types/core/loaders/GltfLoader.d.ts +2 -2
- package/dist/types/core/loaders/ModelLoaderManager.d.ts +17 -10
- package/dist/types/core/loaders/ObjLoader.d.ts +2 -2
- package/dist/types/core/loaders/PlyLoader.d.ts +2 -2
- package/dist/types/core/loaders/RasterLoader.d.ts +2 -2
- package/dist/types/core/loaders/StlLoader.d.ts +2 -2
- package/dist/types/core/loaders/index.d.ts +3 -3
- 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 -51
- package/package.json +1 -1
- package/dist/chunks/libredwg-web-C2alfoC2.js +0 -9
- package/dist/types/core/loaders/DxfModelLoader.d.ts +0 -21
- /package/dist/types/core/loaders/{ModelLoader.d.ts → BaseModelLoader.d.ts} +0 -0
|
@@ -310,7 +310,7 @@ export declare class CameraControls extends EventDispatcher {
|
|
|
310
310
|
* @category Properties
|
|
311
311
|
*/
|
|
312
312
|
get enabled(): boolean;
|
|
313
|
-
set enabled(
|
|
313
|
+
set enabled(enable: boolean);
|
|
314
314
|
/**
|
|
315
315
|
* Returns `true` if the controls are active updating.
|
|
316
316
|
* readonly value.
|
|
@@ -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;
|
|
@@ -6,7 +6,17 @@ import type { CameraManager } from "../../core/camera/CameraManager";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class OrbitControls implements BaseControls {
|
|
8
8
|
readonly mode = ControlsMode.Orbit;
|
|
9
|
+
private static readonly MIN_SCENE_SCALE;
|
|
10
|
+
private static readonly MAX_SCENE_SCALE;
|
|
11
|
+
private static readonly MIN_DOLLY_SPEED;
|
|
12
|
+
private static readonly MAX_DOLLY_SPEED;
|
|
13
|
+
private static readonly MIN_TRUCK_SPEED;
|
|
14
|
+
private static readonly MAX_TRUCK_SPEED;
|
|
15
|
+
private static readonly MIN_DISTANCE_FLOOR;
|
|
9
16
|
constructor(cameraManager: CameraManager);
|
|
10
17
|
setupControl(): void;
|
|
11
18
|
adjustCameraByBBox(box: THREE.Box3): void;
|
|
19
|
+
private applyAdaptiveNavigationSensitivity;
|
|
20
|
+
private computeScaleRatio;
|
|
21
|
+
private computeMinDistance;
|
|
12
22
|
}
|
|
@@ -262,19 +262,6 @@ export declare class DxfLoader extends THREE.Loader {
|
|
|
262
262
|
* Sets font.
|
|
263
263
|
*/
|
|
264
264
|
setFont(font: FontManager): void;
|
|
265
|
-
/**
|
|
266
|
-
* Loads a dxf file by given url.
|
|
267
|
-
* If dxfDataId is specified and local cache is enabled, it firstly tries to load from cache.
|
|
268
|
-
* @param url url of the dxf file
|
|
269
|
-
* @param dxfDataId target dxf data id, used to get dxf data from cache if local cache is enabled.
|
|
270
|
-
* @param onProgress on progress callback
|
|
271
|
-
* @returns DxfData
|
|
272
|
-
*/
|
|
273
|
-
loadAsyncEx(url: string, dxfDataId?: string, onProgress?: (event: ProgressEvent) => void): Promise<DxfData>;
|
|
274
|
-
/**
|
|
275
|
-
* Like {@link loadAsyncEx} but parses from in-memory bytes (DWG/DXF) instead of fetching a URL.
|
|
276
|
-
*/
|
|
277
|
-
loadAsyncExFromBuffer(data: ArrayBuffer | Uint8Array, dxfDataId?: string, onProgress?: (event: ProgressEvent) => void): Promise<DxfData>;
|
|
278
265
|
/**
|
|
279
266
|
* Loads dxf asynchronously. It mainly contains 2 steps:
|
|
280
267
|
* 1. Parses file content
|
|
@@ -282,11 +269,11 @@ export declare class DxfLoader extends THREE.Loader {
|
|
|
282
269
|
* @param url url of the dxf file
|
|
283
270
|
* @param onProgress on progress callback
|
|
284
271
|
*/
|
|
285
|
-
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<DxfData>;
|
|
272
|
+
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void, dxfDataId?: string): Promise<DxfData>;
|
|
286
273
|
/**
|
|
287
274
|
* Same as {@link loadAsync} but reads DWG/DXF from memory (no network).
|
|
288
275
|
*/
|
|
289
|
-
loadAsyncFromBuffer(data: ArrayBuffer | Uint8Array, onProgress?: (event: ProgressEvent) => void): Promise<DxfData>;
|
|
276
|
+
loadAsyncFromBuffer(data: ArrayBuffer | Uint8Array, onProgress?: (event: ProgressEvent) => void, dxfDataId?: string): Promise<DxfData>;
|
|
290
277
|
/**
|
|
291
278
|
* Parses dxf contents from given url.
|
|
292
279
|
*/
|
|
@@ -82,7 +82,7 @@ export declare class OSnapHelper {
|
|
|
82
82
|
/**
|
|
83
83
|
* Enables a specific OSnapType.
|
|
84
84
|
*/
|
|
85
|
-
setOSnapTypeEnabled(type: OSnapType,
|
|
85
|
+
setOSnapTypeEnabled(type: OSnapType, enable: boolean): void;
|
|
86
86
|
/**
|
|
87
87
|
* Sets snap tolerance in world coordinate.
|
|
88
88
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
|
-
import type { ModelLoadContext, ModelLoadFromBufferContext } from "./
|
|
3
|
-
import { BaseModelLoader } from "./
|
|
2
|
+
import type { ModelLoadContext, ModelLoadFromBufferContext } from "./BaseModelLoader";
|
|
3
|
+
import { BaseModelLoader } from "./BaseModelLoader";
|
|
4
4
|
export declare class DaeLoader extends BaseModelLoader {
|
|
5
5
|
private readonly manager?;
|
|
6
6
|
readonly id = "loader.builtin.dae";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type * as THREE from "three";
|
|
2
|
+
import { BaseModelLoader } from "./BaseModelLoader";
|
|
3
|
+
import type { ModelLoadContext, ModelLoadFromBufferContext } from "./BaseModelLoader";
|
|
4
|
+
import type { DxfData, DxfLoaderConfig } from "../../core/dxf";
|
|
5
|
+
import type { FontManager } from "../../core/font";
|
|
6
|
+
export interface DwgLoadContext extends ModelLoadContext {
|
|
7
|
+
readonly dxfDataId?: string;
|
|
8
|
+
readonly onLoad?: () => void;
|
|
9
|
+
readonly cfg?: DxfLoaderConfig;
|
|
10
|
+
}
|
|
11
|
+
export interface DwgLoadFromBufferContext extends ModelLoadFromBufferContext {
|
|
12
|
+
readonly dxfDataId?: string;
|
|
13
|
+
readonly onLoad?: () => void;
|
|
14
|
+
readonly cfg?: DxfLoaderConfig;
|
|
15
|
+
}
|
|
16
|
+
export declare class DwgModelLoader extends BaseModelLoader {
|
|
17
|
+
private readonly manager?;
|
|
18
|
+
readonly id = "loader.builtin.dwg";
|
|
19
|
+
readonly priority = 0;
|
|
20
|
+
readonly formats: readonly ["dxf", "dwg"];
|
|
21
|
+
private font?;
|
|
22
|
+
constructor(manager?: THREE.LoadingManager | undefined);
|
|
23
|
+
setFont(font?: FontManager): void;
|
|
24
|
+
/**
|
|
25
|
+
* This method returns a THREE.Object3D object.
|
|
26
|
+
* It can be used to load a dwg/dxf to Viewer3d (usually without paper space entities).
|
|
27
|
+
*/
|
|
28
|
+
load(ctx: ModelLoadContext): Promise<THREE.Object3D>;
|
|
29
|
+
/**
|
|
30
|
+
* This method returns a THREE.Object3D object.
|
|
31
|
+
* It can be used to load a dwg/dxf to Viewer3d (usually without paper space entities).
|
|
32
|
+
*/
|
|
33
|
+
loadFromBuffer(ctx: ModelLoadFromBufferContext): Promise<THREE.Object3D>;
|
|
34
|
+
/**
|
|
35
|
+
* This method returns a DxfData object.
|
|
36
|
+
* It can be used to load a dwg/dxf to Viewer2d, with paper space entities, layouts, layers, etc.
|
|
37
|
+
*/
|
|
38
|
+
loadEx(ctx: DwgLoadContext): Promise<DxfData>;
|
|
39
|
+
/**
|
|
40
|
+
* This method returns a DxfData object.
|
|
41
|
+
* It can be used to load a dwg/dxf to Viewer2d, with paper space entities, layouts, layers, etc.
|
|
42
|
+
*/
|
|
43
|
+
loadFromBufferEx(ctx: DwgLoadFromBufferContext): Promise<DxfData>;
|
|
44
|
+
private applyRequestHeader;
|
|
45
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
|
-
import type { ModelLoadContext, ModelLoadFromBufferContext } from "./
|
|
3
|
-
import { BaseModelLoader } from "./
|
|
2
|
+
import type { ModelLoadContext, ModelLoadFromBufferContext } from "./BaseModelLoader";
|
|
3
|
+
import { BaseModelLoader } from "./BaseModelLoader";
|
|
4
4
|
export declare class FbxLoader extends BaseModelLoader {
|
|
5
5
|
private readonly manager?;
|
|
6
6
|
readonly id = "loader.builtin.fbx";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
|
-
import type { ModelLoadContext, ModelLoadFromBufferContext } from "./
|
|
3
|
-
import { BaseModelLoader } from "./
|
|
2
|
+
import type { ModelLoadContext, ModelLoadFromBufferContext } from "./BaseModelLoader";
|
|
3
|
+
import { BaseModelLoader } from "./BaseModelLoader";
|
|
4
4
|
/**
|
|
5
5
|
* glTF / GLB model loader wrapping GLTFLoader, DRACO path, and progress handling.
|
|
6
6
|
*/
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
|
-
import type { BaseModelLoader } from "./
|
|
2
|
+
import type { BaseModelLoader } from "./BaseModelLoader";
|
|
3
3
|
import type { FontManager } from "../../core/font";
|
|
4
4
|
export declare class ModelLoaderManager {
|
|
5
|
-
private font?;
|
|
6
5
|
private manager?;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
private readonly extensionLoaders;
|
|
6
|
+
private font?;
|
|
7
|
+
/** Single loader registry (includes built-ins and plugin loaders). */
|
|
8
|
+
private readonly loaders;
|
|
11
9
|
constructor(manager?: THREE.LoadingManager);
|
|
12
10
|
register(loader: BaseModelLoader): void;
|
|
13
11
|
unregister(id: string): void;
|
|
14
12
|
private unregisterFromList;
|
|
15
|
-
private rebuildBuiltinLoaders;
|
|
16
|
-
private allLoaders;
|
|
17
13
|
/**
|
|
18
14
|
* Unique extension tokens from all registered loaders (extensions first, then built-ins), sorted.
|
|
19
15
|
*/
|
|
20
16
|
getSupportedModelFormats(): string[];
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
register2dBuiltinLoaders(): void;
|
|
18
|
+
register3dBuiltinLoaders(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Gets the resolved loader for a format token (e.g. `dxf`, `dwg`, `glb`).
|
|
21
|
+
*/
|
|
22
|
+
private getLoaderByFormat;
|
|
23
|
+
/**
|
|
24
|
+
* Gets the loader with the given id.
|
|
25
|
+
*/
|
|
26
|
+
getLoaderById(id: string): BaseModelLoader | undefined;
|
|
23
27
|
private computeUrlModelFormat;
|
|
24
28
|
private loadModelInternal;
|
|
25
29
|
private loadModelFromBufferInternal;
|
|
@@ -29,5 +33,8 @@ export declare class ModelLoaderManager {
|
|
|
29
33
|
[header: string]: string;
|
|
30
34
|
}): Promise<THREE.Object3D | void>;
|
|
31
35
|
loadModelFromBuffer(data: ArrayBuffer | Uint8Array, fileFormat: string, onProgress?: (event: ProgressEvent) => void): Promise<THREE.Object3D | void>;
|
|
36
|
+
/**
|
|
37
|
+
* For dwg/dxf, we need to set font first.
|
|
38
|
+
*/
|
|
32
39
|
setFont(font: FontManager): void;
|
|
33
40
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
|
-
import type { ModelLoadFromBufferContext, ObjLoadContext } from "./
|
|
3
|
-
import { BaseModelLoader } from "./
|
|
2
|
+
import type { ModelLoadFromBufferContext, ObjLoadContext } from "./BaseModelLoader";
|
|
3
|
+
import { BaseModelLoader } from "./BaseModelLoader";
|
|
4
4
|
export declare class ObjLoader extends BaseModelLoader {
|
|
5
5
|
private readonly manager?;
|
|
6
6
|
readonly id = "loader.builtin.obj";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
|
-
import type { ModelLoadContext, ModelLoadFromBufferContext } from "./
|
|
3
|
-
import { BaseModelLoader } from "./
|
|
2
|
+
import type { ModelLoadContext, ModelLoadFromBufferContext } from "./BaseModelLoader";
|
|
3
|
+
import { BaseModelLoader } from "./BaseModelLoader";
|
|
4
4
|
export declare class PlyLoader extends BaseModelLoader {
|
|
5
5
|
private readonly manager?;
|
|
6
6
|
readonly id = "loader.builtin.ply";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
|
-
import type { ModelLoadContext, ModelLoadFromBufferContext } from "./
|
|
3
|
-
import { BaseModelLoader } from "./
|
|
2
|
+
import type { ModelLoadContext, ModelLoadFromBufferContext } from "./BaseModelLoader";
|
|
3
|
+
import { BaseModelLoader } from "./BaseModelLoader";
|
|
4
4
|
export declare class RasterLoader extends BaseModelLoader {
|
|
5
5
|
private readonly manager?;
|
|
6
6
|
readonly id = "loader.builtin.raster";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
|
-
import type { ModelLoadContext, ModelLoadFromBufferContext } from "./
|
|
3
|
-
import { BaseModelLoader } from "./
|
|
2
|
+
import type { ModelLoadContext, ModelLoadFromBufferContext } from "./BaseModelLoader";
|
|
3
|
+
import { BaseModelLoader } from "./BaseModelLoader";
|
|
4
4
|
export declare class StlLoader extends BaseModelLoader {
|
|
5
5
|
private readonly manager?;
|
|
6
6
|
readonly id = "loader.builtin.stl";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { BaseModelLoader } from "./
|
|
2
|
-
export type { ModelLoadContext, ModelLoadFromBufferContext, ObjLoadContext } from "./
|
|
1
|
+
export { BaseModelLoader } from "./BaseModelLoader";
|
|
2
|
+
export type { ModelLoadContext, ModelLoadFromBufferContext, ObjLoadContext } from "./BaseModelLoader";
|
|
3
3
|
export { ModelLoaderManager } from "./ModelLoaderManager";
|
|
4
4
|
export { DaeLoader } from "./DaeLoader";
|
|
5
|
-
export {
|
|
5
|
+
export { DwgModelLoader } from "./DwgModelLoader";
|
|
6
6
|
export { FbxLoader } from "./FbxLoader";
|
|
7
7
|
export { GltfLoader } from "./GltfLoader";
|
|
8
8
|
export { ObjLoader } from "./ObjLoader";
|
|
@@ -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 = {
|
|
@@ -209,7 +200,6 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
209
200
|
*/
|
|
210
201
|
parseFile(modelCfg: Model2dConfig, onProgress?: ((event: ProgressEvent<EventTarget>) => void) | undefined): Promise<DxfData>;
|
|
211
202
|
addModel(model: Model2d): void;
|
|
212
|
-
private createDxfModelLoader;
|
|
213
203
|
setObjectHighlight(object: THREE.Object3D): void;
|
|
214
204
|
setObjectUnHighlight(object: THREE.Object3D): void;
|
|
215
205
|
clearHighlight(): void;
|
|
@@ -228,11 +218,8 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
228
218
|
*/
|
|
229
219
|
getWorldPositionByMousePick(mousePosition: THREE.Vector2): THREE.Vector3 | undefined;
|
|
230
220
|
/**
|
|
231
|
-
*
|
|
232
|
-
* @
|
|
233
|
-
* @param layoutName
|
|
234
|
-
* - {en} The name of the layout to be activated.
|
|
235
|
-
* - {zh} 要激活的布局名称。
|
|
221
|
+
* Activates a layout tab (model or paper space).
|
|
222
|
+
* @param layoutName Layout name to activate.
|
|
236
223
|
* @example
|
|
237
224
|
* ```typescript
|
|
238
225
|
* viewer.activateLayout('Layout1');
|
|
@@ -258,10 +245,8 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
258
245
|
goToHomeView(): void;
|
|
259
246
|
zoomToBBox(bbox: THREE.Box3): void;
|
|
260
247
|
/**
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
* @description {zh} 获取当前视图范围。
|
|
264
|
-
* 用户可使用该接口获取当前视口范围,并在适当的场景下跳转到该视口范围。
|
|
248
|
+
* Returns the current view extent in world XY (from NDC corners).
|
|
249
|
+
* Useful to save as a viewpoint and restore the same framing later.
|
|
265
250
|
* @example
|
|
266
251
|
* ``` typescript
|
|
267
252
|
* const box = viewer.getCurrentViewExtent();
|
|
@@ -291,11 +276,7 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
291
276
|
*/
|
|
292
277
|
getHitResult(event: MouseEvent | PointerEvent | EventInfo): THREE.Vector2 | undefined;
|
|
293
278
|
/**
|
|
294
|
-
*
|
|
295
|
-
* @description {zh} 获取当前布局。
|
|
296
|
-
* @returns
|
|
297
|
-
* - {en} Active layout name or undefined.
|
|
298
|
-
* - {zh} 当前激活的布局名称或undefined。
|
|
279
|
+
* Returns the active layout name, or undefined if none.
|
|
299
280
|
* @example
|
|
300
281
|
* ``` typescript
|
|
301
282
|
* const activeLayout = viewer.getActiveLayoutName();
|
|
@@ -306,11 +287,7 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
306
287
|
zoomIn(step?: number): void;
|
|
307
288
|
zoomOut(step?: number): void;
|
|
308
289
|
/**
|
|
309
|
-
*
|
|
310
|
-
* @description {zh} 获取dxf图层。
|
|
311
|
-
* @returns
|
|
312
|
-
* - {en} Dxf layers.
|
|
313
|
-
* - {zh} dxf图层。
|
|
290
|
+
* Returns layer tables grouped by loaded model (master first, then overlays).
|
|
314
291
|
* @example
|
|
315
292
|
* ``` typescript
|
|
316
293
|
* const dxfLayers = viewer.getLayers();
|
|
@@ -329,20 +306,11 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
329
306
|
*/
|
|
330
307
|
setModelVisibility(modelId: string, visible: boolean): void;
|
|
331
308
|
/**
|
|
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不存在,则抛出异常。
|
|
309
|
+
* Sets visibility of a layer by name.
|
|
310
|
+
* @param layerName Layer to show or hide.
|
|
311
|
+
* @param visible Target visibility.
|
|
312
|
+
* @param modelId When multiple models are loaded, target model; defaults to the master model.
|
|
313
|
+
* @throws If `modelId` does not match any loaded model.
|
|
346
314
|
* @example
|
|
347
315
|
* ``` typescript
|
|
348
316
|
* // Hides layer "0"
|
|
@@ -367,11 +335,11 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
367
335
|
*/
|
|
368
336
|
resetLayerColor(layerName: string, modelId?: string): void;
|
|
369
337
|
/**
|
|
370
|
-
* Enables
|
|
338
|
+
* Enables small feature culling in order to improve performance.
|
|
371
339
|
*/
|
|
372
|
-
|
|
340
|
+
enableSmallFeatureCulling(enable: boolean): void;
|
|
373
341
|
/**
|
|
374
|
-
* If
|
|
342
|
+
* If small feature culling is enabled.
|
|
375
343
|
*/
|
|
376
|
-
|
|
344
|
+
isSmallFeatureCullingEnabled(): boolean;
|
|
377
345
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x-viewer/core",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.10",
|
|
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",
|