mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Authoring: pick any scene again, and select the first scene on load
Restores the scene picker and its selection on load, after a delete and after an import, so PLAY and NEXT work after a reload. Open in GEV selecting a shot and NEW SCENE stay as they are.
This commit is contained in:
1 parent
1cb3e88027
commit
0a39b05cdb
30 files changed
+301
-210
No files matched your search
@@ -3392,6 +3392,7 @@
|
||||
"scene|PLAY": "تشغيل",
|
||||
"Create and edit scenes": "إنشاء المشاهد وتعديلها",
|
||||
"SCENE": "المشهد",
|
||||
"Scene": "المشهد",
|
||||
"Start a new, empty scene": "بدء مشهد جديد فارغ",
|
||||
"NEW SCENE": "مشهد جديد",
|
||||
"Delete this scene and all of its shots": "حذف هذا المشهد وكل لقطاته",
|
||||
@@ -4104,8 +4105,6 @@
|
||||
"Stories could not load. Check the connection and try again.": "تعذّر تحميل القصص. تحقّق من الاتصال ثم حاول مرة أخرى.",
|
||||
"Shot {n} of {total}": "لقطة {n} من {total}",
|
||||
"GEV scene": "مشهد GEV",
|
||||
"Empty drafts": "المسودات الفارغة",
|
||||
"No scene yet": "لا يوجد مشهد بعد",
|
||||
"SAVE TO STORIES": "حفظ في STORIES",
|
||||
"REMOVE FROM STORIES": "إزالة من STORIES",
|
||||
"Show this scene on the Stories page": "عرض هذا المشهد في صفحة Stories",
|
||||
|
||||
@@ -3100,6 +3100,7 @@
|
||||
"AUTHORING": "SZENEN",
|
||||
"Create and edit scenes": "Szenen erstellen und bearbeiten",
|
||||
"SCENE": "SZENE",
|
||||
"Scene": "Szene",
|
||||
"NEW SCENE": "NEUE SZENE",
|
||||
"Start a new, empty scene": "Neue, leere Szene beginnen",
|
||||
"DELETE": "LÖSCHEN",
|
||||
@@ -3744,8 +3745,6 @@
|
||||
"Stories could not load. Check the connection and try again.": "Storys konnten nicht geladen werden. Prüfen Sie die Verbindung und versuchen Sie es erneut.",
|
||||
"Shot {n} of {total}": "Aufnahme {n} von {total}",
|
||||
"GEV scene": "GEV-Szene",
|
||||
"Empty drafts": "Leere Entwürfe",
|
||||
"No scene yet": "Noch keine Szene",
|
||||
"SAVE TO STORIES": "IN STORIES SPEICHERN",
|
||||
"REMOVE FROM STORIES": "AUS STORIES ENTFERNEN",
|
||||
"Show this scene on the Stories page": "Diese Szene auf der Stories-Seite zeigen",
|
||||
|
||||
@@ -3195,6 +3195,7 @@
|
||||
"AUTHORING": "CREACIÓN",
|
||||
"Create and edit scenes": "Crea y edita escenas",
|
||||
"SCENE": "ESCENA",
|
||||
"Scene": "Escena",
|
||||
"NEW SCENE": "NUEVA ESCENA",
|
||||
"Start a new, empty scene": "Empieza una escena nueva y vacía",
|
||||
"DELETE": "ELIMINAR",
|
||||
@@ -3834,8 +3835,6 @@
|
||||
"Stories could not load. Check the connection and try again.": "No se pudieron cargar las Historias. Comprueba la conexión e inténtalo de nuevo.",
|
||||
"Shot {n} of {total}": "Plano {n} de {total}",
|
||||
"GEV scene": "Escena de GEV",
|
||||
"Empty drafts": "Borradores vacíos",
|
||||
"No scene yet": "Aún no hay escena",
|
||||
"SAVE TO STORIES": "GUARDAR EN STORIES",
|
||||
"REMOVE FROM STORIES": "QUITAR DE STORIES",
|
||||
"Show this scene on the Stories page": "Mostrar esta escena en la página Stories",
|
||||
|
||||
@@ -3175,6 +3175,7 @@
|
||||
"AUTHORING": "CRÉATION",
|
||||
"Create and edit scenes": "Créer et modifier des scènes",
|
||||
"SCENE": "SCÈNE",
|
||||
"Scene": "Scène",
|
||||
"NEW SCENE": "NOUVELLE SCÈNE",
|
||||
"Start a new, empty scene": "Commencer une nouvelle scène vide",
|
||||
"DELETE": "SUPPRIMER",
|
||||
@@ -3834,8 +3835,6 @@
|
||||
"Stories could not load. Check the connection and try again.": "Impossible de charger les Récits. Vérifiez la connexion et réessayez.",
|
||||
"Shot {n} of {total}": "Plan {n} sur {total}",
|
||||
"GEV scene": "Scène GEV",
|
||||
"Empty drafts": "Brouillons vides",
|
||||
"No scene yet": "Aucune scène pour l'instant",
|
||||
"SAVE TO STORIES": "ENREGISTRER DANS STORIES",
|
||||
"REMOVE FROM STORIES": "RETIRER DE STORIES",
|
||||
"Show this scene on the Stories page": "Afficher cette scène sur la page Stories",
|
||||
|
||||
@@ -2335,6 +2335,7 @@
|
||||
"Directions, drawing and your own files": "דרכי הגעה, שרטוט והקבצים שלך",
|
||||
"Create and edit scenes": "יצירה ועריכה של סצנות",
|
||||
"SCENE": "סצנה",
|
||||
"Scene": "סצנה",
|
||||
"Start a new, empty scene": "התחלת סצנה חדשה וריקה",
|
||||
"NEW SCENE": "סצנה חדשה",
|
||||
"Delete this scene and all of its shots": "מחיקת סצנה זו וכל שוטיה",
|
||||
@@ -3834,8 +3835,6 @@
|
||||
"Stories could not load. Check the connection and try again.": "לא ניתן לטעון את הסיפורים. בדוק את החיבור ונסה שוב.",
|
||||
"Shot {n} of {total}": "שוט {n} מתוך {total}",
|
||||
"GEV scene": "סצנת GEV",
|
||||
"Empty drafts": "טיוטות ריקות",
|
||||
"No scene yet": "עדיין אין סצנה",
|
||||
"SAVE TO STORIES": "שמירה ב-STORIES",
|
||||
"REMOVE FROM STORIES": "הסרה מ-STORIES",
|
||||
"Show this scene on the Stories page": "הצגת הסצנה בדף Stories",
|
||||
|
||||
@@ -3175,6 +3175,7 @@
|
||||
"AUTHORING": "CREAZIONE",
|
||||
"Create and edit scenes": "Crea e modifica le scene",
|
||||
"SCENE": "SCENA",
|
||||
"Scene": "Scena",
|
||||
"NEW SCENE": "NUOVA SCENA",
|
||||
"Start a new, empty scene": "Inizia una nuova scena vuota",
|
||||
"DELETE": "ELIMINA",
|
||||
@@ -3834,8 +3835,6 @@
|
||||
"Stories could not load. Check the connection and try again.": "Impossibile caricare le Storie. Controlla la connessione e riprova.",
|
||||
"Shot {n} of {total}": "Scatto {n} di {total}",
|
||||
"GEV scene": "Scena GEV",
|
||||
"Empty drafts": "Bozze vuote",
|
||||
"No scene yet": "Ancora nessuna scena",
|
||||
"SAVE TO STORIES": "SALVA IN STORIES",
|
||||
"REMOVE FROM STORIES": "RIMUOVI DA STORIES",
|
||||
"Show this scene on the Stories page": "Mostra questa scena nella pagina Stories",
|
||||
|
||||
@@ -3025,6 +3025,7 @@
|
||||
"AUTHORING": "シーン作成",
|
||||
"Create and edit scenes": "シーンを作成・編集",
|
||||
"SCENE": "シーン",
|
||||
"Scene": "シーン",
|
||||
"NEW SCENE": "新規シーン",
|
||||
"Start a new, empty scene": "空の新しいシーンを作成",
|
||||
"DELETE": "削除",
|
||||
@@ -3654,8 +3655,6 @@
|
||||
"Stories could not load. Check the connection and try again.": "ストーリーを読み込めませんでした。接続を確認して、もう一度お試しください。",
|
||||
"Shot {n} of {total}": "ショット {n}/{total}",
|
||||
"GEV scene": "GEVシーン",
|
||||
"Empty drafts": "空の下書き",
|
||||
"No scene yet": "シーンはまだありません",
|
||||
"SAVE TO STORIES": "STORIESに保存",
|
||||
"REMOVE FROM STORIES": "STORIESから外す",
|
||||
"Show this scene on the Stories page": "このシーンをStoriesページに表示",
|
||||
|
||||
@@ -3175,6 +3175,7 @@
|
||||
"AUTHORING": "CRIAÇÃO",
|
||||
"Create and edit scenes": "Criar e editar cenas",
|
||||
"SCENE": "CENA",
|
||||
"Scene": "Cena",
|
||||
"NEW SCENE": "NOVA CENA",
|
||||
"Start a new, empty scene": "Começar uma nova cena vazia",
|
||||
"DELETE": "EXCLUIR",
|
||||
@@ -3834,8 +3835,6 @@
|
||||
"Stories could not load. Check the connection and try again.": "Não foi possível carregar as Histórias. Verifique a conexão e tente novamente.",
|
||||
"Shot {n} of {total}": "Plano {n} de {total}",
|
||||
"GEV scene": "Cena do GEV",
|
||||
"Empty drafts": "Rascunhos vazios",
|
||||
"No scene yet": "Nenhuma cena ainda",
|
||||
"SAVE TO STORIES": "SALVAR EM STORIES",
|
||||
"REMOVE FROM STORIES": "REMOVER DE STORIES",
|
||||
"Show this scene on the Stories page": "Mostrar esta cena na página Stories",
|
||||
|
||||
@@ -3270,6 +3270,7 @@
|
||||
"AUTHORING": "РЕДАКТОР",
|
||||
"Create and edit scenes": "Создание и редактирование сцен",
|
||||
"SCENE": "СЦЕНА",
|
||||
"Scene": "Сцена",
|
||||
"NEW SCENE": "НОВАЯ СЦЕНА",
|
||||
"Start a new, empty scene": "Создать новую пустую сцену",
|
||||
"DELETE": "УДАЛИТЬ",
|
||||
@@ -3924,8 +3925,6 @@
|
||||
"Stories could not load. Check the connection and try again.": "Не удалось загрузить Истории. Проверьте подключение и повторите попытку.",
|
||||
"Shot {n} of {total}": "Кадр {n} из {total}",
|
||||
"GEV scene": "Сцена GEV",
|
||||
"Empty drafts": "Пустые черновики",
|
||||
"No scene yet": "Сцены пока нет",
|
||||
"SAVE TO STORIES": "СОХРАНИТЬ В STORIES",
|
||||
"REMOVE FROM STORIES": "УБРАТЬ ИЗ STORIES",
|
||||
"Show this scene on the Stories page": "Показать эту сцену на странице Stories",
|
||||
|
||||
@@ -3017,6 +3017,7 @@
|
||||
"AUTHORING": "REDIGERING",
|
||||
"Create and edit scenes": "Skapa och redigera scener",
|
||||
"SCENE": "SCEN",
|
||||
"Scene": "Scen",
|
||||
"NEW SCENE": "NY SCEN",
|
||||
"Start a new, empty scene": "Börja en ny, tom scen",
|
||||
"DELETE": "RADERA",
|
||||
@@ -3744,8 +3745,6 @@
|
||||
"Stories could not load. Check the connection and try again.": "Berättelser kunde inte läsas in. Kontrollera anslutningen och försök igen.",
|
||||
"Shot {n} of {total}": "Tagning {n} av {total}",
|
||||
"GEV scene": "GEV-scen",
|
||||
"Empty drafts": "Tomma utkast",
|
||||
"No scene yet": "Ingen scen ännu",
|
||||
"SAVE TO STORIES": "SPARA I STORIES",
|
||||
"REMOVE FROM STORIES": "TA BORT FRÅN STORIES",
|
||||
"Show this scene on the Stories page": "Visa scenen på Stories-sidan",
|
||||
|
||||
@@ -3263,6 +3263,7 @@
|
||||
"AUTHORING": "РЕДАКТОР",
|
||||
"Create and edit scenes": "Створення й редагування сцен",
|
||||
"SCENE": "СЦЕНА",
|
||||
"Scene": "Сцена",
|
||||
"NEW SCENE": "НОВА СЦЕНА",
|
||||
"Start a new, empty scene": "Створити нову порожню сцену",
|
||||
"DELETE": "ВИДАЛИТИ",
|
||||
@@ -3924,8 +3925,6 @@
|
||||
"Stories could not load. Check the connection and try again.": "Не вдалося завантажити Історії. Перевірте з’єднання та спробуйте ще раз.",
|
||||
"Shot {n} of {total}": "Кадр {n} з {total}",
|
||||
"GEV scene": "Сцена GEV",
|
||||
"Empty drafts": "Порожні чернетки",
|
||||
"No scene yet": "Сцени ще немає",
|
||||
"SAVE TO STORIES": "ЗБЕРЕГТИ В STORIES",
|
||||
"REMOVE FROM STORIES": "ПРИБРАТИ ЗІ STORIES",
|
||||
"Show this scene on the Stories page": "Показати цю сцену на сторінці Stories",
|
||||
|
||||
@@ -3045,6 +3045,7 @@
|
||||
"AUTHORING": "创作",
|
||||
"Create and edit scenes": "创建和编辑场景",
|
||||
"SCENE": "场景",
|
||||
"Scene": "场景",
|
||||
"NEW SCENE": "新建场景",
|
||||
"Start a new, empty scene": "新建一个空场景",
|
||||
"DELETE": "删除",
|
||||
@@ -3654,8 +3655,6 @@
|
||||
"Stories could not load. Check the connection and try again.": "无法加载故事。请检查网络连接后重试。",
|
||||
"Shot {n} of {total}": "镜头 {n}/{total}",
|
||||
"GEV scene": "GEV 场景",
|
||||
"Empty drafts": "空草稿",
|
||||
"No scene yet": "尚无场景",
|
||||
"SAVE TO STORIES": "保存到 STORIES",
|
||||
"REMOVE FROM STORIES": "从 STORIES 移除",
|
||||
"Show this scene on the Stories page": "在 Stories 页面显示此场景",
|
||||
|
||||
@@ -3032,6 +3032,7 @@
|
||||
"AUTHORING": "創作",
|
||||
"Create and edit scenes": "創建和編輯場景",
|
||||
"SCENE": "場景",
|
||||
"Scene": "場景",
|
||||
"NEW SCENE": "新建場景",
|
||||
"Start a new, empty scene": "新建一個空場景",
|
||||
"DELETE": "刪除",
|
||||
@@ -3654,8 +3655,6 @@
|
||||
"Stories could not load. Check the connection and try again.": "無法載入故事。請檢查網路連線後重試。",
|
||||
"Shot {n} of {total}": "鏡頭 {n}/{total}",
|
||||
"GEV scene": "GEV 場景",
|
||||
"Empty drafts": "空白草稿",
|
||||
"No scene yet": "尚無場景",
|
||||
"SAVE TO STORIES": "儲存到 STORIES",
|
||||
"REMOVE FROM STORIES": "從 STORIES 移除",
|
||||
"Show this scene on the Stories page": "在 Stories 頁面顯示此場景",
|
||||
|
||||
+9
-29
@@ -189,10 +189,8 @@ export class SceneDirector {
|
||||
this._lastRunJson = '';
|
||||
|
||||
this._project = this._loadProject();
|
||||
// Authoring starts with no scene: the built-in scenes stay in the project
|
||||
// (Stories plays them) but only NEW SCENE or selectShot makes one current.
|
||||
this._selectedSceneId = null;
|
||||
this._selectedShotId = null;
|
||||
this._selectedSceneId = this._project.scenes[0]?.id || null;
|
||||
this._selectedShotId = this._project.scenes[0]?.shots[0]?.id || null;
|
||||
/** @type {string|null} Scene whose layer state most recently landed. */
|
||||
this._loadedSceneId = null;
|
||||
|
||||
@@ -234,9 +232,6 @@ export class SceneDirector {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Upgrading a pack selects its scene; on load nothing is selected.
|
||||
this._selectedSceneId = null;
|
||||
this._selectedShotId = null;
|
||||
}
|
||||
this._initUI();
|
||||
// A status the director wrote itself follows the language; one it was
|
||||
@@ -492,16 +487,12 @@ export class SceneDirector {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep the selection on an existing scene, or on none, and present the
|
||||
* scene's name.
|
||||
*/
|
||||
/** Rebuild the scene dropdown options and sync the selected value. */
|
||||
_renderSceneSelect() {
|
||||
if (
|
||||
!this._project.scenes.some((scene) => scene.id === this._selectedSceneId)
|
||||
) {
|
||||
this._selectedSceneId = null;
|
||||
this._selectedShotId = null;
|
||||
this._selectedSceneId = this._project.scenes[0]?.id || null;
|
||||
}
|
||||
this._publish({ type: 'scene-options-changed' });
|
||||
}
|
||||
@@ -564,10 +555,7 @@ export class SceneDirector {
|
||||
this._publish({ type: 'scene-created', scene });
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the currently selected scene after user confirmation and select
|
||||
* none. Resets to defaults if empty.
|
||||
*/
|
||||
/** Delete the currently selected scene after user confirmation. Resets to defaults if empty. */
|
||||
_deleteSelectedScene() {
|
||||
const scene = this._getSelectedScene();
|
||||
if (!scene) return;
|
||||
@@ -580,9 +568,8 @@ export class SceneDirector {
|
||||
this._project = createDefaultProject();
|
||||
}
|
||||
|
||||
// Authoring goes back to no scene.
|
||||
this._selectedSceneId = null;
|
||||
this._selectedShotId = null;
|
||||
this._selectedSceneId = this._project.scenes[0]?.id || null;
|
||||
this._selectedShotId = this._project.scenes[0]?.shots[0]?.id || null;
|
||||
this._saveProject();
|
||||
this._publish({ type: 'scene-deleted', scene });
|
||||
if (scene.stories) this._publish({ type: 'stories-changed' });
|
||||
@@ -2001,14 +1988,6 @@ export class SceneDirector {
|
||||
* @returns {boolean} False when the scene is not installed.
|
||||
*/
|
||||
selectShot(sceneId, shotId = null) {
|
||||
// No scene: AUTHORING goes back to "No scene yet".
|
||||
if (sceneId == null) {
|
||||
this._selectedSceneId = null;
|
||||
this._selectedShotId = null;
|
||||
this._renderSceneSelect();
|
||||
this._renderShotList();
|
||||
return true;
|
||||
}
|
||||
const scene = this._project.scenes.find(({ id }) => id === sceneId);
|
||||
if (!scene) return false;
|
||||
this._selectedSceneId = scene.id;
|
||||
@@ -2543,12 +2522,13 @@ export class SceneDirector {
|
||||
);
|
||||
this._storageReadError = null;
|
||||
// Keep authoring on the named or current scene, else the first scene
|
||||
// that is not a built-in one, else none.
|
||||
// that is not a built-in one, else the first scene.
|
||||
const builtIn = new Set(SCENE_RECIPES.map(({ id }) => id));
|
||||
const selected =
|
||||
project.scenes.find(({ id }) => id === selection?.sceneId) ||
|
||||
project.scenes.find(({ id }) => id === this._selectedSceneId) ||
|
||||
project.scenes.find(({ id }) => !builtIn.has(id)) ||
|
||||
project.scenes[0] ||
|
||||
null;
|
||||
this._selectedSceneId = selected?.id ?? null;
|
||||
this._selectedShotId =
|
||||
|
||||
@@ -732,9 +732,8 @@ test('a legacy three-shot Nepal browser project bootstraps to the current 25-sho
|
||||
for (const shot of scene.shots.slice(0, 8)) {
|
||||
assert.equal(scene.appliedShotPacks[0].shotBindings[shot.title], shot.id);
|
||||
}
|
||||
// The upgrade selects nothing: authoring starts with no scene.
|
||||
assert.equal(director._selectedSceneId, null);
|
||||
assert.equal(director._selectedShotId, null);
|
||||
assert.equal(director._selectedSceneId, scene.id);
|
||||
assert.equal(director._selectedShotId, scene.shots[0].id);
|
||||
} finally {
|
||||
restore();
|
||||
}
|
||||
@@ -2174,9 +2173,9 @@ test('selectShot selects a scene and shot for authoring, falling back to the fir
|
||||
});
|
||||
assert.equal(director.hasScene(scene.id), true);
|
||||
assert.equal(director.hasScene('no-such-scene'), false);
|
||||
// No scene: back to "No scene yet".
|
||||
assert.equal(director.selectShot(null), true);
|
||||
assert.deepEqual(director.selection(), { sceneId: null, shotId: null });
|
||||
// No scene id changes nothing.
|
||||
assert.equal(director.selectShot(null), false);
|
||||
assert.equal(director._selectedSceneId, scene.id);
|
||||
} finally {
|
||||
restore();
|
||||
}
|
||||
@@ -2391,22 +2390,20 @@ test('deleting a scene or its last shot in Stories publishes stories-changed', (
|
||||
}
|
||||
});
|
||||
|
||||
test('authoring selects no scene on load, with or without a saved project', () => {
|
||||
test('authoring selects the first scene and shot on load, with or without a saved project', () => {
|
||||
for (const options of [{}, { storage: {} }]) {
|
||||
const { director, restore } = makeDirector(options);
|
||||
try {
|
||||
assert.ok(
|
||||
director._project.scenes.length > 0,
|
||||
'the scenes stay in the project',
|
||||
);
|
||||
assert.equal(director._selectedSceneId, null);
|
||||
assert.equal(director._selectedShotId, null);
|
||||
assert.equal(director._getSelectedScene(), null);
|
||||
const [first] = director._project.scenes;
|
||||
assert.ok(first, 'the project has scenes');
|
||||
assert.equal(director._selectedSceneId, first.id);
|
||||
assert.equal(director._selectedShotId, first.shots[0]?.id ?? null);
|
||||
director._selectedSceneId = 'gone';
|
||||
director._renderSceneSelect();
|
||||
assert.equal(
|
||||
director._selectedSceneId,
|
||||
null,
|
||||
'nothing falls back to the first scene',
|
||||
first.id,
|
||||
'a missing scene falls back to the first scene',
|
||||
);
|
||||
} finally {
|
||||
restore();
|
||||
@@ -2417,6 +2414,9 @@ test('authoring selects no scene on load, with or without a saved project', () =
|
||||
test('capture with no scene starts a new scene and captures into it', () => {
|
||||
const { director, restore } = makeDirector();
|
||||
try {
|
||||
// An imported empty project leaves nothing selected.
|
||||
director._selectedSceneId = null;
|
||||
director._selectedShotId = null;
|
||||
const changes = recordChanges(director);
|
||||
const before = director._project.scenes.length;
|
||||
director.captureShot();
|
||||
@@ -2442,6 +2442,7 @@ test('capture with no scene and no camera creates nothing', () => {
|
||||
const { director, styleManager, restore } = makeDirector();
|
||||
try {
|
||||
styleManager.getCameraState = () => null;
|
||||
director._selectedSceneId = null;
|
||||
const before = director._project.scenes.length;
|
||||
director.captureShot();
|
||||
assert.equal(director._project.scenes.length, before);
|
||||
@@ -2451,15 +2452,15 @@ test('capture with no scene and no camera creates nothing', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('deleting the current scene selects none', () => {
|
||||
test('deleting the current scene selects the first scene', () => {
|
||||
const project = structuredClone(PROJECT_FIXTURE);
|
||||
project.scenes.push({ id: 'scene-2', title: 'Second', shots: [] });
|
||||
const { director, restore } = makeDirector({ project });
|
||||
try {
|
||||
director.selectShot('scene-2');
|
||||
director._deleteSelectedScene();
|
||||
assert.equal(director._selectedSceneId, null);
|
||||
assert.equal(director._selectedShotId, null);
|
||||
assert.equal(director._selectedSceneId, 'scene-1');
|
||||
assert.equal(director._selectedShotId, 'shot-a');
|
||||
assert.deepEqual(
|
||||
director._project.scenes.map(({ id }) => id),
|
||||
['scene-1'],
|
||||
@@ -2469,7 +2470,7 @@ test('deleting the current scene selects none', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('an import keeps the current scene, else picks a non-built-in scene, else none', async () => {
|
||||
test('an import keeps the current scene, else picks a non-built-in scene, else the first', async () => {
|
||||
const { director, restore } = makeDirector();
|
||||
try {
|
||||
const exported = stringifySceneDocument(director._project);
|
||||
@@ -2494,8 +2495,8 @@ test('an import keeps the current scene, else picks a non-built-in scene, else n
|
||||
);
|
||||
assert.equal(
|
||||
director._selectedSceneId,
|
||||
null,
|
||||
'a built-in scene is never picked',
|
||||
SCENE_RECIPES[0].id,
|
||||
'a built-in scene only when there is nothing else',
|
||||
);
|
||||
} finally {
|
||||
restore();
|
||||
|
||||
@@ -64,7 +64,7 @@ export class SceneControls {
|
||||
this.run(this.actions.reviewImport ? 'reviewImport' : 'import', file),
|
||||
});
|
||||
this.presentPanel({});
|
||||
// Scene and shot titles are shown translated; the scene name and the list
|
||||
// Scene and shot titles are shown translated; the select and the list
|
||||
// show them again.
|
||||
this.offLocale = onLocaleChange(() => {
|
||||
this.presentPanel({ playLabel: t('PLAY', { context: 'scene' }) });
|
||||
@@ -173,9 +173,9 @@ export class SceneControls {
|
||||
}
|
||||
}
|
||||
|
||||
/** Publish the project to the scene name and the SceneShotList view. */
|
||||
/** Publish the project to the SceneOptions and SceneShotList views. */
|
||||
renderSceneSelect() {
|
||||
if (!this.destroyed) this.store.publish(this.read());
|
||||
if (!this.destroyed) this.store.publishOptions(this.read());
|
||||
}
|
||||
|
||||
/** NEW SCENE: ask for a name and create the scene. @returns {boolean} */
|
||||
|
||||
@@ -37,7 +37,7 @@ function fixture() {
|
||||
const byId = (id) => document.getElementById(id);
|
||||
const elements = {
|
||||
panel: byId('scene-panel'),
|
||||
name: byId('scene-name'),
|
||||
select: byId('scene-select'),
|
||||
new: byId('scene-new-btn'),
|
||||
delete: byId('scene-delete-btn'),
|
||||
capture: byId('scene-capture-btn'),
|
||||
@@ -80,6 +80,7 @@ function fixture() {
|
||||
const calls = [];
|
||||
const actions = Object.fromEntries(
|
||||
[
|
||||
'selectScene',
|
||||
'selectShot',
|
||||
'renameShot',
|
||||
'create',
|
||||
@@ -128,8 +129,8 @@ test('Scene controls render the supplied selection and running/download states',
|
||||
const f = fixture();
|
||||
try {
|
||||
await nextTick();
|
||||
assert.equal(f.elements.name.textContent, '<Scene A>');
|
||||
assert.equal(document.getElementById('scene-select'), null);
|
||||
assert.equal(f.elements.select.children[0].textContent, '<Scene A>');
|
||||
assert.equal(f.elements.select.value, 'scene-a');
|
||||
assert.equal(f.label().textContent, '<Shot A>');
|
||||
assert.equal(
|
||||
f.elements.shots.children[0].children[1].textContent,
|
||||
@@ -410,7 +411,6 @@ test('the real director preserves a selected shot label for the following double
|
||||
},
|
||||
});
|
||||
director = new SceneDirector({ camera: { cancelFlight() {} } }, {}, {});
|
||||
director.selectShot('scene-a');
|
||||
await nextTick();
|
||||
const label = f.label();
|
||||
label.click();
|
||||
@@ -432,7 +432,7 @@ test('the real director preserves a selected shot label for the following double
|
||||
}
|
||||
});
|
||||
|
||||
test('the real director names the scene it selects and saves it to Stories', async () => {
|
||||
test('the real director shows the scene it selects and saves it to Stories', async () => {
|
||||
const f = fixture();
|
||||
const previousStorage = globalThis.localStorage;
|
||||
let saved = null;
|
||||
@@ -452,15 +452,12 @@ test('the real director names the scene it selects and saves it to Stories', asy
|
||||
});
|
||||
director = new SceneDirector({ camera: { cancelFlight() {} } }, {}, {});
|
||||
await nextTick();
|
||||
// Nothing is selected on load.
|
||||
assert.equal(f.elements.name.textContent, 'No scene yet');
|
||||
// The first scene is selected on load, as before Stories.
|
||||
assert.equal(f.elements.select.value, 'scene-a');
|
||||
assert.equal(
|
||||
f.elements.shots.querySelectorAll('.scene-shot-row').length,
|
||||
0,
|
||||
1,
|
||||
);
|
||||
director.selectShot('scene-a');
|
||||
await nextTick();
|
||||
assert.equal(f.elements.name.textContent, '<Scene A>');
|
||||
assert.equal(f.elements.stories.textContent, 'SAVE TO STORIES');
|
||||
f.elements.stories.click();
|
||||
await nextTick();
|
||||
@@ -468,10 +465,10 @@ test('the real director names the scene it selects and saves it to Stories', asy
|
||||
assert.equal(f.elements.status.textContent, 'Saved to Stories');
|
||||
assert.equal(f.elements.stories.textContent, 'REMOVE FROM STORIES');
|
||||
|
||||
// Stories' "Open in GEV" selects programmatically; the name follows.
|
||||
// Stories' "Open in GEV" selects programmatically; the select follows.
|
||||
assert.equal(director.selectShot('scene-b'), true);
|
||||
await nextTick();
|
||||
assert.equal(f.elements.name.textContent, 'Scene B');
|
||||
assert.equal(f.elements.select.value, 'scene-b');
|
||||
assert.equal(f.elements.stories.textContent, 'SAVE TO STORIES');
|
||||
assert.equal(f.elements.stories.disabled, true);
|
||||
|
||||
@@ -555,22 +552,40 @@ test('a rename keeps typed text across republishing and ends with its scene', as
|
||||
}
|
||||
});
|
||||
|
||||
test('the read-only scene name follows the selected scene', async () => {
|
||||
test('the scene select follows option renders, as before', async () => {
|
||||
const f = fixture();
|
||||
try {
|
||||
await nextTick();
|
||||
f.state.scenes.push({ id: 'scene-b', title: 'B', shots: [] });
|
||||
f.state.selectedSceneId = 'scene-b';
|
||||
f.owner.renderSceneSelect();
|
||||
await nextTick();
|
||||
assert.equal(f.elements.name.textContent, 'B');
|
||||
assert.equal(f.elements.name.classList.contains('scene-name-empty'), false);
|
||||
f.state.scenes = [];
|
||||
f.state.selectedSceneId = null;
|
||||
f.state.selectedSceneId = 'scene-b';
|
||||
f.owner.renderShotList();
|
||||
await nextTick();
|
||||
assert.equal(f.elements.name.textContent, 'No scene yet');
|
||||
assert.equal(f.elements.name.classList.contains('scene-name-empty'), true);
|
||||
assert.equal(f.elements.select.value, 'scene-a');
|
||||
f.owner.renderSceneSelect();
|
||||
await nextTick();
|
||||
assert.equal(f.elements.select.value, 'scene-b');
|
||||
} finally {
|
||||
f.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test('an option render restores the published scene after a local pick', async () => {
|
||||
const f = fixture();
|
||||
try {
|
||||
f.state.scenes.push({ id: 'scene-b', title: 'B', shots: [] });
|
||||
f.owner.renderSceneSelect();
|
||||
await nextTick();
|
||||
assert.equal(f.elements.select.value, 'scene-a');
|
||||
// The person picks B; the owner re-renders the shot list only.
|
||||
f.elements.select.value = 'scene-b';
|
||||
f.owner.renderShotList();
|
||||
await nextTick();
|
||||
// Something reloads A and renders the options with the same choice.
|
||||
f.owner.renderSceneSelect();
|
||||
await nextTick();
|
||||
assert.equal(f.elements.select.value, 'scene-a');
|
||||
} finally {
|
||||
f.restore();
|
||||
}
|
||||
@@ -777,7 +792,6 @@ test('CAPTURE SHOT with no scene asks for a name, creates the scene, then captur
|
||||
f.owner.renderSceneSelect();
|
||||
f.owner.setButtons(false);
|
||||
await nextTick();
|
||||
assert.equal(f.elements.name.textContent, 'No scene yet');
|
||||
let asked = 0;
|
||||
window.prompt = () => (asked++ ? null : 'Harbour');
|
||||
f.elements.capture.click();
|
||||
@@ -862,7 +876,7 @@ test('Stories tag chips and THUMBNAIL follow the current scene', async () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('authoring can reopen a saved empty draft and capture from an empty panel', async () => {
|
||||
test('after a reload, authoring picks any scene, and PLAY and NEXT work', async () => {
|
||||
const f = fixture();
|
||||
const previousStorage = globalThis.localStorage;
|
||||
let saved = null;
|
||||
@@ -879,6 +893,11 @@ test('authoring can reopen a saved empty draft and capture from an empty panel',
|
||||
scenes: [
|
||||
...f.state.scenes,
|
||||
{ id: 'empty-draft', title: 'Empty draft', shots: [] },
|
||||
{
|
||||
id: 'scene-c',
|
||||
title: 'Scene C',
|
||||
shots: [{ id: 'shot-c', title: 'Shot C' }],
|
||||
},
|
||||
],
|
||||
}),
|
||||
setItem: (_key, value) => {
|
||||
@@ -901,18 +920,59 @@ test('authoring can reopen a saved empty draft and capture from an empty panel',
|
||||
},
|
||||
{ getAll: () => [], getLayerParams: () => null },
|
||||
);
|
||||
const runs = [];
|
||||
director.startScene = (id) => runs.push(['start', id]);
|
||||
director.runNextScene = () => runs.push(['next']);
|
||||
await nextTick();
|
||||
assert.equal(f.elements.name.textContent, 'No scene yet');
|
||||
const drafts = document.getElementById('empty-scene-select');
|
||||
assert.ok(drafts);
|
||||
drafts.value = 'empty-draft';
|
||||
drafts.dispatchEvent(new Event('change'));
|
||||
// The first scene and its first shot are selected, as before a reload.
|
||||
assert.deepEqual(director.selection(), {
|
||||
sceneId: 'scene-a',
|
||||
shotId: 'shot-a',
|
||||
});
|
||||
assert.equal(f.elements.start.disabled, false);
|
||||
assert.equal(f.elements.next.disabled, false);
|
||||
f.elements.start.click();
|
||||
f.elements.next.click();
|
||||
assert.deepEqual(runs, [['start', 'scene-a'], ['next']]);
|
||||
|
||||
// The select lists every scene, with shots or not.
|
||||
assert.deepEqual(
|
||||
[...f.elements.select.options].map(({ value }) => value),
|
||||
['scene-a', 'empty-draft', 'scene-c'],
|
||||
);
|
||||
f.elements.select.value = 'scene-c';
|
||||
f.elements.select.dispatchEvent(new Event('change'));
|
||||
await nextTick();
|
||||
assert.equal(f.elements.name.textContent, 'Empty draft');
|
||||
assert.deepEqual(director.selection(), {
|
||||
sceneId: 'scene-c',
|
||||
shotId: 'shot-c',
|
||||
});
|
||||
|
||||
f.elements.select.value = 'empty-draft';
|
||||
f.elements.select.dispatchEvent(new Event('change'));
|
||||
await nextTick();
|
||||
assert.equal(director.selection().sceneId, 'empty-draft');
|
||||
assert.equal(
|
||||
director.draftScenes().some(({ id }) => id === 'empty-draft'),
|
||||
false,
|
||||
);
|
||||
// CAPTURE SHOT adds to the picked scene without asking for a name.
|
||||
window.prompt = () => {
|
||||
throw new Error('no name is asked for');
|
||||
};
|
||||
f.elements.capture.click();
|
||||
await nextTick();
|
||||
const draft = saved.scenes.find(({ id }) => id === 'empty-draft');
|
||||
assert.equal(draft.shots.length, 1);
|
||||
assert.equal(f.elements.thumb.disabled, false);
|
||||
f.chips()[0].click();
|
||||
await nextTick();
|
||||
assert.deepEqual(
|
||||
saved.scenes.find(({ id }) => id === 'empty-draft').storyTags,
|
||||
['Floods'],
|
||||
);
|
||||
|
||||
// Deleting it selects the first scene again.
|
||||
window.confirm = () => true;
|
||||
f.elements.delete.click();
|
||||
await nextTick();
|
||||
@@ -920,29 +980,8 @@ test('authoring can reopen a saved empty draft and capture from an empty panel',
|
||||
saved.scenes.some(({ id }) => id === 'empty-draft'),
|
||||
false,
|
||||
);
|
||||
window.prompt = () => 'Harbour';
|
||||
f.elements.capture.click();
|
||||
await nextTick();
|
||||
assert.equal(f.elements.name.textContent, 'Harbour');
|
||||
assert.equal(saved.scenes.at(-1).title, 'Harbour');
|
||||
assert.equal(saved.scenes.at(-1).shots.length, 1);
|
||||
assert.equal(
|
||||
f.elements.shots.querySelectorAll('.scene-shot-row').length,
|
||||
1,
|
||||
);
|
||||
assert.equal(f.elements.thumb.disabled, false);
|
||||
|
||||
f.chips()[0].click();
|
||||
await nextTick();
|
||||
assert.deepEqual(saved.scenes.at(-1).storyTags, ['Floods']);
|
||||
assert.equal(f.chips()[0].getAttribute('aria-pressed'), 'true');
|
||||
|
||||
// Deleting it goes back to no scene.
|
||||
window.confirm = () => true;
|
||||
f.elements.delete.click();
|
||||
await nextTick();
|
||||
assert.equal(f.elements.name.textContent, 'No scene yet');
|
||||
assert.equal(f.elements.delete.disabled, true);
|
||||
assert.equal(f.elements.select.value, 'scene-a');
|
||||
assert.equal(director.selection().sceneId, 'scene-a');
|
||||
} finally {
|
||||
await director?.destroy();
|
||||
Object.defineProperty(globalThis, 'localStorage', {
|
||||
|
||||
@@ -81,6 +81,7 @@ export function sceneButtonsDisabled(
|
||||
for (const name of [
|
||||
'start',
|
||||
'next',
|
||||
'select',
|
||||
'new',
|
||||
'delete',
|
||||
'capture',
|
||||
|
||||
+18
-3
@@ -3,7 +3,7 @@ import { computed, markRaw, shallowRef } from 'vue';
|
||||
|
||||
/**
|
||||
* @typedef {object} SceneRowHandlers
|
||||
* @property {(sceneId: string) => void} selectScene
|
||||
* @property {(sceneId: string) => void} selectScene The select's choice.
|
||||
* @property {(shotId: string) => void} select
|
||||
* @property {(sceneId: string, shotId: string, title: string) => void} rename
|
||||
* @property {(sceneId: string, shotId: string) => void} load
|
||||
@@ -24,7 +24,12 @@ export const useSceneStore = defineStore('gev-scenes', () => {
|
||||
const scenes = shallowRef(markRaw([]));
|
||||
const selectedSceneId = shallowRef(null);
|
||||
const selectedShotId = shallowRef(null);
|
||||
/** The scene being edited, whose name the panel shows, or null. */
|
||||
// The select's choice, updated only when its options are rendered.
|
||||
const listedSceneId = shallowRef(null);
|
||||
// Counts option renders: each one re-applies the select's choice, which
|
||||
// the person may have changed since.
|
||||
const listedRevision = shallowRef(0);
|
||||
/** The selected scene, whose Stories details the panel shows, or null. */
|
||||
const currentScene = computed(
|
||||
() =>
|
||||
scenes.value.find((scene) => scene.id === selectedSceneId.value) ?? null,
|
||||
@@ -64,6 +69,13 @@ export const useSceneStore = defineStore('gev-scenes', () => {
|
||||
selectedShotId.value = state.selectedShotId ?? null;
|
||||
}
|
||||
|
||||
/** Publish the project and the select's choice. */
|
||||
function publishOptions(state) {
|
||||
publish(state);
|
||||
listedSceneId.value = state.selectedSceneId ?? null;
|
||||
listedRevision.value++;
|
||||
}
|
||||
|
||||
/** @param {string|null} id */
|
||||
function selectShot(id) {
|
||||
selectedShotId.value = id ?? null;
|
||||
@@ -77,7 +89,7 @@ export const useSceneStore = defineStore('gev-scenes', () => {
|
||||
if (token !== owner) return;
|
||||
owner = null;
|
||||
attached.value = false;
|
||||
publish({});
|
||||
publishOptions({});
|
||||
}
|
||||
|
||||
/** @returns {boolean} Whether `token` is the owner presenting now. */
|
||||
@@ -98,12 +110,15 @@ export const useSceneStore = defineStore('gev-scenes', () => {
|
||||
scenes,
|
||||
selectedSceneId,
|
||||
selectedShotId,
|
||||
listedSceneId,
|
||||
listedRevision,
|
||||
currentScene,
|
||||
attached,
|
||||
panel,
|
||||
publishPanel,
|
||||
attach,
|
||||
publish,
|
||||
publishOptions,
|
||||
selectShot,
|
||||
detach,
|
||||
owns,
|
||||
|
||||
@@ -92,8 +92,8 @@ test('SCENES actions stay on one line in English', () => {
|
||||
.length,
|
||||
0,
|
||||
);
|
||||
const [name] = unguardedRules(css('scenes.css'), '#scene-name');
|
||||
assert.equal(declaration(name, 'white-space'), undefined);
|
||||
const [select] = unguardedRules(css('scenes.css'), '#scene-select');
|
||||
assert.equal(declaration(select, 'white-space'), undefined);
|
||||
});
|
||||
|
||||
test('Display and parameter rows keep their English layout', () => {
|
||||
|
||||
+10
-13
@@ -162,24 +162,21 @@
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
/* The scene being edited, read-only, takes its own row; NEW SCENE / DELETE
|
||||
share the next. A long name wraps. */
|
||||
#scene-name {
|
||||
/* The scene's name takes its own row; NEW SCENE / DELETE share the next. */
|
||||
#scene-select {
|
||||
flex: 1 1 100%;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
min-height: 32px;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
#scene-name.scene-name-empty {
|
||||
color: var(--scene-quiet);
|
||||
}
|
||||
|
||||
#empty-scene-select {
|
||||
flex: 1 1 100%;
|
||||
min-width: 0;
|
||||
html:not([lang='en']) #scene-select {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
/* A translated action longer than its button wraps inside the button instead
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { t } from '../../i18n/index.js';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
@@ -9,11 +8,13 @@ import { useSceneStore } from '../stores/scenes.js';
|
||||
import { STORY_TAG_LIMIT, STORY_TAGS } from '../../scenes/storyTags.js';
|
||||
import { vClassToggle } from '../rail/classToggle.js';
|
||||
import SceneDialog from './panels/SceneDialog.vue';
|
||||
import SceneOptions from './SceneOptions.vue';
|
||||
import SceneShotList from './SceneShotList.vue';
|
||||
import CctvPanel from './panels/CctvPanel.vue';
|
||||
import StreetLevelPanel from './panels/StreetLevelPanel.vue';
|
||||
import DrawControls from './panels/DrawControls.vue';
|
||||
import GeoImport from './panels/GeoImport.vue';
|
||||
import UiSelect from '../kit/UiSelect.js';
|
||||
import LayerSectionIndex from './panels/LayerSectionIndex.vue';
|
||||
import LayerFinder from './panels/LayerFinder.vue';
|
||||
import DataLibraryBrowse from './panels/DataLibraryBrowse.vue';
|
||||
@@ -25,7 +26,6 @@ const { toolbar, dialog } = storeToRefs(useSceneSharingStore());
|
||||
// answers the buttons through the store.
|
||||
const scenes = useSceneStore();
|
||||
const { panel: scene, currentScene } = storeToRefs(scenes);
|
||||
const emptyScenes = computed(() => scenes.scenes.filter(({ shots }) => !shots.length));
|
||||
const off = (name) => scene.value?.disabled[name] ?? false;
|
||||
// The current scene's Stories tags; a chip not yet on is off at the limit.
|
||||
const tagOn = (tag) => currentScene.value?.storyTags?.includes(tag) ?? false;
|
||||
@@ -76,18 +76,7 @@ async function importChosen(event) {
|
||||
<RailPanel id="scene-panel" start-collapsed v-class-toggle="{ running: scene?.running, 'has-shots': scene?.hasShots }" :title="t('AUTHORING')" :hint="t('Create and edit scenes')" scroll>
|
||||
<p class="scene-step-heading">{{ t('SCENE') }}</p>
|
||||
<div class="scene-controls">
|
||||
<p id="scene-name" :class="{ 'scene-name-empty': !currentScene }">{{ currentScene?.title ?? t('No scene yet') }}</p>
|
||||
<select
|
||||
v-if="emptyScenes.length"
|
||||
id="empty-scene-select"
|
||||
:aria-label="t('Empty drafts')"
|
||||
:disabled="off('new')"
|
||||
:value="currentScene?.shots.length === 0 ? currentScene.id : ''"
|
||||
@change="scenes.act('selectScene', $event.target.value)"
|
||||
>
|
||||
<option value="" disabled>{{ t('Empty drafts') }}</option>
|
||||
<option v-for="draft in emptyScenes" :key="draft.id" :value="draft.id">{{ draft.title }}</option>
|
||||
</select>
|
||||
<UiSelect class="gev-field" id="scene-select" :aria-label="t('Scene')" :disabled="off('select')" @update:model-value="scenes.act('selectScene', $event)"><SceneOptions /></UiSelect>
|
||||
<UiButton id="scene-new-btn" type="button" :disabled="off('new')" @click="scenes.act('create')" class="gev-action-button scene-btn" :title="t('Start a new, empty scene')">{{ t('NEW SCENE') }}</UiButton>
|
||||
<UiButton tone="alert" id="scene-delete-btn" type="button" :disabled="off('delete')" @click="scenes.act('deleteScene')" class="gev-action-button gev-action-button--danger scene-btn scene-btn-danger" :title="t('Delete this scene and all of its shots')">{{ t('DELETE') }}</UiButton>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { getCurrentInstance, watch } from 'vue';
|
||||
import { useSceneStore } from '../stores/scenes.js';
|
||||
|
||||
// The Scene select's options; selecting one stays with SceneControls.
|
||||
const { scenes, listedSceneId, listedRevision } = storeToRefs(useSceneStore());
|
||||
|
||||
// Every option render shows the published scene, as the select did before:
|
||||
// `selected` alone is written only when it changes, so it would leave a
|
||||
// person's later pick standing.
|
||||
const instance = getCurrentInstance();
|
||||
watch(
|
||||
listedRevision,
|
||||
() => {
|
||||
const select = instance.proxy.$el?.parentNode;
|
||||
if (select && listedSceneId.value) select.value = listedSceneId.value;
|
||||
},
|
||||
{ flush: 'post' },
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<option
|
||||
v-for="scene in scenes"
|
||||
:key="scene.id"
|
||||
:value="scene.id"
|
||||
:selected="scene.id === listedSceneId"
|
||||
>{{ scene.title }}</option
|
||||
>
|
||||
</template>
|
||||
Reference in new issue
Block a user