mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Add fields' alpha, paused, shell detail and a drawn event, in the contract and the stub
windStreamlines takes alpha and paused; rasterShell replaces detailWindow
with a detail image and rectangle and says how shells stack, blend and
update; FieldHandle.on('drawn') says once per change that it is drawn,
never while hidden. The stub fires it on the render after a change, and a
conformance check covers it. The Cesium adapter has no fields yet.
This commit is contained in:
1 parent
c32bf3177d
commit
c87bd38d18
4 files changed
+126
-4
No files matched your search
@@ -509,10 +509,39 @@ export function createStubRenderer(options = {}) {
|
||||
if (capabilities.has('fields'))
|
||||
draw.field = (spec) => {
|
||||
const handle = simpleHandle('field', spec);
|
||||
const record = sets.get(spec.id);
|
||||
// 'drawn': once the next render after the spec or an update has drawn
|
||||
// it, while it shows.
|
||||
const drawnListeners = [];
|
||||
let owed = true;
|
||||
const key = { field: spec.id };
|
||||
frameFlushes.set(key, () => {
|
||||
if (!owed || !record.show || sets.get(spec.id) !== record) return;
|
||||
owed = false;
|
||||
deliver(drawnListeners);
|
||||
});
|
||||
const dispose = handle.dispose;
|
||||
handle.dispose = () => {
|
||||
frameFlushes.delete(key);
|
||||
for (const entry of drawnListeners) entry.live = false;
|
||||
drawnListeners.length = 0;
|
||||
dispose();
|
||||
};
|
||||
handle.update = (patch) => {
|
||||
Object.assign(sets.get(spec.id).spec, patch);
|
||||
Object.assign(record.spec, patch);
|
||||
owed = true;
|
||||
requestRender('draw');
|
||||
};
|
||||
handle.on = (event, cb) => {
|
||||
if (event !== 'drawn') return () => {};
|
||||
const entry = { cb, live: true };
|
||||
drawnListeners.push(entry);
|
||||
return () => {
|
||||
entry.live = false;
|
||||
const i = drawnListeners.indexOf(entry);
|
||||
if (i >= 0) drawnListeners.splice(i, 1);
|
||||
};
|
||||
};
|
||||
return handle;
|
||||
};
|
||||
if (capabilities.has('celestial'))
|
||||
|
||||
Reference in new issue
Block a user