mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
The Bhote Koshi layer keeps its panel controls as plain records and presents them to a store; the context rail renders the panel as its last child and marks itself while it is on. Controls are bound to the enable that published them, and an unchanged frame is not sent again.
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
import { defineStore } from 'pinia';
|
|
import { markRaw, shallowRef } from 'vue';
|
|
|
|
/**
|
|
* The Bhote Koshi event's reconstruction panel as its view renders it. The
|
|
* event layer (src/data/bhoteKoshiEvent.js) presents each control's state
|
|
* and the field reports; the view sends clicks and slider moves back to the
|
|
* connected controls.
|
|
*/
|
|
export const useBhoteKoshiPanelStore = defineStore(
|
|
'gev-bhote-koshi-panel',
|
|
() => {
|
|
/**
|
|
* `{owner, sceneBeat, refs, beforeDate, afterDate, reports}`, or null while
|
|
* the event layer is off. Each entry of `refs` holds one control's
|
|
* `textContent`, `hidden`, `disabled`, `value` and `attributes`.
|
|
*/
|
|
const panel = shallowRef(null);
|
|
|
|
/** @param {?object} next A fresh presentation; every publish re-renders. */
|
|
function publish(next) {
|
|
panel.value = next && markRaw(next);
|
|
}
|
|
|
|
/** The controls the panel's buttons, sliders and reports call. */
|
|
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 };
|
|
},
|
|
);
|