mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
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.
63 lines
1.7 KiB
JavaScript
63 lines
1.7 KiB
JavaScript
import { FILTER_DEFAULT } from './policy.js';
|
|
|
|
/**
|
|
* The per-image fields of `state.street` with no image open; closing resets
|
|
* exactly these (host and render mode outlive an image).
|
|
*/
|
|
export function freshStreet() {
|
|
return {
|
|
open: false,
|
|
providerId: null,
|
|
providerName: null,
|
|
providerLabel: null,
|
|
imageId: null,
|
|
position: null,
|
|
bearing: null,
|
|
tilt: null,
|
|
altitude: null,
|
|
isPano: false,
|
|
capturedAt: null,
|
|
/** 'day', or 'month' for providers that date images by month (Google). */
|
|
capturedAtPrecision: 'day',
|
|
/** A place name for the caption (Google's address), or null. */
|
|
title: null,
|
|
/** Whether the open viewer has FIT/FILL render modes. */
|
|
renderModes: true,
|
|
sequenceId: null,
|
|
creator: null,
|
|
license: null,
|
|
externalUrl: null,
|
|
loading: false,
|
|
error: null,
|
|
};
|
|
}
|
|
|
|
/** Mutable core state, created once per layer instance. */
|
|
export function createState({ services }) {
|
|
return {
|
|
services,
|
|
viewer: null,
|
|
enabled: false,
|
|
listeners: new Set(),
|
|
notify: null,
|
|
/** Shared imagery filter, in the stored (relative-days) form. */
|
|
filter: { ...FILTER_DEFAULT },
|
|
/** @type {Map<string, {def: object, instance: object, on: boolean, status: object|null}>} */
|
|
providers: new Map(),
|
|
|
|
street: {
|
|
host: null,
|
|
/** 'letterbox' shows the whole image; 'fill' crops it to the frame. */
|
|
renderMode: 'letterbox',
|
|
...freshStreet(),
|
|
},
|
|
|
|
/** Whether the camera is low enough for a ground click to open an image. */
|
|
groundClickReady: false,
|
|
|
|
/** The open image's marker: its draw set and drawn icon. */
|
|
marker: { set: null, placed: null, look: null },
|
|
clickSubscription: null,
|
|
};
|
|
}
|