mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Stamp a GeoJSON point's marker-symbol on its pin again
The local GeoJSON layers drew every point on the plain pin once they drew through the draw port. A marker-symbol is stamped on the pin again as the default renderer's loader stamped it: a one-character string as bold upper-case text, any other value as the Maki icon of that id from the renderer's assets, and the plain pin when the icon cannot be loaded. The pins are drawn on a canvas without the renderer, and the icons load before the sets are built, as the loader waited for its pins.
This commit is contained in:
1 parent
0d9b96badf
commit
c5fffae09e
8 files changed
+750
-48
No files matched your search
@@ -166,3 +166,43 @@ test('a toggle-off frees the entities and a toggle-on rebuilds them from the cac
|
||||
assert.equal(fetchMock.mock.callCount(), 1, 'no second fetch for a bundled dataset');
|
||||
assert.equal(env.layer.getLodDiagnostics().total, 1);
|
||||
});
|
||||
|
||||
test('destroy while a pin icon loads cancels it and leaves no late objects', async t => {
|
||||
const saved = {
|
||||
document: globalThis.document, CESIUM_BASE_URL: globalThis.CESIUM_BASE_URL,
|
||||
createImageBitmap: globalThis.createImageBitmap,
|
||||
};
|
||||
globalThis.document = { createElement: () => ({ getContext: () => ({}) }), baseURI: 'http://gev.test/' };
|
||||
globalThis.CESIUM_BASE_URL = '/cesium/';
|
||||
globalThis.createImageBitmap = async () => ({ width: 1, height: 1 });
|
||||
t.after(() => {
|
||||
for (const [name, value] of Object.entries(saved))
|
||||
if (value === undefined) delete globalThis[name];
|
||||
else globalThis[name] = value;
|
||||
});
|
||||
const env = harness(t);
|
||||
const entered = deferred();
|
||||
const release = deferred();
|
||||
let iconSignal;
|
||||
const pinned = JSON.stringify({
|
||||
type: 'Feature', id: 'pin', properties: { 'marker-symbol': 'rail' },
|
||||
geometry: { type: 'Point', coordinates: [0, 0] },
|
||||
});
|
||||
t.mock.method(globalThis, 'fetch', async (url, options) => {
|
||||
if (!String(url).includes('/maki/')) return { ok: true, text: async () => pinned };
|
||||
iconSignal = options.signal;
|
||||
entered.resolve();
|
||||
await release.promise;
|
||||
return { ok: false };
|
||||
});
|
||||
const loading = env.layer.enable(env.viewer);
|
||||
await entered.promise;
|
||||
env.layer.destroy(env.viewer);
|
||||
assert.equal(iconSignal.aborted, true);
|
||||
release.resolve();
|
||||
await loading;
|
||||
assert.equal(env.fake.liveSets().length, 0);
|
||||
assert.equal(env.listeners.size, 0);
|
||||
assert.equal(env.handlers(), 0);
|
||||
assert.equal(getContextStore().entities.size, 0);
|
||||
});
|
||||
Reference in new issue
Block a user