fix: resolve MapLibre worker rendering regression by configuring custom worker and updating geometry type filters
This commit is contained in:
@@ -198,7 +198,7 @@ const MapComponent: React.FC<MapProps> = ({
|
||||
id: 'los-line',
|
||||
type: 'line',
|
||||
source: 'los-source',
|
||||
filter: ['==', '$type', 'LineString'],
|
||||
filter: ['==', ['geometry-type'], 'LineString'],
|
||||
layout: { 'line-cap': 'round', 'line-join': 'round' },
|
||||
paint: {
|
||||
'line-color': '#f59e0b',
|
||||
@@ -211,7 +211,7 @@ const MapComponent: React.FC<MapProps> = ({
|
||||
id: 'los-points',
|
||||
type: 'circle',
|
||||
source: 'los-source',
|
||||
filter: ['==', '$type', 'Point'],
|
||||
filter: ['==', ['geometry-type'], 'Point'],
|
||||
paint: {
|
||||
'circle-radius': 8,
|
||||
'circle-color': [
|
||||
@@ -230,7 +230,7 @@ const MapComponent: React.FC<MapProps> = ({
|
||||
id: 'los-labels',
|
||||
type: 'symbol',
|
||||
source: 'los-source',
|
||||
filter: ['==', '$type', 'Point'],
|
||||
filter: ['==', ['geometry-type'], 'Point'],
|
||||
layout: {
|
||||
'text-field': ['get', 'label'],
|
||||
'text-size': 12,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import maplibregl from 'maplibre-gl'
|
||||
import maplibregl from './utils/maplibreWorker'
|
||||
import App from './App.tsx'
|
||||
import CompareView from './pages/CompareView'
|
||||
import IntelligenceDashboard from './pages/IntelligenceDashboard'
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
import maplibregl from 'maplibre-gl';
|
||||
import workerUrl from 'maplibre-gl/dist/maplibre-gl-csp-worker.js?url';
|
||||
|
||||
// MapLibre 5 serializes its embedded worker from functions. Vite's class-field
|
||||
// transform injects __publicField outside those functions, leaving GeoJSON
|
||||
// workers with an undefined helper. Serve the matching standalone worker as an
|
||||
// untransformed asset in both development and production, before any map exists.
|
||||
maplibregl.setWorkerUrl(workerUrl);
|
||||
|
||||
export default maplibregl;
|
||||
Reference in New Issue
Block a user