mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
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.
This commit is contained in:
1 parent
6398103b60
commit
59e3aaa271
8 files changed
+376
-104
No files matched your search
@@ -0,0 +1,35 @@
|
||||
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 };
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user