mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Change icon set billboards in place instead of rebuilding the collection
An icon set's upsert, set, remove and an atlas registered again now restyle, move, re-image, add and remove billboards in the collection the set already has, so markers no longer blink as every image reloads on each change. A changed image swaps on its own billboard; the old one keeps drawing until the new one has loaded. The set is still built anew where changing it in place would not draw the same: when new icons would land ahead of drawn ones, when a set reorders its items, when a key's generated image comes as a new canvas, when the set is emptied, and when its collection would hold many more images than it draws (a collection keeps every image it has loaded). Adds the draw.icons.update conformance check.
This commit is contained in:
1 parent
3d320035b6
commit
1aa280b43f
5 files changed
+464
-41
No files matched your search
@@ -675,7 +675,7 @@ test('clampState drapes without tiles and overlays shown ones, told on change',
|
||||
ports.dispose();
|
||||
});
|
||||
|
||||
test('an icon draws its atlas slot once the atlas has it, and again when it changes', () => {
|
||||
test('an icon draws its atlas slot once the atlas has it, and swaps it when it changes', () => {
|
||||
const { widget, scene } = tickingWidget();
|
||||
const list = [];
|
||||
scene.primitives = listedPrimitives(list);
|
||||
@@ -698,10 +698,12 @@ test('an icon draws its atlas slot once the atlas has it, and again when it chan
|
||||
assert.equal(first.get(0).image, 'dot.png');
|
||||
ports.draw.atlas('other', { dot: 'other.png' });
|
||||
assert.equal(list.at(-1), first, 'another atlas leaves the set alone');
|
||||
const dot = first.get(0);
|
||||
ports.draw.atlas('conf', { dot: 'next.png', ring: 'ring.png' });
|
||||
assert.notEqual(list.at(-1), first, 'rebuilt');
|
||||
assert.equal(list.at(-1), first, 'changed in place');
|
||||
assert.equal(first.get(0), dot, 'the same billboard, its image swapped');
|
||||
assert.deepEqual(
|
||||
[list.at(-1).get(0).image, list.at(-1).get(1).image],
|
||||
[first.get(0).image, first.get(1).image],
|
||||
['next.png', 'ring.png'],
|
||||
);
|
||||
ports.dispose();
|
||||
|
||||
Reference in new issue
Block a user