@tscircuit/3d-viewer 0.0.628 → 0.0.629
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/README.md +24 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1198 -934
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -305,3 +305,27 @@ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) f
|
|
|
305
305
|
## License
|
|
306
306
|
|
|
307
307
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
308
|
+
|
|
309
|
+
### Pre-rendered GLB scenes
|
|
310
|
+
|
|
311
|
+
To open a self-contained GLB produced by `circuit-json-to-gltf` without rebuilding
|
|
312
|
+
board geometry or fetching component models:
|
|
313
|
+
|
|
314
|
+
```tsx
|
|
315
|
+
<CadViewer glbUrl="/previews/board.glb" />
|
|
316
|
+
// Or use bytes already available in memory:
|
|
317
|
+
<CadViewer glbData={arrayBuffer} />
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Supply one GLB source. It takes precedence over `circuitJson` and JSX children.
|
|
321
|
+
The viewer restores the exporter's coordinate frame (+Y up, mm) to the normal
|
|
322
|
+
viewer frame (+Z up, mm), fits the camera, and retains orbit controls and camera
|
|
323
|
+
presets. Failed loads display an error; replacing a source cancels the previous
|
|
324
|
+
load and disposes its geometry, materials, and textures.
|
|
325
|
+
|
|
326
|
+
New exports carry lightweight identity in each component node's
|
|
327
|
+
`extras.tscircuit`: `componentName`, `cad_component_id`, `source_component_id`,
|
|
328
|
+
and `pcb_component_id` (when available). These support name tooltips, hiding
|
|
329
|
+
individual components, and `onViewSchematicComponent` without supplying Circuit
|
|
330
|
+
JSON. Existing GLBs without metadata still render. Board layers, folding, and
|
|
331
|
+
model appearance are baked into the GLB; regenerate it to change them.
|
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,10 @@ declare const CadViewerJscad: React$1.ForwardRefExoticComponent<Props & {
|
|
|
49
49
|
|
|
50
50
|
type CadViewerProps = Omit<React.ComponentProps<typeof CadViewerJscad>, "circuitJson" | "hiddenCadComponentIds"> & {
|
|
51
51
|
circuitJson?: any[];
|
|
52
|
+
/** Pre-rendered circuit-json-to-gltf GLB URL. Bypasses geometry/model generation. */
|
|
53
|
+
glbUrl?: string;
|
|
54
|
+
/** In-memory alternative to glbUrl. Supply only one GLB source. */
|
|
55
|
+
glbData?: ArrayBuffer;
|
|
52
56
|
foldPcbs?: boolean;
|
|
53
57
|
/** Enable right-click navigation using the same identity as the PCB viewer. */
|
|
54
58
|
onViewSchematicComponent?: (event: ViewSchematicComponentEvent) => void;
|