fix(satellites): class choices survive a reload and travel in share links

Only catalog and the tracked satellite were saved for the layer, so a class
chip lasted until the next reload and no share link carried it. The choice
is now the satellites option `classes`: one letter per class shown
(`sitpd` by default, `0` for none), with Starlink left to `catalog`, and
the layer takes the letters back through setParams. A partial request
(`{debris: false}`) hides only what it names.
This commit is contained in:
Sameh Khamis committed 2026-11-08 15:16:01 -08:00
1 parent 8ae56587c3
commit c84cfcadeb
9 files changed
+148 -12

No files matched your search

+11 -4
View File
@@ -1,4 +1,5 @@
import { satelliteClassText } from '../../data/satelliteClass.js';
import { decodeSatelliteClassMask } from '../../data/satelliteClassMask.js';
import * as Cesium from 'cesium';
import { t } from '../../i18n/index.js';
import {
@@ -493,16 +494,22 @@ export function createControls({ state: layerState, services, parts, source }) {
let catalog = params.catalog;
if (catalog !== undefined && catalog !== 'core' && catalog !== 'dense')
return false;
// A saved or shared choice arrives as class letters (layerState.js).
const requestedClasses =
typeof params.classes === 'string'
? decodeSatelliteClassMask(params.classes)
: params.classes;
if (params.classes !== undefined) {
if (!params.classes || typeof params.classes !== 'object') return false;
if (!requestedClasses || typeof requestedClasses !== 'object')
return false;
// Starlink's toggle is the dense catalog: its points load on demand.
if (
typeof params.classes.starlink === 'boolean' &&
typeof requestedClasses.starlink === 'boolean' &&
catalog === undefined
)
catalog = params.classes.starlink ? 'dense' : 'core';
catalog = requestedClasses.starlink ? 'dense' : 'core';
layerState._params.classes = mergeClassVisibility(
params.classes,
requestedClasses,
_classes(),
);
}