mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
feat(ui): render the Contacts panel from the awareness layer's published view
The awareness layer presents its panel as a plain view and publishes it through subscribePanel() instead of writing markup into #military-awareness-panel. AwarenessPanel renders it from the gev-context store, calls the layer's navigation, and keeps focus on the same control by identity across live repaints, continuing at the note when that control leaves or is disabled.
This commit is contained in:
1 parent
749bfd5cd4
commit
1e4df63efe
16 files changed
+582
-380
No files matched your search
@@ -5,7 +5,8 @@ import { markRaw, shallowRef } from 'vue';
|
||||
* The Context panel's mode switch as its view renders it. ContextControls
|
||||
* presents the selected mode, the transition busy state and the nearby
|
||||
* sites search (`_presentContext()`) and publishes them here; it
|
||||
* keeps its listeners and transactions.
|
||||
* keeps its listeners and transactions. The Contacts layer publishes its
|
||||
* panel beside it, and the app connects that layer's navigation.
|
||||
*/
|
||||
export const useContextStore = defineStore('gev-context', () => {
|
||||
/** The presented mode switch; null until the controls first render. */
|
||||
@@ -16,5 +17,31 @@ export const useContextStore = defineStore('gev-context', () => {
|
||||
view.value = markRaw(next);
|
||||
}
|
||||
|
||||
return { view, publish };
|
||||
/** The Contacts panel; null until the layer first publishes. */
|
||||
const awareness = shallowRef(null);
|
||||
|
||||
/** @param {object} next A fresh presentation of the Contacts panel. */
|
||||
function publishAwareness(next) {
|
||||
awareness.value = next && markRaw(next);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Contacts layer whose navigation the panel calls: `navigatePrevious`,
|
||||
* `focusCurrent`, `navigateNext` and `focusTarget`.
|
||||
*/
|
||||
const awarenessLayer = shallowRef(null);
|
||||
|
||||
/** @param {?object} layer The Contacts layer, or null to disconnect. */
|
||||
function connectAwareness(layer) {
|
||||
awarenessLayer.value = layer && markRaw(layer);
|
||||
}
|
||||
|
||||
return {
|
||||
view,
|
||||
publish,
|
||||
awareness,
|
||||
publishAwareness,
|
||||
awarenessLayer,
|
||||
connectAwareness,
|
||||
};
|
||||
});
|
||||
Reference in new issue
Block a user