@x-viewer/core 0.21.9 → 0.21.11
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-Dr5l5_Db.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/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/viewers/Viewer2d.d.ts +0 -1
- package/package.json +1 -1
- package/dist/chunks/libredwg-web-CN6Seddu.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.
|
|
@@ -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";
|
|
@@ -200,7 +200,6 @@ export declare class Viewer2d extends BaseViewer {
|
|
|
200
200
|
*/
|
|
201
201
|
parseFile(modelCfg: Model2dConfig, onProgress?: ((event: ProgressEvent<EventTarget>) => void) | undefined): Promise<DxfData>;
|
|
202
202
|
addModel(model: Model2d): void;
|
|
203
|
-
private createDxfModelLoader;
|
|
204
203
|
setObjectHighlight(object: THREE.Object3D): void;
|
|
205
204
|
setObjectUnHighlight(object: THREE.Object3D): void;
|
|
206
205
|
clearHighlight(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x-viewer/core",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.11",
|
|
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",
|