mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 09:12:18 +00:00
Stack sprite layers by draw order, flights on top
Each sprite layer's icon or dot set is now made at a draw order taken from SPRITE_LAYER_ORDER through the renderer's per-set drawOrder: flights over military, vessels, directions, transit, bikeshare, FIRMS and CCTV, whichever layer was turned on first. Picks name the topmost first. The orders are negative, so selection highlights, route endpoints, the tracked plane and every other set at the default order still draw over all sprite layers, as they did before. The raise-to-top restorer, the sprite registry and the primitive-name lookups are gone, which takes spriteOrder.js off the viewer-access list. Before, the restorer raised the layers to the bottom of the scene in the order they were enabled, so flights usually ended up under the others.
This commit is contained in:
1 parent
657ef94f77
commit
c073064507
40 files changed
+271
-562
No files matched your search
@@ -957,8 +957,6 @@ export function createDirectionsLayer({ services, source }) {
|
||||
* @type {{markers: object, steps: object, route: object}|null}
|
||||
*/
|
||||
let _sets = null;
|
||||
/** The registration of the dots in the shared sprite order. */
|
||||
let _spriteEntry = null;
|
||||
/** Whether a route is drawn. */
|
||||
let _routeDrawn = false;
|
||||
/**
|
||||
@@ -1002,9 +1000,6 @@ export function createDirectionsLayer({ services, source }) {
|
||||
|
||||
/** Let the layer's draw sets go. */
|
||||
function detachSets() {
|
||||
if (_spriteEntry)
|
||||
services.sprites.unregisterSpriteCollection?.('directions', _spriteEntry);
|
||||
_spriteEntry = null;
|
||||
if (!_sets) return;
|
||||
for (const set of Object.values(_sets)) set.dispose();
|
||||
_sets = null;
|
||||
@@ -1275,7 +1270,6 @@ export function createDirectionsLayer({ services, source }) {
|
||||
_anchorStartedAt = Date.now();
|
||||
anchorStepPoints();
|
||||
syncRenderHold();
|
||||
services.sprites.restoreSpriteOrder(_viewer);
|
||||
services.render.governorRequestRender('directions-route');
|
||||
}
|
||||
|
||||
@@ -1719,16 +1713,14 @@ export function createDirectionsLayer({ services, source }) {
|
||||
id: `${prefix}:steps`,
|
||||
blend: 'translucent',
|
||||
show: false,
|
||||
drawOrder: services.sprites.spriteDrawOrder?.('directions') ?? 0,
|
||||
}),
|
||||
route: draw.lines({ id: `${prefix}:route` }),
|
||||
};
|
||||
// Drawn from the start, empty, so the dots take their place in the
|
||||
// scene now, as their collection did; their place among the other
|
||||
// sprite layers is the sprite order's.
|
||||
// sprite layers is their draw order.
|
||||
_sets.steps.set([]);
|
||||
_spriteEntry =
|
||||
services.sprites.registerSpriteSet?.('directions', _sets.steps.id) ??
|
||||
null;
|
||||
_enabled = false;
|
||||
_mode = DEFAULT_DIRECTIONS_MODE;
|
||||
disarm();
|
||||
@@ -1740,7 +1732,6 @@ export function createDirectionsLayer({ services, source }) {
|
||||
_flightStep = null;
|
||||
_overlayHost.setVisible(DIRECTIONS_STEP_OVERLAY_SOURCE_ID, false);
|
||||
_overlayHost.setVisible(DIRECTIONS_MARKER_OVERLAY_SOURCE_ID, false);
|
||||
services.sprites.restoreSpriteOrder(viewer);
|
||||
console.log('[Data:Directions] Initialized');
|
||||
},
|
||||
|
||||
@@ -1761,7 +1752,6 @@ export function createDirectionsLayer({ services, source }) {
|
||||
typeof pickedId === 'string' && pickedId.startsWith('directions:'),
|
||||
);
|
||||
syncRenderHold();
|
||||
services.sprites.restoreSpriteOrder(viewer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user