diff --git a/package.json b/package.json index 381a878..ff0b6c2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "animatr", "private": true, - "version": "0.10.5", + "version": "0.10.6", "type": "module", "scripts": { "dev": "vite", diff --git a/src/components/ActionEditor.vue b/src/components/ActionEditor.vue index fdf9107..939eccd 100644 --- a/src/components/ActionEditor.vue +++ b/src/components/ActionEditor.vue @@ -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']) { +
+ + +