mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-04-25 17:14:57 +02:00
fix(20-02): remove static maplibre-gl.css import, fix type errors, wire onTimeRangeChanged
- Remove static maplibre-gl.css import from main.ts (now co-located in MapContainer.ts) - Move onTimeRangeChanged callback into map init callback (map is lazy now) - Fix IntersectionObserver entry destructure for strict TypeScript - MapLibre CSS loads only when MapContainer is dynamically imported Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -688,8 +688,9 @@ export class PanelLayoutManager implements AppModule {
|
||||
mapContainer.appendChild(mapPlaceholder);
|
||||
|
||||
const mapObserver = new IntersectionObserver(
|
||||
async ([entry]) => {
|
||||
if (!entry.isIntersecting) return;
|
||||
async (entries) => {
|
||||
const entry = entries[0];
|
||||
if (!entry?.isIntersecting) return;
|
||||
mapObserver.disconnect();
|
||||
|
||||
try {
|
||||
@@ -717,6 +718,11 @@ export class PanelLayoutManager implements AppModule {
|
||||
this.ctx.map.initEscalationGetters();
|
||||
this.ctx.currentTimeRange = this.ctx.map.getTimeRange();
|
||||
|
||||
this.ctx.map.onTimeRangeChanged((range) => {
|
||||
this.ctx.currentTimeRange = range;
|
||||
this.applyTimeRangeFilterDebounced();
|
||||
});
|
||||
|
||||
// Panels using this.ctx.map?.setCenter() already use optional chaining
|
||||
// so they gracefully handle the map being null before this point.
|
||||
} catch (err) {
|
||||
@@ -1419,11 +1425,6 @@ export class PanelLayoutManager implements AppModule {
|
||||
|
||||
window.addEventListener('resize', () => this.ensureCorrectZones());
|
||||
|
||||
this.ctx.map.onTimeRangeChanged((range) => {
|
||||
this.ctx.currentTimeRange = range;
|
||||
this.applyTimeRangeFilterDebounced();
|
||||
});
|
||||
|
||||
this.applyPanelSettings();
|
||||
this.applyInitialUrlState();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Renders DeckGLMap (WebGL) on desktop, fallback to D3/SVG MapComponent on mobile.
|
||||
* Supports an optional 3D globe mode (globe.gl) selectable from Settings.
|
||||
*/
|
||||
import 'maplibre-gl/dist/maplibre-gl.css';
|
||||
import { isMobileDevice } from '@/utils';
|
||||
import { MapComponent } from './Map';
|
||||
import { DeckGLMap, type DeckMapView, type CountryClickPayload } from './DeckGLMap';
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import './styles/base-layer.css';
|
||||
import './styles/happy-theme.css';
|
||||
import 'maplibre-gl/dist/maplibre-gl.css';
|
||||
|
||||
// === Pre-Sentry error buffer ===
|
||||
// Captures errors thrown before Sentry loads (deferred to requestIdleCallback).
|
||||
|
||||
Reference in New Issue
Block a user