mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +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
@@ -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