You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
📝 Add docstrings to codex/implement-param-driven-3d-viewer
Docstrings generation was requested by @shayancoin.
* #456 (comment)
The following files were modified:
* `backend/api/routes_catalog.py`
* `backend/tests/test_routes_catalog.py`
* `frontend/src/app/components/Viewer3D.tsx`
* `frontend/src/app/configurator/page.tsx`
* `scripts/generate_reference_glbs.py`
* Marks a mesh source as having its LOD0 become visible shortly after it is mounted or changed.
69
+
*
70
+
* When `src` is provided in a browser environment, schedules a two-frame animation-frame delay, then
71
+
* records the current timestamp in a global Map at `window.__lod0VisibleAt` keyed by `src` and
72
+
* dispatches a `CustomEvent` named `"lod0:visible"` with `{ src, ts }` in `event.detail`. Cancels
73
+
* any pending animation frames when `src` changes or the component unmounts. No-op on the server.
74
+
*
75
+
* @param src - A string identifier or URL for the mesh whose LOD0 visibility should be recorded; if `null` nothing is scheduled
76
+
*/
67
77
functionuseLodVisibility(src: string|null){
68
78
useEffect(()=>{
69
79
if(typeofwindow==='undefined'||!src){
@@ -104,6 +114,15 @@ function useLodVisibility(src: string | null) {
104
114
},[src]);
105
115
}
106
116
117
+
/**
118
+
* Selects the primary manifest entry for a given variant id following priority rules.
119
+
*
120
+
* Searches the provided manifest for an entry whose `id` exactly matches `variantId`, then for an entry whose `variant` equals `variantId` and has `lod` undefined or `0`. If no exact or zero-LOD match is found, returns the first entry whose `variant` equals `variantId` (used as a fallback).
121
+
*
122
+
* @param manifest - Array of manifest entries to search
123
+
* @param variantId - Variant identifier to select the primary entry for
124
+
* @returns The chosen manifest entry for `variantId`, or `undefined` if none found
0 commit comments