mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Deselecting a plane drawn as a model no longer flashes its icon
A selected plane is drawn by its own model, and its fleet model was let go once that model drew. Deselecting showed the icon at once, and the icon stayed for about a second while a new fleet model loaded. The fleet model now stays loaded but hidden while the plane is selected, kept where the plane is. Deselecting hands the plane back to it in the same frame, and the icon shows only when there is no loaded fleet model. Military aircraft share this code. Vessels never swap models on selection, so they had no flash.
This commit is contained in:
1 parent
36624cd329
commit
b041fea7a6
6 files changed
+248
-43
No files matched your search
@@ -449,3 +449,30 @@ test('models are drawn at their true size, with no minimum pixel size', () => {
|
||||
f.tick();
|
||||
assert.equal(f.fleet().items.get('a1').minPixelSize ?? 0, 0);
|
||||
});
|
||||
|
||||
test('the selected contact keeps a loaded, hidden fleet model that takes it back on deselect', () => {
|
||||
const positions = new Map([['a1', near(1)]]);
|
||||
const f = fleetFixture(positions);
|
||||
// Selected while an icon: the fleet pass admits its model all the same.
|
||||
f.state._trackedIcao = 'a1';
|
||||
f.shown.set('a1', false); // selecting it hides its icon
|
||||
f.tick();
|
||||
assert.ok(f.fleet().items.has('a1'), 'admitted and loading while selected');
|
||||
f.draw.ready(f.fleetId, 'a1');
|
||||
positions.set('a1', near(2));
|
||||
f.tick();
|
||||
const item = f.fleet().items.get('a1');
|
||||
assert.equal(item.show, false, 'never drawn while selected');
|
||||
assert.deepEqual(
|
||||
item.pos,
|
||||
{ x: near(2).x, y: near(2).y, z: near(2).z },
|
||||
'placed where its icon is',
|
||||
);
|
||||
assert.equal(f.shown.get('a1'), false, 'the icon stays hidden');
|
||||
|
||||
// Deselected: its model draws it in the same frame, its icon never shows.
|
||||
f.state._trackedIcao = null;
|
||||
f.models._handBackDeselected('a1');
|
||||
assert.equal(f.fleet().items.get('a1').show, true);
|
||||
assert.equal(f.shown.get('a1'), false);
|
||||
});
|
||||
Reference in new issue
Block a user