Fix: StripOverlayLayer initialization timing - proper architecture

Resolved the 'ScryingPoolStrip not found, appending to body' warning by
restructuring the initialization flow:

1. ScryingPoolStrip now creates its own StripOverlayLayer lazily via getter
2. ScryingPoolStrip.stripOverlayLayer returns the layer instance
3. ConfirmationBar accepts ScryingPoolStrip/RoleRenderer and extracts stripOverlayLayer
4. RoleRenderer exposes public .strip getter for ScryingPoolStrip access
5. All components only initialized for GM users (where ScryingPoolStrip exists)

This ensures:
- StripOverlayLayer is created AFTER ScryingPoolStrip DOM element exists
- ConfirmationBar renders correctly positioned within the strip
- No fallback to document.body needed
- Proper separation of concerns (strip owns its overlay layer)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-05-24 00:56:19 +02:00
parent a06e504183
commit 6f07e48e54
4 changed files with 45 additions and 10 deletions
+2 -6
View File
@@ -232,13 +232,9 @@ Hooks.once("ready", () => {
if (adapter.users.isGM() && game.webrtc !== null) {
roleRenderer.openStrip();
// Story 3.2: Create StripOverlayLayer AFTER ScryingPoolStrip is created
// (ScryingPoolStrip is created lazily in roleRenderer.openStrip() above)
stripOverlayLayer = new StripOverlayLayer(adapter);
stripOverlayLayer.init();
// Story 3.2: Create ConfirmationBar for preset apply feedback (GM only)
confirmationBar = new ConfirmationBar(adapter, visibilityManager, socketHandler, stripOverlayLayer);
// Pass roleRenderer to access ScryingPoolStrip.stripOverlayLayer (created lazily)
confirmationBar = new ConfirmationBar(adapter, visibilityManager, socketHandler, roleRenderer);
confirmationBar.init();
}