triiiceratops 0.16.5 → 0.16.6

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.
@@ -349,6 +349,24 @@
349
349
  container.style.opacity = isVisible ? '1' : '0';
350
350
  }
351
351
 
352
+ function revealViewerImageAfterFirstRender(capturedKey: string) {
353
+ if (!viewer) return;
354
+
355
+ const reveal = () => {
356
+ if (capturedKey !== lastTileSourceStr) return;
357
+ setViewerImageVisible(true);
358
+ };
359
+
360
+ // WebGLDrawer in OSD 5 rejects tile-drawn/tile-drawing handlers.
361
+ const drawerType = viewer.drawer?.getType?.();
362
+ if (drawerType === 'webgl') {
363
+ viewer.addOnceHandler('open', reveal);
364
+ return;
365
+ }
366
+
367
+ viewer.addOnceHandler('tile-drawn', reveal);
368
+ }
369
+
352
370
  // Pre-fetch info.json URLs to detect 401 auth errors before passing to OSD
353
371
  async function resolveTileSources(
354
372
  sources: any[],
@@ -444,10 +462,7 @@
444
462
 
445
463
  // Hide the previous image immediately; reveal once new tiles are drawn.
446
464
  setViewerImageVisible(false);
447
- viewer.addOnceHandler('tile-drawn', () => {
448
- if (capturedKey !== lastTileSourceStr) return;
449
- setViewerImageVisible(true);
450
- });
465
+ revealViewerImageAfterFirstRender(capturedKey);
451
466
 
452
467
  if (mode === 'continuous') {
453
468
  // Remove current world immediately so stale canvases are not shown