From 0bbef661928ef46cefd5c324bd14ee04799d9986 Mon Sep 17 00:00:00 2001 From: th Date: Wed, 22 Apr 2026 19:17:48 +0200 Subject: [PATCH] =?UTF-8?q?0.10.6:=20setButtonEnabled=20action=20=E2=80=94?= =?UTF-8?q?=20disable=20buttons=20from=20the=20timeline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 (1M context) --- package.json | 2 +- src/components/ActionEditor.vue | 43 ++++++++++ src/devtools/tests.ts | 145 ++++++++++++++++++++++++++++++++ src/i18n/messages.ts | 4 + src/lib/actions.ts | 11 +++ src/lib/exportPlayer.ts | 10 ++- src/stores/scene.ts | 4 + src/types/scene.ts | 4 + 8 files changed, 221 insertions(+), 2 deletions(-) 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']) { +
+ + +