@nebula-spatial/viewer 0.2.0 → 0.2.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to this package are documented in this file.
4
4
 
5
+ ## 0.2.2
6
+
7
+ - Refreshed selected INSERT details and overlays when incremental CAD content expands their bounding boxes.
8
+
9
+ ## 0.2.1
10
+
11
+ - Resolved the geometry preparation Worker from the published package instead of the site root.
12
+ - Added `CadOpenOptions.workerUrl` and `workerFactory` for custom Worker hosting.
13
+ - Use the built-in room environment by default and support external HDR URLs through `ViewerOptions.environment`.
14
+
5
15
  ## 0.2.0
6
16
 
7
17
  - Added `viewer.cad` for opening, closing, and observing CAD documents.
package/README.md CHANGED
@@ -28,6 +28,27 @@ await viewer.cad.open('/api/files/demo/result', {
28
28
  viewer.dispose();
29
29
  ```
30
30
 
31
+ Viewer 默认使用 Three.js 内置 `RoomEnvironment` 提供基于图像的环境光,不会替换场景背景。
32
+ 外部系统也可以传入自己的等距柱状 HDR URL:
33
+
34
+ ```ts
35
+ const viewer = createViewer({
36
+ viewport,
37
+ canvas,
38
+ environment: {
39
+ type: 'hdr',
40
+ url: 'https://static.example.com/environments/studio.hdr',
41
+ },
42
+ });
43
+ ```
44
+
45
+ HDR 资源由浏览器直接请求,因此资源服务器需要允许当前应用域名进行 CORS 访问。Viewer
46
+ 销毁时会释放已经加载的环境纹理;加载失败时保留原场景背景并在控制台输出警告。
47
+
48
+ 几何准备 Worker 默认从 Viewer npm 包内的相对资源路径加载,支持应用部署在子路径。
49
+ 需要自行托管 Worker 或满足特定 CSP 时,可通过 `CadOpenOptions.workerUrl` 或
50
+ `workerFactory` 覆盖 Worker 创建方式。
51
+
31
52
  `CadLoadSource` 支持 URL、`ArrayBuffer`、`File` 及对应的 `{ kind: ... }` 形式。`open()`
32
53
  会替换当前 CAD 文档;调用 `viewer.cad.close()` 可仅关闭文档并保留 Viewer。
33
54
 
@@ -57,6 +57,10 @@ export interface CadOpenOptions {
57
57
  documentKey?: string;
58
58
  filename?: string;
59
59
  loadAnnotations?: boolean;
60
+ /** Override the package-relative geometry preparation Worker URL. */
61
+ workerUrl?: string | URL;
62
+ /** Create the geometry preparation Worker. Takes precedence over `workerUrl`. */
63
+ workerFactory?: () => Worker;
60
64
  fontResolver?: CadFontResolver;
61
65
  resolveTextFont?: ResolveTextFont;
62
66
  /**
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { createViewer } from './viewer';
2
- export type { CadBlockModel, CadDocumentHandle, CadFontResolver, CadResolvedTextFont, CadHudModel, CadInspectorModel, CadLayerModel, CadLoadSource, CadOpenOptions, CadTextDetails, CadTextSelection, CadTextSelectionId, CadViewerCapability, ResolveTextFont, CadViewerEventMap, CameraStateStore, Viewer, ViewerEventMap, ViewerFitViewOptions, ViewerHighlightOptions, ViewerOptions, ViewerPickOptions, ViewerPickResult, ViewerPointerEvent, ViewerUiOptions, ViewerUiParts, ViewerUiPreset, ViewerUiTheme, ViewerViewMode, } from './types';
2
+ export type { CadBlockModel, CadDocumentHandle, CadFontResolver, CadResolvedTextFont, CadHudModel, CadInspectorModel, CadLayerModel, CadLoadSource, CadOpenOptions, CadTextDetails, CadTextSelection, CadTextSelectionId, CadViewerCapability, ResolveTextFont, CadViewerEventMap, CameraStateStore, Viewer, ViewerEventMap, ViewerEnvironment, ViewerFitViewOptions, ViewerHighlightOptions, ViewerOptions, ViewerPickOptions, ViewerPickResult, ViewerPointerEvent, ViewerUiOptions, ViewerUiParts, ViewerUiPreset, ViewerUiTheme, ViewerViewMode, } from './types';