mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat(annotations): render the screen-space annotation board from a store
The screen annotation renderer keeps each mark's SVG parts as attribute records and presents the board to a store after every rendered frame; a view teleports it to the page and hands back the callout text and mark groups the renderer measures. The tracked-entity fade is measured once the frame is in the document, removed marks fade out before they leave, and the styles it injected move to annotations.css.
This commit is contained in:
1 parent
265aa605bd
commit
662f51fdf3
13 files changed
+768
-672
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { markRaw, shallowRef } from 'vue';
|
||||
|
||||
/**
|
||||
* The screen-space annotation board as its view renders it. The screen
|
||||
* annotation renderer (src/annotations/screenAnnotationRenderer.js) presents
|
||||
* every mark's SVG parts after each rendered frame; the view hands back the
|
||||
* elements the renderer measures and reports when a draw-on stroke finishes.
|
||||
*/
|
||||
export const useScreenAnnotationsStore = defineStore(
|
||||
'gev-screen-annotations',
|
||||
() => {
|
||||
/**
|
||||
* `{owner, viewBox, markers, marks}`, or null while no renderer exists.
|
||||
* Each mark is `{key, className, opacity, display, drawn, children}`;
|
||||
* `owner` is passed back with each element and report.
|
||||
*/
|
||||
const board = shallowRef(null);
|
||||
|
||||
/** @param {?object} next A fresh presentation; every publish re-renders. */
|
||||
function publish(next) {
|
||||
board.value = next && markRaw(next);
|
||||
}
|
||||
|
||||
/**
|
||||
* The controls whose `attach(owner, key, kind, element)` and
|
||||
* `drawn(owner, key)` the view calls.
|
||||
*/
|
||||
const controls = shallowRef(null);
|
||||
|
||||
/** @param {?object} next The controls, or null to disconnect. */
|
||||
function connect(next) {
|
||||
controls.value = next && markRaw(next);
|
||||
}
|
||||
|
||||
return { board, publish, controls, connect };
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user