diff --git a/calliope-web/src/lib/actions/finishAnimations.ts b/calliope-web/src/lib/actions/finishAnimations.ts new file mode 100644 index 00000000..e3baa42d --- /dev/null +++ b/calliope-web/src/lib/actions/finishAnimations.ts @@ -0,0 +1,18 @@ +import type { Action } from "svelte/action"; + +/** HEL-716: interacting with an arriving result skips its development effect. */ +export const finishAnimations: Action = (node) => { + const finish = () => { + for (const animation of node.getAnimations({ subtree: true })) { + if (animation.playState === "running") animation.finish(); + } + }; + node.addEventListener("pointerdown", finish); + node.addEventListener("keydown", finish); + return { + destroy() { + node.removeEventListener("pointerdown", finish); + node.removeEventListener("keydown", finish); + }, + }; +}; diff --git a/calliope-web/src/lib/components/agent/AgentWorkspace.svelte b/calliope-web/src/lib/components/agent/AgentWorkspace.svelte index 1e91e199..34ddc6ea 100644 --- a/calliope-web/src/lib/components/agent/AgentWorkspace.svelte +++ b/calliope-web/src/lib/components/agent/AgentWorkspace.svelte @@ -1,5 +1,6 @@