From 6b78d72f520db7c110c1b449a2a603b3e4d8b1c2 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Tue, 17 Nov 2026 20:37:29 -0800 Subject: [PATCH] Go to a shot by clicking its row; move shots up and down Clicking anywhere on a shot row (its number, title or summary line), or pressing Enter or Space on its title, now selects the shot and loads it, which is what the row's LOAD button did; the LOAD button is gone. In its place, up and down arrows swap the shot with its neighbour through SceneDirector.moveShot, which saves the project and publishes shot-moved. The arrows are disabled at the ends and while the scene plays, and neither they nor DEL load the shot. --- changelog.d/XXXX-shots-click-to-go-reorder.md | 4 + docs/CURRENT-STATE.md | 16 +++- index.html | 2 +- src/i18n/locales/ar.json | 9 +- src/i18n/locales/de.json | 9 +- src/i18n/locales/es.json | 9 +- src/i18n/locales/fr.json | 9 +- src/i18n/locales/he.json | 9 +- src/i18n/locales/it.json | 9 +- src/i18n/locales/ja.json | 9 +- src/i18n/locales/pt.json | 9 +- src/i18n/locales/ru.json | 9 +- src/i18n/locales/sv.json | 9 +- src/i18n/locales/uk.json | 9 +- src/i18n/locales/zh-CN.json | 9 +- src/i18n/locales/zh-Hant.json | 9 +- src/scenes/director.js | 27 ++++++ src/scenes/director.test.mjs | 37 +++++++++ src/ui/sceneControls.js | 3 + src/ui/sceneControls.test.mjs | 82 ++++++++++++++++++- src/ui/stores/scenes.js | 2 + src/ui/styles/scenes.css | 17 ++++ src/ui/views/LayerPanelsView.vue | 2 +- src/ui/views/SceneShotList.vue | 77 ++++++++++++++--- 24 files changed, 312 insertions(+), 74 deletions(-) create mode 100644 changelog.d/XXXX-shots-click-to-go-reorder.md diff --git a/changelog.d/XXXX-shots-click-to-go-reorder.md b/changelog.d/XXXX-shots-click-to-go-reorder.md new file mode 100644 index 0000000000..427a9a5f4d --- /dev/null +++ b/changelog.d/XXXX-shots-click-to-go-reorder.md @@ -0,0 +1,4 @@ +- Clicking a shot row anywhere (its number, title or summary), or pressing + Enter or Space on its title, now goes to the shot, as LOAD did; the LOAD + button is gone. In its place, up and down arrows swap the shot with its + neighbour, saved with the project (Sameh Khamis, @samehkhamis, #XXXX). diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 0dabb63f42..53b4e899a9 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -2369,12 +2369,20 @@ Scene controls own creation/deletion prompts, panel listeners, shot rows, playba and keyboard cancellation. The director supplies project reads and explicit editing/playback actions while retaining persistence, camera and layer sequencing. Shot selection updates the highlight without replacing the row, preserving -native double-click rename. Replacing rows revokes their old listeners. Disposal stops controls immediately; +native double-click rename. A click anywhere on a shot row (its number, title or +summary line), or Enter or Space on its title, goes to the shot: it is selected +and loaded (`SceneDirector.loadShot`: its look, layers and camera), so the row +has no separate LOAD button. Each row's up and down arrows swap the shot with +its neighbour (`SceneDirector.moveShot`, saved with the project and published as +`shot-moved`); they are disabled at the ends and while the scene plays, and, +like DEL, never load the shot. Shot rows show no thumbnail: a shot keeps no +picture of its view, only the scene's Stories card does. Replacing rows revokes +their old listeners. Disposal stops controls immediately; late file and failed-action completions cannot update removed presentation. The panel is titled Authoring and is laid out in four labelled steps: SCENE (picker on its own row listing every scene in the project, NEW SCENE, DELETE), -SHOTS (+ CAPTURE SHOT, UPDATE SHOT, the numbered shot list and a select/rename +SHOTS (+ CAPTURE SHOT, UPDATE SHOT, the numbered shot list and a go-to/rename hint), PREVIEW (PLAY, STOP, NEXT) and SAVE & SHARE (a row of Stories tag chips; the thumbnail preview, CAPTURE THUMBNAIL and SAVE TO STORIES on one row; then EXPORT, IMPORT, RUN LOG, then the EDIT DETAILS / SHARE SCENE row). On load the @@ -3191,8 +3199,8 @@ retain their specialized ownership. Browser acceptance: ## Ordinary action buttons -Scene panel actions, shot LOAD/DEL actions, the EDIT DETAILS / SHARE SCENE -bar and one-shot CCTV actions use the shared `gev-action-button` surface in +Scene panel actions, shot move-up/move-down/DEL actions, the EDIT DETAILS / +SHARE SCENE bar and one-shot CCTV actions use the shared `gev-action-button` surface in `ui/styles/action-button.css`, with default/danger variants and default/compact sizes, drawn by the scene panels view (`LayerPanelsView.vue`, `SceneShotList.vue`) and the CCTV panel. Feature diff --git a/index.html b/index.html index c159503c16..ded159f2c9 100644 --- a/index.html +++ b/index.html @@ -26,7 +26,7 @@ with the sources: src/materialSymbolsSubset.test.mjs fails when a source names a glyph this list is missing, because a missing glyph does not draw a box — the ligature never forms and the element renders the literal word. --> - +
diff --git a/src/i18n/locales/ar.json b/src/i18n/locales/ar.json index 6b4c761e7d..223dcbda80 100644 --- a/src/i18n/locales/ar.json +++ b/src/i18n/locales/ar.json @@ -2691,9 +2691,7 @@ "Delete scene \"{scene}\" and all shots?": "حذف المشهد «{scene}» وكل لقطاته؟", "Stopped (Esc)": "متوقف (Esc)", "No shots yet. Use CAPTURE SHOT to save current look.": "لا لقطات بعد. استخدم «التقاط لقطة» لحفظ المنظر الحالي.", - "Double-click to rename": "انقر نقرًا مزدوجًا لإعادة التسمية", "Shot name": "اسم اللقطة", - "LOAD": "تحميل", "{duration}s + {hold}s": "{duration} ث + {hold} ث", "Choose files": "اختيار ملفات", "{count} files selected": { @@ -3450,7 +3448,6 @@ "Add the current view, style and layers as the next shot": "إضافة العرض الحالي والنمط والطبقات كلقطة تالية", "+ CAPTURE SHOT": "+ التقاط لقطة", "Replace the selected shot with the current view": "استبدال اللقطة المحددة بالعرض الحالي", - "Click a shot to select it, double-click to rename.": "انقر على لقطة لتحديدها، وانقر عليها نقرًا مزدوجًا لإعادة تسميتها.", "Play from this scene through the rest of the project": "تشغيل من هذا المشهد حتى نهاية المشروع", "Stop playback (Esc)": "إيقاف التشغيل (Esc)", "Play the shot after the selected one, moving on to the next scene when needed": "تشغيل اللقطة التي تلي المحددة، مع الانتقال إلى المشهد التالي عند الحاجة", @@ -4547,5 +4544,9 @@ "KT": "عقدة", "Course to {code}: {course}": "المسار إلى {code}: {course}", "Over {place}": "فوق {place}", - "Below": "في الأسفل" + "Below": "في الأسفل", + "Go to this shot. Double-click to rename.": "انتقل إلى هذه اللقطة. انقر نقرًا مزدوجًا لإعادة التسمية.", + "Move up": "نقل لأعلى", + "Move down": "نقل لأسفل", + "Click a shot to go to it, double-click to rename.": "انقر على لقطة للانتقال إليها، وانقر عليها نقرًا مزدوجًا لإعادة تسميتها." } diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json index 80ae71838f..3048c30212 100644 --- a/src/i18n/locales/de.json +++ b/src/i18n/locales/de.json @@ -2522,9 +2522,7 @@ "Delete scene \"{scene}\" and all shots?": "Szene „{scene}“ und alle Aufnahmen löschen?", "Stopped (Esc)": "Gestoppt (Esc)", "No shots yet. Use CAPTURE SHOT to save current look.": "Noch keine Aufnahmen. Mit AUFNAHME SPEICHERN die aktuelle Ansicht sichern.", - "Double-click to rename": "Doppelklick zum Umbenennen", "Shot name": "Name der Aufnahme", - "LOAD": "LADEN", "{duration}s + {hold}s": "{duration} s + {hold} s", "Choose files": "Dateien wählen", "{count} files selected": { @@ -3133,7 +3131,6 @@ "+ CAPTURE SHOT": "+ AUFNAHME SPEICHERN", "Add the current view, style and layers as the next shot": "Aktuelle Ansicht, Stil und Ebenen als nächste Aufnahme hinzufügen", "Replace the selected shot with the current view": "Ausgewählte Aufnahme durch die aktuelle Ansicht ersetzen", - "Click a shot to select it, double-click to rename.": "Aufnahme anklicken zum Auswählen, Doppelklick zum Umbenennen.", "Play from this scene through the rest of the project": "Ab dieser Szene bis zum Ende des Projekts abspielen", "Stop playback (Esc)": "Wiedergabe stoppen (Esc)", "Play the shot after the selected one, moving on to the next scene when needed": "Aufnahme nach der ausgewählten abspielen, bei Bedarf in der nächsten Szene", @@ -4135,5 +4132,9 @@ "KT": "KT", "Course to {code}: {course}": "Kurs nach {code}: {course}", "Over {place}": "Über {place}", - "Below": "Darunter" + "Below": "Darunter", + "Go to this shot. Double-click to rename.": "Zu dieser Aufnahme wechseln. Doppelklick zum Umbenennen.", + "Move up": "Nach oben verschieben", + "Move down": "Nach unten verschieben", + "Click a shot to go to it, double-click to rename.": "Aufnahme anklicken, um zu ihr zu wechseln, Doppelklick zum Umbenennen." } diff --git a/src/i18n/locales/es.json b/src/i18n/locales/es.json index 5178fe730c..d41406a4ae 100644 --- a/src/i18n/locales/es.json +++ b/src/i18n/locales/es.json @@ -1784,9 +1784,7 @@ "Export failed · {error}": "La exportación falló · {error}", "← → preview · A or B pins the focused day": "← → vista previa · A o B fija el día enfocado", "← → preview the other side · A or B pins it": "← → vista previa del otro lado · A o B lo fija", - "LOAD": "CARGAR", "No shots yet. Use CAPTURE SHOT to save current look.": "Aún no hay planos. Usa CAPTURAR PLANO para guardar el aspecto actual.", - "Double-click to rename": "Doble clic para cambiar el nombre", "Shot name": "Nombre del plano", "RETRYING ALPR CAMERAS": "REINTENTANDO CÁMARAS ALPR", "FETCHING ALPR CAMERAS": "OBTENIENDO CÁMARAS ALPR", @@ -3235,7 +3233,6 @@ "+ CAPTURE SHOT": "+ CAPTURAR PLANO", "Add the current view, style and layers as the next shot": "Añade la vista, el estilo y las capas actuales como el siguiente plano", "Replace the selected shot with the current view": "Sustituye el plano seleccionado por la vista actual", - "Click a shot to select it, double-click to rename.": "Haz clic en un plano para seleccionarlo y doble clic para cambiarle el nombre.", "scene|PLAY": "REPRODUCIR", "Stop playback (Esc)": "Detén la reproducción (Esc)", "SAVE & SHARE": "GUARDAR Y COMPARTIR", @@ -4238,5 +4235,9 @@ "KT": "KT", "Course to {code}: {course}": "Rumbo a {code}: {course}", "Over {place}": "Sobre {place}", - "Below": "Debajo" + "Below": "Debajo", + "Go to this shot. Double-click to rename.": "Ir a este plano. Doble clic para cambiar el nombre.", + "Move up": "Subir", + "Move down": "Bajar", + "Click a shot to go to it, double-click to rename.": "Haz clic en un plano para ir a él y doble clic para cambiarle el nombre." } diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json index df4bd75222..e109673834 100644 --- a/src/i18n/locales/fr.json +++ b/src/i18n/locales/fr.json @@ -2276,9 +2276,7 @@ "SPARSE": "ÉPARS", "BALANCED": "ÉQUILIBRÉ", "No shots yet. Use CAPTURE SHOT to save current look.": "Aucun plan pour l'instant. Utilisez CAPTURER UN PLAN pour enregistrer le rendu actuel.", - "Double-click to rename": "Double-cliquez pour renommer", "Shot name": "Nom du plan", - "LOAD": "CHARGER", "DEL": "SUPPR.", "{duration}s + {hold}s": "{duration} s + {hold} s", "Choose files": "Choisir des fichiers", @@ -3214,7 +3212,6 @@ "+ CAPTURE SHOT": "+ CAPTURER UN PLAN", "Add the current view, style and layers as the next shot": "Ajouter la vue, le style et les couches actuels comme plan suivant", "Replace the selected shot with the current view": "Remplacer le plan sélectionné par la vue actuelle", - "Click a shot to select it, double-click to rename.": "Cliquez sur un plan pour le sélectionner, double-cliquez pour le renommer.", "Play from this scene through the rest of the project": "Lire à partir de cette scène jusqu'à la fin du projet", "Stop playback (Esc)": "Arrêter la lecture (Esc)", "Play the shot after the selected one, moving on to the next scene when needed": "Lire le plan qui suit la sélection, en passant à la scène suivante si besoin", @@ -4238,5 +4235,9 @@ "KT": "KT", "Course to {code}: {course}": "Cap vers {code} : {course}", "Over {place}": "Au-dessus de {place}", - "Below": "En dessous" + "Below": "En dessous", + "Go to this shot. Double-click to rename.": "Aller à ce plan. Double-cliquez pour renommer.", + "Move up": "Monter", + "Move down": "Descendre", + "Click a shot to go to it, double-click to rename.": "Cliquez sur un plan pour y aller, double-cliquez pour le renommer." } diff --git a/src/i18n/locales/he.json b/src/i18n/locales/he.json index 63f34c0c57..4df937f88d 100644 --- a/src/i18n/locales/he.json +++ b/src/i18n/locales/he.json @@ -2356,7 +2356,6 @@ "+ CAPTURE SHOT": "+ לכידת שוט", "Replace the selected shot with the current view": "החלפת השוט הנבחר בתצוגה הנוכחית", "UPDATE SHOT": "עדכון שוט", - "Click a shot to select it, double-click to rename.": "לחץ על שוט לבחירתו, לחיצה כפולה לשינוי שם.", "Play from this scene through the rest of the project": "נגינה מהסצנה הזאת ועד סוף הפרויקט", "Stop playback (Esc)": "עצירת ההשמעה (Esc)", "STOP": "עצירה", @@ -2400,9 +2399,7 @@ "ACTIVE STYLE": "הסגנון הפעיל", "ORBIT": "הקפה", "No shots yet. Use CAPTURE SHOT to save current look.": "אין עדיין שוטים. השתמש בלכידת שוט כדי לשמור את המראה הנוכחי.", - "Double-click to rename": "לחיצה כפולה לשינוי שם", "Shot name": "שם השוט", - "LOAD": "טעינה", "DEL": "מחיקה", "MISSION CONTROL · FIRST LAUNCH": "חדר בקרה · שיגור ראשון", "Choose your first view": "בחירת התצוגה הראשונה", @@ -4238,5 +4235,9 @@ "KT": "KT", "Course to {code}: {course}": "כיוון אל {code}: {course}", "Over {place}": "מעל {place}", - "Below": "מתחת" + "Below": "מתחת", + "Go to this shot. Double-click to rename.": "מעבר לשוט הזה. לחיצה כפולה לשינוי שם.", + "Move up": "הזזה למעלה", + "Move down": "הזזה למטה", + "Click a shot to go to it, double-click to rename.": "לחץ על שוט כדי לעבור אליו, לחיצה כפולה לשינוי שם." } diff --git a/src/i18n/locales/it.json b/src/i18n/locales/it.json index 20bb94c30c..5639ffce46 100644 --- a/src/i18n/locales/it.json +++ b/src/i18n/locales/it.json @@ -2276,9 +2276,7 @@ "SPARSE": "RADO", "BALANCED": "BILANCIATO", "No shots yet. Use CAPTURE SHOT to save current look.": "Ancora nessuno scatto. Usa CATTURA SCATTO per salvare l'aspetto attuale.", - "Double-click to rename": "Doppio clic per rinominare", "Shot name": "Nome dello scatto", - "LOAD": "CARICA", "DEL": "ELIM", "{duration}s + {hold}s": "{duration}s + {hold}s", "Choose files": "Scegli i file", @@ -3214,7 +3212,6 @@ "+ CAPTURE SHOT": "+ CATTURA SCATTO", "Add the current view, style and layers as the next shot": "Aggiungi la vista, lo stile e i livelli attuali come scatto successivo", "Replace the selected shot with the current view": "Sostituisci lo scatto selezionato con la vista attuale", - "Click a shot to select it, double-click to rename.": "Fai clic su uno scatto per selezionarlo, doppio clic per rinominarlo.", "Play from this scene through the rest of the project": "Riproduci da questa scena fino alla fine del progetto", "Stop playback (Esc)": "Interrompi la riproduzione (Esc)", "Play the shot after the selected one, moving on to the next scene when needed": "Riproduci lo scatto dopo quello selezionato, passando alla scena successiva se serve", @@ -4238,5 +4235,9 @@ "KT": "KT", "Course to {code}: {course}": "Rotta verso {code}: {course}", "Over {place}": "Sopra {place}", - "Below": "Sotto" + "Below": "Sotto", + "Go to this shot. Double-click to rename.": "Vai a questo scatto. Doppio clic per rinominare.", + "Move up": "Sposta su", + "Move down": "Sposta giù", + "Click a shot to go to it, double-click to rename.": "Fai clic su uno scatto per andarci, doppio clic per rinominarlo." } diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index 28f6828e5d..dd53445a87 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -2190,9 +2190,7 @@ "SPARSE": "低密度", "BALANCED": "標準", "No shots yet. Use CAPTURE SHOT to save current look.": "ショットはまだありません。[ショット取得]で現在の表示を保存してください。", - "Double-click to rename": "ダブルクリックで名前を変更", "Shot name": "ショット名", - "LOAD": "読込", "DEL": "削除", "{duration}s + {hold}s": "{duration}秒 + {hold}秒", "Choose files": "ファイルを選択", @@ -3052,7 +3050,6 @@ "+ CAPTURE SHOT": "+ ショット取得", "Add the current view, style and layers as the next shot": "現在の視点・スタイル・レイヤーを次のショットとして追加", "Replace the selected shot with the current view": "選択中のショットを現在の視点で置き換え", - "Click a shot to select it, double-click to rename.": "ショットをクリックして選択、ダブルクリックで名前を変更します。", "Play from this scene through the rest of the project": "このシーンからプロジェクトの最後まで再生", "Stop playback (Esc)": "再生を停止(Esc)", "Play the shot after the selected one, moving on to the next scene when needed": "選択中のショットの次を再生(必要に応じて次のシーンへ進む)", @@ -4032,5 +4029,9 @@ "KT": "KT", "Course to {code}: {course}": "{code}への針路: {course}", "Over {place}": "{place}上空", - "Below": "直下" + "Below": "直下", + "Go to this shot. Double-click to rename.": "このショットへ移動。ダブルクリックで名前を変更。", + "Move up": "上へ移動", + "Move down": "下へ移動", + "Click a shot to go to it, double-click to rename.": "ショットをクリックしてそこへ移動、ダブルクリックで名前を変更します。" } diff --git a/src/i18n/locales/pt.json b/src/i18n/locales/pt.json index ea88f139f9..3242d85602 100644 --- a/src/i18n/locales/pt.json +++ b/src/i18n/locales/pt.json @@ -2276,9 +2276,7 @@ "SPARSE": "ESPARSO", "BALANCED": "EQUILIBRADO", "No shots yet. Use CAPTURE SHOT to save current look.": "Ainda não há planos. Use CAPTURAR PLANO para salvar o visual atual.", - "Double-click to rename": "Clique duplo para renomear", "Shot name": "Nome do plano", - "LOAD": "CARREGAR", "DEL": "EXCL.", "{duration}s + {hold}s": "{duration} s + {hold} s", "Choose files": "Escolher arquivos", @@ -3214,7 +3212,6 @@ "+ CAPTURE SHOT": "+ CAPTURAR PLANO", "Add the current view, style and layers as the next shot": "Adicionar a vista, o estilo e as camadas atuais como próximo plano", "Replace the selected shot with the current view": "Substituir o plano selecionado pela vista atual", - "Click a shot to select it, double-click to rename.": "Clique em um plano para selecioná-lo e clique duas vezes para renomeá-lo.", "Play from this scene through the rest of the project": "Reproduzir desta cena até o fim do projeto", "Stop playback (Esc)": "Parar a reprodução (Esc)", "Play the shot after the selected one, moving on to the next scene when needed": "Reproduzir o plano após o selecionado, passando à próxima cena se necessário", @@ -4238,5 +4235,9 @@ "KT": "KT", "Course to {code}: {course}": "Rumo para {code}: {course}", "Over {place}": "Sobre {place}", - "Below": "Abaixo" + "Below": "Abaixo", + "Go to this shot. Double-click to rename.": "Ir para este plano. Clique duplo para renomear.", + "Move up": "Mover para cima", + "Move down": "Mover para baixo", + "Click a shot to go to it, double-click to rename.": "Clique em um plano para ir até ele e clique duas vezes para renomeá-lo." } diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json index ede804a5d6..178223b048 100644 --- a/src/i18n/locales/ru.json +++ b/src/i18n/locales/ru.json @@ -1821,9 +1821,7 @@ "Export failed · {error}": "Ошибка экспорта · {error}", "← → preview · A or B pins the focused day": "← → просмотр · A или B закрепляет выбранный день", "← → preview the other side · A or B pins it": "← → просмотр другой стороны · A или B закрепляет её", - "LOAD": "ЗАГРУЗИТЬ", "No shots yet. Use CAPTURE SHOT to save current look.": "Кадров пока нет. Нажмите «СДЕЛАТЬ КАДР», чтобы сохранить текущий вид.", - "Double-click to rename": "Дважды щёлкните, чтобы переименовать", "Shot name": "Название кадра", "RETRYING ALPR CAMERAS": "ПОВТОРНАЯ ЗАГРУЗКА КАМЕР ALPR", "FETCHING ALPR CAMERAS": "ЗАГРУЗКА КАМЕР ALPR", @@ -3316,7 +3314,6 @@ "+ CAPTURE SHOT": "+ СДЕЛАТЬ КАДР", "Add the current view, style and layers as the next shot": "Добавить текущий вид, стиль и слои следующим кадром", "Replace the selected shot with the current view": "Заменить выбранный кадр текущим видом", - "Click a shot to select it, double-click to rename.": "Щёлкните кадр, чтобы выбрать его, дважды — чтобы переименовать.", "scene|PLAY": "ПУСК", "Stop playback (Esc)": "Остановить воспроизведение (Esc)", "SAVE & SHARE": "СОХРАНЕНИЕ И ОБМЕН", @@ -4341,5 +4338,9 @@ "KT": "УЗ", "Course to {code}: {course}": "Курс на {code}: {course}", "Over {place}": "Над: {place}", - "Below": "Под спутником" + "Below": "Под спутником", + "Go to this shot. Double-click to rename.": "Перейти к этому кадру. Дважды щёлкните, чтобы переименовать.", + "Move up": "Переместить вверх", + "Move down": "Переместить вниз", + "Click a shot to go to it, double-click to rename.": "Щёлкните кадр, чтобы перейти к нему, дважды — чтобы переименовать." } diff --git a/src/i18n/locales/sv.json b/src/i18n/locales/sv.json index c9a4c32849..307e56138f 100644 --- a/src/i18n/locales/sv.json +++ b/src/i18n/locales/sv.json @@ -2438,9 +2438,7 @@ "Delete scene \"{scene}\" and all shots?": "Radera scenen ”{scene}” och alla tagningar?", "Stopped (Esc)": "Stoppad (Esc)", "No shots yet. Use CAPTURE SHOT to save current look.": "Inga tagningar än. Använd SPARA TAGNING för att spara nuvarande vy.", - "Double-click to rename": "Dubbelklicka för att byta namn", "Shot name": "Namn på tagning", - "LOAD": "LADDA", "{duration}s + {hold}s": "{duration} s + {hold} s", "Choose files": "Välj filer", "{count} files selected": { @@ -3044,7 +3042,6 @@ "+ CAPTURE SHOT": "+ SPARA TAGNING", "Add the current view, style and layers as the next shot": "Lägg till aktuell vy, stil och lager som nästa tagning", "Replace the selected shot with the current view": "Ersätt vald tagning med aktuell vy", - "Click a shot to select it, double-click to rename.": "Klicka på en tagning för att välja den, dubbelklicka för att byta namn.", "Play from this scene through the rest of the project": "Spela upp från den här scenen genom resten av projektet", "Stop playback (Esc)": "Stoppa uppspelningen (Esc)", "Play the shot after the selected one, moving on to the next scene when needed": "Spela upp tagningen efter den valda och gå vidare till nästa scen vid behov", @@ -4135,5 +4132,9 @@ "KT": "KT", "Course to {code}: {course}": "Kurs mot {code}: {course}", "Over {place}": "Över {place}", - "Below": "Nedanför" + "Below": "Nedanför", + "Go to this shot. Double-click to rename.": "Gå till den här tagningen. Dubbelklicka för att byta namn.", + "Move up": "Flytta upp", + "Move down": "Flytta ned", + "Click a shot to go to it, double-click to rename.": "Klicka på en tagning för att gå till den, dubbelklicka för att byta namn." } diff --git a/src/i18n/locales/uk.json b/src/i18n/locales/uk.json index cc46dc2891..60099718f9 100644 --- a/src/i18n/locales/uk.json +++ b/src/i18n/locales/uk.json @@ -2318,9 +2318,7 @@ "SPARSE": "РІДКО", "BALANCED": "ПОМІРНО", "No shots yet. Use CAPTURE SHOT to save current look.": "Кадрів поки немає. Натисніть «ЗНЯТИ КАДР», щоб зберегти поточний вигляд.", - "Double-click to rename": "Двічі клацніть, щоб перейменувати", "Shot name": "Назва кадру", - "LOAD": "ЗАВАНТАЖИТИ", "DEL": "ВИДАЛ.", "{duration}s + {hold}s": "{duration} с + {hold} с", "Choose files": "Вибрати файли", @@ -3308,7 +3306,6 @@ "+ CAPTURE SHOT": "+ ЗНЯТИ КАДР", "Add the current view, style and layers as the next shot": "Додати поточний вигляд, стиль і шари як наступний кадр", "Replace the selected shot with the current view": "Замінити вибраний кадр поточним виглядом", - "Click a shot to select it, double-click to rename.": "Клацніть кадр, щоб вибрати його, двічі — щоб перейменувати.", "Play from this scene through the rest of the project": "Відтворити від цієї сцени до кінця проєкту", "Stop playback (Esc)": "Зупинити відтворення (Esc)", "Play the shot after the selected one, moving on to the next scene when needed": "Відтворити кадр після вибраного, за потреби перейшовши до наступної сцени", @@ -4341,5 +4338,9 @@ "KT": "ВУЗ", "Course to {code}: {course}": "Курс на {code}: {course}", "Over {place}": "Над: {place}", - "Below": "Під супутником" + "Below": "Під супутником", + "Go to this shot. Double-click to rename.": "Перейти до цього кадру. Двічі клацніть, щоб перейменувати.", + "Move up": "Перемістити вгору", + "Move down": "Перемістити вниз", + "Click a shot to go to it, double-click to rename.": "Клацніть кадр, щоб перейти до нього, двічі — щоб перейменувати." } diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json index 419a3b0243..034c6d13ca 100644 --- a/src/i18n/locales/zh-CN.json +++ b/src/i18n/locales/zh-CN.json @@ -2161,9 +2161,7 @@ "SPARSE": "稀疏", "BALANCED": "均衡", "No shots yet. Use CAPTURE SHOT to save current look.": "暂无镜头。使用“保存镜头”保存当前视角及设置。", - "Double-click to rename": "双击重命名", "Shot name": "镜头名称", - "LOAD": "加载", "DEL": "删除", "{duration}s + {hold}s": "{duration} 秒 + {hold} 秒", "Choose files": "选择文件", @@ -3073,7 +3071,6 @@ "+ CAPTURE SHOT": "+ 保存镜头", "Add the current view, style and layers as the next shot": "将当前视角、样式和图层添加为下一个镜头", "Replace the selected shot with the current view": "用当前视角替换所选镜头", - "Click a shot to select it, double-click to rename.": "单击镜头即可选中,双击可重命名。", "scene|PLAY": "播放", "Stop playback (Esc)": "停止播放(Esc)", "SAVE & SHARE": "保存与分享", @@ -4032,5 +4029,9 @@ "KT": "kt", "Course to {code}: {course}": "前往 {code} 的航向:{course}", "Over {place}": "{place}上空", - "Below": "下方" + "Below": "下方", + "Go to this shot. Double-click to rename.": "转到此镜头。双击重命名。", + "Move up": "上移", + "Move down": "下移", + "Click a shot to go to it, double-click to rename.": "单击镜头即可转到该镜头,双击可重命名。" } diff --git a/src/i18n/locales/zh-Hant.json b/src/i18n/locales/zh-Hant.json index bd9603fe57..99a2b5fe9a 100644 --- a/src/i18n/locales/zh-Hant.json +++ b/src/i18n/locales/zh-Hant.json @@ -2161,9 +2161,7 @@ "SPARSE": "稀疏", "BALANCED": "均衡", "No shots yet. Use CAPTURE SHOT to save current look.": "暫無鏡頭。使用“保存鏡頭”保存當前視角及設置。", - "Double-click to rename": "雙擊重命名", "Shot name": "鏡頭名稱", - "LOAD": "加載", "DEL": "刪除", "{duration}s + {hold}s": "{duration} 秒 + {hold} 秒", "Choose files": "選擇文件", @@ -3073,7 +3071,6 @@ "+ CAPTURE SHOT": "+ 保存鏡頭", "Add the current view, style and layers as the next shot": "將當前視角、樣式和圖層添加為下一個鏡頭", "Replace the selected shot with the current view": "用當前視角替換所選鏡頭", - "Click a shot to select it, double-click to rename.": "單擊鏡頭即可選中,雙擊可重命名。", "scene|PLAY": "播放", "Stop playback (Esc)": "停止播放(Esc)", "SAVE & SHARE": "保存與分享", @@ -4032,5 +4029,9 @@ "KT": "kt", "Course to {code}: {course}": "前往 {code} 的航向:{course}", "Over {place}": "{place}上空", - "Below": "下方" + "Below": "下方", + "Go to this shot. Double-click to rename.": "轉到此鏡頭。雙擊重命名。", + "Move up": "上移", + "Move down": "下移", + "Click a shot to go to it, double-click to rename.": "單擊鏡頭即可轉到該鏡頭,雙擊可重命名。" } diff --git a/src/scenes/director.js b/src/scenes/director.js index 35387ecba7..4332d99362 100644 --- a/src/scenes/director.js +++ b/src/scenes/director.js @@ -492,6 +492,8 @@ export class SceneDirector { download: () => this.downloadLastRunMetadata(), load: (sceneId, shotId) => this.loadShot(sceneId, shotId), deleteShot: (sceneId, shotId) => this.deleteShot(sceneId, shotId), + moveShot: (sceneId, shotId, index) => + this.moveShot(sceneId, shotId, index), }, }); } @@ -1225,6 +1227,31 @@ export class SceneDirector { if (inStories) this._publish({ type: 'stories-changed' }); } + /** + * Move a shot to another place in its scene's playback order, the shots + * between shifting over (the shot list's up and down buttons swap it with + * its neighbour). Not while the scene plays. + * @param {string} sceneId + * @param {string} shotId + * @param {number} index Its new place, kept within the scene's shots. + * @returns {boolean} Whether it moved. + */ + moveShot(sceneId, shotId, index) { + if (this._running || !Number.isInteger(index)) return false; + const { scene, shot } = this._getShot(sceneId, shotId); + if (!scene || !shot) return false; + const from = scene.shots.indexOf(shot); + const to = Math.max(0, Math.min(scene.shots.length - 1, index)); + if (from === to) return false; + const shots = scene.shots.filter((item) => item !== shot); + shots.splice(to, 0, shot); + scene.shots = shots; + this._saveProject(); + this._shotOutcome('shot-moved', scene, shot, to); + if (scene.stories) this._publish({ type: 'stories-changed' }); + return true; + } + /** * Load a single shot: apply its visual state, enable/disable layers, and fly * the camera to the shot's position. Blocked while a scene run is active. diff --git a/src/scenes/director.test.mjs b/src/scenes/director.test.mjs index dd36ec3897..4e34dc5c56 100644 --- a/src/scenes/director.test.mjs +++ b/src/scenes/director.test.mjs @@ -1869,6 +1869,43 @@ test('Scene snapshots are immutable and editing outcomes retain the affected sho } finally { restore(); } }); +test('moveShot reorders a scene, saves it and publishes shot-moved; not past the ends, not while playing', async () => { + const { director, restore } = makeDirector(); + try { + director._activeRun = null; + const seen = []; + director.subscribe(({ change }) => { if (change) seen.push(change); }); + const order = () => director._project.scenes[0].shots.map(({ id }) => id); + const saved = () => + JSON.parse(localStorage.getItem('godsEyeView.sceneProject.v2')) + .scenes[0].shots.map(({ id }) => id); + + assert.equal(director.moveShot('scene-1', 'shot-b', 0), true); + assert.deepEqual(order(), ['shot-b', 'shot-a']); + assert.deepEqual(saved(), ['shot-b', 'shot-a']); + const moved = seen.find(({ type }) => type === 'shot-moved'); + assert.equal(moved.shot.id, 'shot-b'); + assert.equal(moved.index, 0); + + // The view's action is the same edit. + seen.length = 0; + director._controls.actions.moveShot('scene-1', 'shot-b', 1); + assert.deepEqual(order(), ['shot-a', 'shot-b']); + assert.deepEqual(seen.map(({ type }) => type), ['shot-moved']); + + // Past an end it stays at the end; at its place, unknown, or playing, nothing moves. + assert.equal(director.moveShot('scene-1', 'shot-b', 5), false); + assert.equal(director.moveShot('scene-1', 'shot-a', -1), false); + assert.equal(director.moveShot('scene-1', 'missing', 0), false); + assert.equal(director.moveShot('scene-1', 'shot-a', 0.5), false); + director._running = true; + assert.equal(director.moveShot('scene-1', 'shot-b', 0), false); + director._running = false; + assert.deepEqual(order(), ['shot-a', 'shot-b']); + await director.destroy(); + } finally { restore(); } +}); + test('Scene load outcomes exclude superseded and disposed completions', async () => { const { director, styleManager, restore } = makeDirector(); try { diff --git a/src/ui/sceneControls.js b/src/ui/sceneControls.js index 3a00f5c66b..2b32b88fb8 100644 --- a/src/ui/sceneControls.js +++ b/src/ui/sceneControls.js @@ -48,6 +48,8 @@ export class SceneControls { this.run('renameShot', sceneId, shotId, title), load: (sceneId, shotId) => this.run('load', sceneId, shotId), remove: (sceneId, shotId) => this.deleteShot(sceneId, shotId), + move: (sceneId, shotId, index) => + this.run('moveShot', sceneId, shotId, index), create: () => this.createScene(), deleteScene: () => this.deleteSelectedScene(), stories: () => this.run('stories'), @@ -110,6 +112,7 @@ export class SceneControls { 'shot-captured', 'shot-updated', 'shot-renamed', + 'shot-moved', 'shot-deleted', 'project-imported', ].includes(type) diff --git a/src/ui/sceneControls.test.mjs b/src/ui/sceneControls.test.mjs index 90db2c00a0..d5cad98a65 100644 --- a/src/ui/sceneControls.test.mjs +++ b/src/ui/sceneControls.test.mjs @@ -98,6 +98,7 @@ function fixture() { 'download', 'load', 'deleteShot', + 'moveShot', ].map((name) => [ name, (...args) => { @@ -219,22 +220,30 @@ test('Scene controls dispatch panel and shot-row actions, and rows outlive repub await nextTick(); const row = f.elements.shots.children[0]; const label = f.label(); - const load = row.children[0].children[1].children[0]; + const [up, down, del] = row.children[0].children[1].children; f.elements.capture.click(); f.elements.start.click(); + // A click on the row goes to the shot: selected and loaded. label.click(); label.dispatchEvent(new Event('dblclick')); await nextTick(); label.children[0].value = 'Renamed'; + // A click in the name being typed goes nowhere. + label.children[0].click(); label.children[0].dispatchEvent(new Event('blur')); - load.click(); assert.deepEqual(f.calls, [ ['capture'], ['start', 'scene-a'], ['selectShot', 'shot-a'], - ['renameShot', 'scene-a', 'shot-a', 'Renamed'], ['load', 'scene-a', 'shot-a'], + ['renameShot', 'scene-a', 'shot-a', 'Renamed'], ]); + // A lone shot has nowhere to move; the buttons never load it. + assert.equal(up.disabled, true); + assert.equal(down.disabled, true); + window.confirm = () => false; + del.click(); + assert.equal(f.calls.length, 5); f.owner.renderShotList(); await nextTick(); assertSameNode(f.elements.shots.children[0], row); @@ -246,7 +255,10 @@ test('Scene controls dispatch panel and shot-row actions, and rows outlive repub f.owner.destroy(); await nextTick(); f.label().click(); - assert.deepEqual(f.calls.at(-1), ['selectShot', 'shot-a']); + assert.deepEqual(f.calls.slice(-2), [ + ['selectShot', 'shot-a'], + ['load', 'scene-a', 'shot-a'], + ]); newer.destroy(); await nextTick(); assert.equal(f.elements.shots.children.length, 0); @@ -255,6 +267,68 @@ test('Scene controls dispatch panel and shot-row actions, and rows outlive repub } }); +test('a shot row goes to its shot from the keyboard, and its up and down buttons swap it with a neighbour', async () => { + const f = fixture(); + try { + f.state.scenes[0].shots.push( + { id: 'shot-b', title: 'Shot B', durationSec: 4, holdSec: 0 }, + { id: 'shot-c', title: 'Shot C', durationSec: 4, holdSec: 0 }, + ); + f.owner.renderShotList(); + await nextTick(); + const rows = () => [...f.elements.shots.children]; + const buttons = (index) => rows()[index].querySelectorAll('button'); + const label = (index) => rows()[index].querySelector('.scene-shot-label'); + + // The title is the row's keyboard control, described by its summary. + const second = label(1); + assert.equal(second.getAttribute('role'), 'button'); + assert.equal(second.getAttribute('tabindex'), '0'); + const meta = document.getElementById( + second.getAttribute('aria-describedby'), + ); + assert.ok(meta.classList.contains('scene-shot-meta')); + for (const key of ['Enter', ' ']) + second.dispatchEvent( + Object.assign(new Event('keydown', { bubbles: true }), { key }), + ); + second.dispatchEvent( + Object.assign(new Event('keydown', { bubbles: true }), { key: 'a' }), + ); + assert.deepEqual(f.calls, [ + ['selectShot', 'shot-b'], + ['load', 'scene-a', 'shot-b'], + ['selectShot', 'shot-b'], + ['load', 'scene-a', 'shot-b'], + ]); + + // Up and down, labelled, disabled at the ends; neither loads the shot. + f.calls.length = 0; + const [firstUp, firstDown] = buttons(0); + assert.equal(firstUp.getAttribute('aria-label'), 'Move up'); + assert.equal(firstDown.getAttribute('aria-label'), 'Move down'); + assert.equal(firstUp.disabled, true); + assert.equal(firstDown.disabled, false); + assert.equal(buttons(2)[1].disabled, true); + assert.equal(buttons(2)[0].disabled, false); + buttons(1)[0].click(); + buttons(1)[1].click(); + assert.deepEqual(f.calls, [ + ['moveShot', 'scene-a', 'shot-b', 0], + ['moveShot', 'scene-a', 'shot-b', 2], + ]); + + // Not while the scene plays. + f.state.running = true; + f.owner.setButtons(true); + await nextTick(); + assert.ok(rows().every((_, index) => buttons(index)[0].disabled)); + assert.ok(rows().every((_, index) => buttons(index)[1].disabled)); + } finally { + f.restore(); + } +}); + test('Scene Escape and recording presentation follow playback and release on destruction', async () => { const f = fixture(); const escape = () => diff --git a/src/ui/stores/scenes.js b/src/ui/stores/scenes.js index ebc2443c96..1a1fd3d890 100644 --- a/src/ui/stores/scenes.js +++ b/src/ui/stores/scenes.js @@ -8,6 +8,8 @@ import { computed, markRaw, shallowRef } from 'vue'; * @property {(sceneId: string, shotId: string, title: string) => void} rename * @property {(sceneId: string, shotId: string) => void} load * @property {(sceneId: string, shotId: string) => void} remove + * @property {(sceneId: string, shotId: string, index: number) => void} move + * Move a shot to `index` in its scene's playback order. * @property {(file: File) => Promise|void} importFile A chosen file. * @property {() => void} create, deleteScene, stories, thumb, capture, update, * start, stop, next, export, download The panel's buttons. diff --git a/src/ui/styles/scenes.css b/src/ui/styles/scenes.css index 1aec7d54f2..8facd925d2 100644 --- a/src/ui/styles/scenes.css +++ b/src/ui/styles/scenes.css @@ -345,6 +345,7 @@ html:not([lang='en']) #scene-panel .scene-controls .scene-btn { } .scene-shot-row { + cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 9px; padding: 8px 10px; @@ -398,6 +399,11 @@ html:not([lang='en']) #scene-panel .scene-controls .scene-btn { color: var(--scene-quiet); } +.scene-shot-label:focus-visible { + outline: 1px solid var(--accent); + outline-offset: 2px; +} + .scene-shot-row.active .scene-shot-label::before { color: var(--accent); } @@ -422,9 +428,20 @@ html:not([lang='en']) #scene-panel .scene-controls .scene-btn { .scene-shot-actions { display: flex; + align-items: center; gap: 6px; } +/* Up and down: the glyph as tall as DEL's word. */ +.scene-shot-move { + padding: 3px 4px; +} + +.scene-shot-move .ui-icon { + display: block; + line-height: 1; +} + .scene-progress { margin-top: 8px; width: 100%; diff --git a/src/ui/views/LayerPanelsView.vue b/src/ui/views/LayerPanelsView.vue index 1835a99b34..d310e5f8f9 100644 --- a/src/ui/views/LayerPanelsView.vue +++ b/src/ui/views/LayerPanelsView.vue @@ -86,7 +86,7 @@ async function importChosen(event) { {{ t('UPDATE SHOT') }} -

{{ t('Click a shot to select it, double-click to rename.') }}

+

{{ t('Click a shot to go to it, double-click to rename.') }}

{{ t('PREVIEW') }}

{{ scene?.playLabel ?? t('PLAY', { context: 'scene' }) }} diff --git a/src/ui/views/SceneShotList.vue b/src/ui/views/SceneShotList.vue index d37e09308c..ca80fae3cd 100644 --- a/src/ui/views/SceneShotList.vue +++ b/src/ui/views/SceneShotList.vue @@ -4,14 +4,19 @@ import { storeToRefs } from 'pinia'; import { t } from '../../i18n/index.js'; import { describeShot } from '../scenePresentation.js'; import UiButton from '../kit/UiButton.vue'; +import UiIcon from '../kit/UiIcon.vue'; import { useSceneStore } from '../stores/scenes.js'; import UiEmpty from '../kit/UiEmpty.vue'; // The selected scene's shots. Rows keep their identity across selection so a -// click followed by a double-click lands on the same label. +// click followed by a double-click lands on the same label. A click anywhere +// on a row (or Enter or Space on its title) goes to the shot: it is selected +// and loaded. The row's buttons move it up or down, or delete it. const store = useSceneStore(); -const { scenes, selectedSceneId, selectedShotId, attached } = +const { scenes, selectedSceneId, selectedShotId, attached, panel } = storeToRefs(store); +const running = computed(() => !!panel.value?.running); +const list = ref(null); const scene = computed( () => scenes.value.find((item) => item.id === selectedSceneId.value) ?? null, ); @@ -41,6 +46,38 @@ function act(name, shot, ...args) { if (scene.value) store.act(name, scene.value.id, shot.id, ...args); } +/** What on a row is not for going to the shot: its buttons and the name being typed. */ +const NOT_GOING = '.scene-shot-actions, .scene-shot-rename'; + +/** Go to a shot: select it and load its look, layers and camera. */ +function go(shot, event) { + if (isEditing(shot) || !scene.value || event?.target?.closest?.(NOT_GOING)) + return; + store.act('select', shot.id); + act('load', shot); +} + +function onLabelKey(shot, event) { + if (event.key !== 'Enter' && event.key !== ' ') return; + event.preventDefault(); + go(shot); +} + +/** + * Swap a shot with its neighbour (`step` -1 up, 1 down). The focus stays on + * the button pressed, or moves to the other one once the shot reaches an end. + */ +async function move(shot, index, step) { + act('move', shot, index + step); + await nextTick(); + const row = [...(list.value?.children ?? [])].find( + (item) => item.dataset.sceneShotId === shot.id, + ); + const [up, down] = row?.querySelectorAll('.scene-shot-move') ?? []; + const pressed = step < 0 ? up : down; + (pressed && !pressed.disabled ? pressed : step < 0 ? down : up)?.focus(); +} + async function startRename(shot) { if (isEditing(shot) || !scene.value) return; editing.value = { sceneId: scene.value.id, shotId: shot.id }; @@ -72,7 +109,7 @@ function onRenameKey(shot, event) {