fix(web): add shared DemSource singleton, add ErrorBoundary, and conditional view rendering to prevent WebGL crash
This commit is contained in:
@@ -1,16 +1,7 @@
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import maplibregl from 'maplibre-gl';
|
||||
import mlcontour from 'maplibre-contour';
|
||||
|
||||
const demSource = new mlcontour.DemSource({
|
||||
url: 'https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png',
|
||||
encoding: 'terrarium',
|
||||
maxzoom: 15,
|
||||
worker: true,
|
||||
cacheSize: 100,
|
||||
});
|
||||
demSource.setupMaplibre(maplibregl);
|
||||
import 'maplibre-gl/dist/maplibre-gl.css';
|
||||
import { getSharedDemSource } from '../utils/demSource';
|
||||
import {
|
||||
Shield,
|
||||
Crosshair,
|
||||
@@ -456,6 +447,7 @@ export const TacticalDefenseView: React.FC = () => {
|
||||
});
|
||||
|
||||
// Dynamic On-the-Fly Contours from Elevation DEM
|
||||
const demSource = getSharedDemSource();
|
||||
const contourUrl = demSource.contourProtocolUrl({
|
||||
thresholds: {
|
||||
10: [100, 500],
|
||||
|
||||
Reference in New Issue
Block a user