Update viewer.js
Browse files
viewer.js
CHANGED
|
@@ -159,11 +159,30 @@ export async function initializeViewer(config, instanceId) {
|
|
| 159 |
// Use Script B's robust camera reset logic after everything is ready
|
| 160 |
app.once('update', () => resetViewerCamera());
|
| 161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
viewerInitialized = true;
|
| 163 |
});
|
| 164 |
}
|
| 165 |
|
| 166 |
-
// --------- This is the only modification (Script B logic) ---------
|
| 167 |
export function resetViewerCamera() {
|
| 168 |
try {
|
| 169 |
if (!cameraEntity || !modelEntity || !app) return;
|
|
|
|
| 159 |
// Use Script B's robust camera reset logic after everything is ready
|
| 160 |
app.once('update', () => resetViewerCamera());
|
| 161 |
|
| 162 |
+
// --- Tooltips functionality from Script B ---
|
| 163 |
+
try {
|
| 164 |
+
if (config.tooltips_url) {
|
| 165 |
+
import('./tooltips.js').then(tooltipsModule => {
|
| 166 |
+
tooltipsModule.initializeTooltips({
|
| 167 |
+
app,
|
| 168 |
+
cameraEntity,
|
| 169 |
+
modelEntity,
|
| 170 |
+
tooltipsUrl: config.tooltips_url,
|
| 171 |
+
defaultVisible: !!config.showTooltipsDefault,
|
| 172 |
+
moveDuration: config.tooltipMoveDuration || 0.6
|
| 173 |
+
});
|
| 174 |
+
}).catch(e => {
|
| 175 |
+
// Tooltips optional: fail silently if missing
|
| 176 |
+
});
|
| 177 |
+
}
|
| 178 |
+
} catch (e) {
|
| 179 |
+
// Tooltips optional, fail silently
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
viewerInitialized = true;
|
| 183 |
});
|
| 184 |
}
|
| 185 |
|
|
|
|
| 186 |
export function resetViewerCamera() {
|
| 187 |
try {
|
| 188 |
if (!cameraEntity || !modelEntity || !app) return;
|