0.10.6: setButtonEnabled action — disable buttons from the timeline
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d3c5b8b640
commit
0bbef66192
8 files changed
+221
-2
No files matched your search
@@ -23,6 +23,20 @@ const sceneOptions = computed(() =>
|
||||
store.project.scenes.map((s) => ({ id: s.id, name: s.name })),
|
||||
)
|
||||
|
||||
const buttonLayerOptions = computed(() => {
|
||||
const assetById = new Map(store.project.assets.map((a) => [a.id, a]))
|
||||
const out: { id: string; label: string }[] = []
|
||||
for (const page of store.project.scenes) {
|
||||
for (const layer of page.layers) {
|
||||
const asset = assetById.get(layer.assetId)
|
||||
if (asset?.kind === 'button') {
|
||||
out.push({ id: layer.id, label: `${page.name} / ${layer.name}` })
|
||||
}
|
||||
}
|
||||
}
|
||||
return out
|
||||
})
|
||||
|
||||
const ACTION_TYPES: Action['type'][] = [
|
||||
'play',
|
||||
'pause',
|
||||
@@ -31,6 +45,7 @@ const ACTION_TYPES: Action['type'][] = [
|
||||
'jumpToFrame',
|
||||
'jumpToMarker',
|
||||
'jumpToScene',
|
||||
'setButtonEnabled',
|
||||
'script',
|
||||
]
|
||||
|
||||
@@ -58,6 +73,14 @@ function makeDefault(type: Action['type']): Action {
|
||||
const target = others[0] ?? sceneOptions.value[0]
|
||||
return { type: 'jumpToScene', sceneId: target?.id ?? '' }
|
||||
}
|
||||
case 'setButtonEnabled':
|
||||
// Default "disable" — matches the common use case of parking a
|
||||
// button after it's been clicked.
|
||||
return {
|
||||
type: 'setButtonEnabled',
|
||||
layerId: buttonLayerOptions.value[0]?.id ?? '',
|
||||
enabled: false,
|
||||
}
|
||||
case 'script':
|
||||
return { type: 'script', source: '' }
|
||||
}
|
||||
@@ -177,6 +200,26 @@ function onTypeChange(index: number, newType: Action['type']) {
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div v-else-if="a.type === 'setButtonEnabled'" class="params">
|
||||
<label>
|
||||
{{ t('actions.param.buttonLayer') }}
|
||||
<select
|
||||
:value="a.layerId"
|
||||
@change="setAt(i, { type: 'setButtonEnabled', layerId: ($event.target as HTMLSelectElement).value, enabled: a.enabled })"
|
||||
>
|
||||
<option v-if="!buttonLayerOptions.length" value="" disabled>{{ t('actions.noButtonLayers') }}</option>
|
||||
<option v-for="b in buttonLayerOptions" :key="b.id" :value="b.id">{{ b.label }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="bool">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="a.enabled"
|
||||
@change="setAt(i, { type: 'setButtonEnabled', layerId: a.layerId, enabled: ($event.target as HTMLInputElement).checked })"
|
||||
/>
|
||||
{{ t('actions.param.enabled') }}
|
||||
</label>
|
||||
</div>
|
||||
<div v-else-if="a.type === 'script'" class="params">
|
||||
<label class="block">
|
||||
{{ t('actions.param.source') }}
|
||||
|
||||
Reference in new issue
Block a user