mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-11-01 12:17:18 +00:00
lint fixes
This commit is contained in:
1 parent
f5a2db0565
commit
6956c19410
45 files changed
+243
-244
No files matched your search
@@ -87,7 +87,7 @@ export class StyleManager {
|
||||
updateBasemap() {
|
||||
const map_ = get(this._map);
|
||||
if (!map_) return;
|
||||
let basemap = get(currentBasemap);
|
||||
const basemap = get(currentBasemap);
|
||||
this.buildStyle(basemap).then((style) => {
|
||||
if (get(currentBasemap) === basemap) map_.setStyle(style);
|
||||
});
|
||||
@@ -148,18 +148,18 @@ export class StyleManager {
|
||||
const overlayOpacities = get(opacities);
|
||||
try {
|
||||
const layers = getLayers(get(currentOverlays) ?? {});
|
||||
for (let overlay in layers) {
|
||||
for (const overlay in layers) {
|
||||
if (!layers[overlay]) {
|
||||
if (this._pastOverlays.has(overlay)) {
|
||||
const overlayInfo = custom[overlay]?.value ?? overlays[overlay];
|
||||
try {
|
||||
const overlayStyle = await this.get(overlayInfo);
|
||||
for (let layer of overlayStyle.layers ?? []) {
|
||||
for (const layer of overlayStyle.layers ?? []) {
|
||||
if (map_.getLayer(layer.id)) {
|
||||
map_.removeLayer(layer.id);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Should not happen
|
||||
}
|
||||
this._pastOverlays.delete(overlay);
|
||||
@@ -170,13 +170,13 @@ export class StyleManager {
|
||||
const overlayStyle = await this.get(overlayInfo);
|
||||
const opacity = overlayOpacities[overlay];
|
||||
|
||||
for (let sourceId in overlayStyle.sources) {
|
||||
for (const sourceId in overlayStyle.sources) {
|
||||
if (!map_.getSource(sourceId)) {
|
||||
map_.addSource(sourceId, overlayStyle.sources[sourceId]);
|
||||
}
|
||||
}
|
||||
|
||||
for (let layer of overlayStyle.layers ?? []) {
|
||||
for (const layer of overlayStyle.layers ?? []) {
|
||||
if (!map_.getLayer(layer.id)) {
|
||||
if (opacity !== undefined) {
|
||||
if (layer.type === 'raster') {
|
||||
@@ -200,7 +200,7 @@ export class StyleManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
updateTerrain() {
|
||||
@@ -223,7 +223,7 @@ export class StyleManager {
|
||||
|
||||
async get(styleInfo: StyleSpecification | string): Promise<StyleSpecification> {
|
||||
if (typeof styleInfo === 'string') {
|
||||
let styleUrl = styleInfo as string;
|
||||
const styleUrl = styleInfo as string;
|
||||
const response = await fetch(styleUrl, { cache: 'force-cache' });
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error fetching style "${styleInfo}": ${response.status}`);
|
||||
@@ -238,7 +238,7 @@ export class StyleManager {
|
||||
merge(style: StyleSpecification, other: StyleSpecification) {
|
||||
style.sources = { ...style.sources, ...other.sources };
|
||||
const units = get(distanceUnits);
|
||||
for (let layer of other.layers ?? []) {
|
||||
for (const layer of other.layers ?? []) {
|
||||
if ('source' in layer) {
|
||||
if (layer.source == 'contours_m' && units === 'imperial') continue;
|
||||
if (layer.source == 'contours_ft' && units !== 'imperial') continue;
|
||||
|
||||
Reference in new issue
Block a user