mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 03:32:19 +00:00
fix(render): Recent Imagery's swipe slots wait for each other's tiles without redrawing
The two slots share one small request budget through one admit hook. When one slot held it, the other's deferred tiles asked the Cesium globe for a redraw every 250 ms, about four extra frames a second while tiles loaded; before, they waited for the holder's tile, whose settling draws the frame that asks again. Layers given the same admit now share their waits: with one of their tiles in flight, nothing more is asked for. A layer deferring while an unrelated layer loads still retries after 250 ms.
This commit is contained in:
1 parent
ecf8b31756
commit
96ef7f509e
3 files changed
+39
-8
No files matched your search
@@ -334,6 +334,29 @@ test('a layer deferring while another has a request in flight asks for a frame',
|
||||
assert.deepEqual(renders, ['imagery']);
|
||||
});
|
||||
|
||||
test('layers sharing an admit wait for each other’s tiles, asking for no frame', (t) => {
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const { scene, port, renders } = setup();
|
||||
// A budget of one shared by two layers, as Recent Imagery's swipe slots.
|
||||
let inFlight = 0;
|
||||
const admit = (_tile, issue) => {
|
||||
if (inFlight >= 1) return undefined;
|
||||
inFlight += 1;
|
||||
return issue();
|
||||
};
|
||||
port.imagery.add({ kind: 'xyz', url: url('a'), admit });
|
||||
port.imagery.add({ kind: 'xyz', url: url('b'), admit });
|
||||
const [holder, waiting] = [0, 1].map(
|
||||
(i) => scene.imageryLayers.get(i).imageryProvider,
|
||||
);
|
||||
Object.getPrototypeOf(holder).requestImage = () => new Promise(() => {});
|
||||
assert.ok(holder.requestImage(0, 0, 1), 'in flight');
|
||||
renders.length = 0;
|
||||
assert.equal(waiting.requestImage(0, 0, 1), undefined);
|
||||
t.mock.timers.tick(TILE_RETRY_DELAY_MS * 4);
|
||||
assert.deepEqual(renders, [], 'the holder’s settling is the later frame');
|
||||
});
|
||||
|
||||
test('fetchTile fetches in place of the provider, with the URL it would fetch', async (t) => {
|
||||
const asked = [];
|
||||
const answers = [{ defer: true }, { missing: true }];
|
||||
|
||||
Reference in new issue
Block a user