Files
gods-eye-view/src/ui/stores/sceneInteractions.js
T
Sameh Khamis 59e3aaa271 feat(scenes): render the Scene actions panel from a store
The scene interactions owner keeps the pick handler and the interaction
session and presents the panel to the gev-scene-interactions store; the
SceneInteractions view teleports it into the viewer's container with the
same markup and inline styles. Each activation keys its own panel, each
button carries the owner it was rendered for, and only the owner the
store shows may change or remove it.
2026-10-31 20:14:35 -07:00

36 lines
1.2 KiB
JavaScript

import { defineStore } from 'pinia';
import { markRaw, shallowRef } from 'vue';
/**
* The active shot's Scene actions panel as its view renders it. The scene
* interactions owner (src/scenes/interactions.js) presents the actions, the
* status line and the source card here; the view sends action clicks back to
* the connected controls.
*/
export const useSceneInteractionsStore = defineStore(
'gev-scene-interactions',
() => {
/**
* `{id, owner, container, items, status, busy, selected, outlined,
* card}`, or null while the shot has no actions. `container` is the
* element it sits in; `owner` is passed back with each dispatch.
*/
const panel = shallowRef(null);
/** @param {?object} next A fresh presentation; every publish re-renders. */
function publish(next) {
panel.value = next && markRaw(next);
}
/** The controls whose `dispatch(id, owner)` an action button calls. */
const controls = shallowRef(null);
/** @param {?object} next The controls, or null to disconnect. */
function connect(next) {
controls.value = next && markRaw(next);
}
return { panel, publish, controls, connect };
},
);