Files
gods-eye-view/src/scenes/playbackAdapter.js
T
Meir Michanie 284c4d4601 feat(i18n): presentation extraction — t() call sites, data-i18n templates, locale selector
Route every application-owned presentation string through the i18n
core: t() call sites across the app/layers/ui/data/voice surfaces,
data-i18n* attributes in the src/ui/templates/*.html markup (applied at
boot by applyDocumentTranslations from src/standalone/application.js),
and the dock locale selector (runtime-rendered from the offered pair —
a single EN button while only English ships).

Rebased onto current main, where the extraction follows the module
splits: the shell wiring now lands in the owner modules
(panelChrome, visualSettings, locationNavigation, shareRestoration,
shellFeedback, applicationShell) and the voice status corpus in the
realtime* modules; scene status lives in director.js +
playbackAdapter.js.

Modules shared with the node runtime (loadingFeedback,
installationFeedback, regionalModel, keySetupCore, vessels ingestion)
stay environment-neutral English and localize at their browser render
sites (chip maps in shellFeedback/installations controls, the weather
table in cockpitBriefing, keySetupRequirementEnvVars compositions), so
the package-boundary graph stays clean; the browser boundary groups
now own the i18n modules they reach (scripts/package-boundaries.json).
2026-10-01 12:41:20 +02:00

86 lines
2.8 KiB
JavaScript

/** Connect the portable Director runner to the existing scene presentation. */
import { t } from '../i18n/index.js';
export function createScenePlaybackAdapter(director, defaultShotDurationSec) {
let timing;
let travel;
return {
async releaseScene(scene, token) {
const released = await director._releaseSceneLayers(scene, token);
if (!token || released) director._loadedSceneId = null;
return released;
},
selectShot({ scene, shot, index, total }) {
director._selectedSceneId = scene.id;
director._selectedShotId = shot.id;
director._renderSceneSelect();
director._renderShotList();
director._updateStatus(
t('setup.scenes.status.runningShot', {
index: index + 1,
total,
scene: scene.title,
shot: shot.title,
}),
);
director._logEvent('shot_start', {
sceneId: scene.id,
shotId: shot.id,
title: shot.title,
index,
});
},
applyVisual({ shot, token }) {
return director.styleManager.applyVisualState(
director._visualStateForShot(shot),
{ isCurrent: () => !token.cancelled && !token.signal?.aborted },
);
},
async applyLayers({ scene, shot, token }) {
director._setSceneMediaPlayback(scene, shot, token);
const result = await director._applyLayerStates(
director._layerStatesForShot(scene, shot),
token,
);
if (
!token.cancelled &&
!result.refused.length &&
!(await director._applyDataPacks(scene, shot, token))
)
throw new Error('Data packs unavailable');
return result;
},
travel({ scene, shot, token }) {
director._loadedSceneId = scene.id;
const duration = shot.durationSec || defaultShotDurationSec;
timing = director._startSceneClockTicker(scene, shot, token);
travel = director._beginShotTravel(scene, shot, duration);
const flight = director._flyShotCamera(scene, shot, duration, token);
director._publishShotTravel(scene, shot, travel);
return flight;
},
settle({ scene, shot, token }) {
director._settleShotLayerStates(scene, shot, token, travel);
},
hold({ scene, shot, token }) {
return director._holdShot(scene, shot, token);
},
completeShot({ scene, shot, index }) {
director._clock.stopSceneTimer();
director._publishSceneClock(scene, shot, timing.endElapsedSec, {
running: true,
});
director._logEvent('shot_end', {
sceneId: scene.id,
shotId: shot.id,
index,
});
},
complete() {
director._setProgress(1);
director._updateStatus(t('setup.scenes.status.runComplete'));
director._logEvent('scene_run_complete', {});
},
};
}