Sea Select: drawn-slot reopen after refresh + FLIP polarity-tinted back — TDD
- fix: drawn spread slots silently no-op'd on click AFTER a refresh — SeaDeal's in-memory `_seaHand` is only populated by openStage/register during the live session, so a reload left it empty + the overlay click handler short-circuited (`if (!_seaHand[pos]) return`). `_sea_overlay.html` now re-seeds `_seaHand` from the server-rendered saved slots once the deck fetch resolves (cards looked up by `data-card-id`; reversed/polarity DOM-sourced) — the same fix my_sea already carries - FLIP card-back: the sea stage now renders the deck back-img for ANY image- equipped deck w. a back image (dropped the `not is_polarized` gate — it omitted the back for the room's polarized Gravity/Levity draw, so FLIP no-op'd). The back-art is identical across polarities, so `_card-deck.scss` tints the FLIPped card by the drawn polarity: gravity --quiUser fill @ 0.3 + --quaUser border; levity --terUser fill @ 0.3 + --ninUser border (scoped to `.sea-stage--*`, so my_sign / applet stages are untouched) - IT: an image-deck sea stage renders `.sig-stage-card-back-img` Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -407,8 +407,34 @@ Each draw persists onto the seat's Character.celtic_cross via epic:sea_save.
|
||||
var pickSeaBtn = document.getElementById('id_pick_sea_btn');
|
||||
if (pickSeaBtn) pickSeaBtn.addEventListener('click', openSea);
|
||||
|
||||
// ── Init — seed deck, restore saved-hand state, draw labels.
|
||||
_fetchDeck();
|
||||
// Re-seed SeaDeal's `_seaHand` from the server-rendered saved slots so they
|
||||
// stay clickable to RE-OPEN the stage after a refresh. Without this, SeaDeal's
|
||||
// in-memory `_seaHand` is only populated by openStage/register during the live
|
||||
// session → after a reload the overlay click handler short-circuits on
|
||||
// `if (!_seaHand[pos]) return` and the saved slots silently no-op (user-reported
|
||||
// 2026-06-07; same fix my_sea carries). The card payloads come from the deck
|
||||
// fetch (looked up by `data-card-id`); `reversed`/polarity are DOM-sourced.
|
||||
function _seedSavedHand() {
|
||||
if (!window.SeaDeal || !window.SeaDeal.seedHand) return;
|
||||
var byId = {};
|
||||
_levityPile.concat(_gravityPile).forEach(function (c) { byId[c.id] = c; });
|
||||
var seed = {};
|
||||
cross.querySelectorAll('.sea-card-slot.sea-card-slot--filled').forEach(function (slot) {
|
||||
var posName = slot.dataset.posKey;
|
||||
var card = byId[parseInt(slot.dataset.cardId, 10)];
|
||||
if (!posName || !card) return;
|
||||
var slotCard = {};
|
||||
for (var k in card) if (Object.prototype.hasOwnProperty.call(card, k)) slotCard[k] = card[k];
|
||||
slotCard.reversed = slot.classList.contains('sea-card-slot--reversed');
|
||||
seed[posName] = { card: slotCard, isLevity: slot.classList.contains('sea-card-slot--levity') };
|
||||
});
|
||||
SeaDeal.seedHand(seed);
|
||||
}
|
||||
|
||||
// ── Init — bind SeaDeal to the (possibly injected) overlay, seed the deck,
|
||||
// then re-seed the saved hand once the deck fetch resolves.
|
||||
if (window.SeaDeal && window.SeaDeal.reinit) SeaDeal.reinit();
|
||||
_fetchDeck().then(_seedSavedHand);
|
||||
_filled = cross.querySelectorAll('.sea-card-slot.sea-card-slot--filled').length;
|
||||
// Already-drawn sea hand → "in Sea Select or beyond" (user-spec 2026-06-07,
|
||||
// condition 3): mark sea-entered on load so the sky-saved glow stays muted
|
||||
@@ -417,10 +443,6 @@ Each draw persists onto the seat's Character.celtic_cross via epic:sea_save.
|
||||
if (_filled >= _currentOrder().length) { _setComplete(true); _lockSpread(); _setHasDrawn(true); }
|
||||
else if (_filled > 0) { _lockSpread(); _setHasDrawn(true); }
|
||||
syncLabels(hidden.value);
|
||||
|
||||
// Re-seed SeaDeal's _seaHand from server-rendered saved slots so they stay
|
||||
// clickable to re-open the stage. (Card payloads come from the deck fetch.)
|
||||
if (window.SeaDeal && window.SeaDeal.reinit) SeaDeal.reinit();
|
||||
}());
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user