@nebula-spatial/viewer 0.2.3 → 0.2.4

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,12 @@
2
2
 
3
3
  All notable changes to this package are documented in this file.
4
4
 
5
+ ## 0.2.4
6
+
7
+ - Keep `@nebula-spatial/cad-loader` as an external runtime dependency so compatible loader updates can be installed independently.
8
+ - Expose `configureViewerText()` as the explicit global Troika text-builder initialization entry point.
9
+ - Render staged external CAD block batches as they become available while preserving active downloads during interaction.
10
+
5
11
  ## 0.2.3
6
12
 
7
13
  - Start rendering base CAD geometry before external block sidecars finish loading.
package/README.md CHANGED
@@ -45,6 +45,23 @@ const viewer = createViewer({
45
45
  HDR 资源由浏览器直接请求,因此资源服务器需要允许当前应用域名进行 CORS 访问。Viewer
46
46
  销毁时会释放已经加载的环境纹理;加载失败时保留原场景背景并在控制台输出警告。
47
47
 
48
+ 如果业务需要调整 CAD 文字构建参数,应在第一次文字请求前调用全局初始化入口:
49
+
50
+ ```ts
51
+ import { configureViewerText, createViewer } from '@nebula-spatial/viewer';
52
+
53
+ configureViewerText({
54
+ defaultFontURL: '/fonts/cad-fallback.ttf',
55
+ useWorker: true,
56
+ sdfGlyphSize: 64,
57
+ textureWidth: 2048,
58
+ });
59
+ ```
60
+
61
+ `configureViewerText()` 配置的是 Viewer 内部 `cad-loader` 使用的 Troika 模块实例,沿用
62
+ Troika 全局、模块级、一次性配置语义。字体资源和 `resolveTextFont` 映射策略由业务提供;
63
+ 如果不调用该方法,Viewer 不会注入额外默认值,Troika 的原有行为保持不变。
64
+
48
65
  几何准备 Worker 默认从 Viewer npm 包内的相对资源路径加载,支持应用部署在子路径。
49
66
  需要自行托管 Worker 或满足特定 CSP 时,可通过 `CadOpenOptions.workerUrl` 或
50
67
  `workerFactory` 覆盖 Worker 创建方式。
@@ -61,6 +78,9 @@ HDR 资源由浏览器直接请求,因此资源服务器需要允许当前应
61
78
  - `inspector`:当前 CAD INSERT 或文本选择。
62
79
  - `hud`:视图与渲染统计。
63
80
 
81
+ CAD 文档的外部 block sidecar 按初始视口需求并行加载,并在首批资源就绪后渐进呈现;后续批次
82
+ 会在不打断交互的情况下追加到当前文档。
83
+
64
84
  可选的 `ui` 配置会挂载 `cad-readonly` 预设 UI;产品层也可以完全自行呈现这些模型。
65
85
 
66
86
  ## 通用 Three.js 对象
@@ -0,0 +1,2 @@
1
+ export { configureCadTextBuilder as configureViewerText, } from '@nebula-spatial/cad-loader';
2
+ export type { CadTextBuilderOptions as ViewerTextBuilderOptions, } from '@nebula-spatial/cad-loader';
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export { createViewer } from './viewer';
2
+ export { configureViewerText } from './cad/text';
3
+ export type { ViewerTextBuilderOptions } from './cad/text';
2
4
  export type { CadBlockModel, CadDocumentHandle, CadFontResolver, CadResolvedTextFont, CadHudModel, CadInspectorModel, CadLayerModel, CadLoadSource, CadOpenOptions, CadSessionLoadTiming, CadTextDetails, CadTextSelection, CadTextSelectionId, CadViewerCapability, ResolveTextFont, CadViewerEventMap, CameraStateStore, Viewer, ViewerEventMap, ViewerEnvironment, ViewerFitViewOptions, ViewerHighlightOptions, ViewerOptions, ViewerPickOptions, ViewerPickResult, ViewerPointerEvent, ViewerUiOptions, ViewerUiParts, ViewerUiPreset, ViewerUiTheme, ViewerViewMode, } from './types';