mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
feat(celestial-ring): render the full-globe ring from a store
The celestial ring presents its overlay to a store and the scene chrome renders it in the globe container, handing back the two canvases the ring paints. The application shell passes the store in so the keyhole helpers other packages import stay free of Vue. Without its canvases the ring still tracks whether the globe is framed and turns itself off.
This commit is contained in:
1 parent
fd0d51c450
commit
265aa605bd
10 files changed
+496
-90
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { markRaw, shallowRef } from 'vue';
|
||||
|
||||
/**
|
||||
* The full-globe celestial ring as its view renders it. The ring owner
|
||||
* (src/celestialRing.js) presents the overlay's state, the outline and where
|
||||
* the sun and moon layers and markers sit; the view hands its two canvases
|
||||
* back to the connected controls, which paint them.
|
||||
*/
|
||||
export const useCelestialRingStore = defineStore('gev-celestial-ring', () => {
|
||||
/**
|
||||
* `{owner, container, enabled, visible, globeVisible, ephemerisUpdates,
|
||||
* size, outline, sun, moon, sunMarker, moonMarker}`, or null while no ring
|
||||
* exists. `container` is the element it sits in; `owner` is passed back
|
||||
* with each canvas.
|
||||
*/
|
||||
const ring = shallowRef(null);
|
||||
|
||||
/** @param {?object} next A fresh presentation; every publish re-renders. */
|
||||
function publish(next) {
|
||||
ring.value = next && markRaw(next);
|
||||
}
|
||||
|
||||
/** The controls whose `attach(owner, kind, canvas)` each canvas calls. */
|
||||
const controls = shallowRef(null);
|
||||
|
||||
/** @param {?object} next The controls, or null to disconnect. */
|
||||
function connect(next) {
|
||||
controls.value = next && markRaw(next);
|
||||
}
|
||||
|
||||
return { ring, publish, controls, connect };
|
||||
});
|
||||
Reference in new issue
Block a user