Skip to content

Commit a330045

Browse files
removal of console logs
1 parent ac43de9 commit a330045

File tree

5 files changed

+5
-101
lines changed

5 files changed

+5
-101
lines changed

src/components/BasemapControl.vue

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,10 @@
6262
return
6363
}
6464
65-
console.log('[BasemapControl] selectStyle called:', style.title, style.uri)
66-
console.log('[BasemapControl] Current map style before change:', map.getStyle()?.name || 'unknown')
67-
6865
// Switch to new basemap style
6966
map.setStyle(style.uri)
7067
activeStyle.value = style.title
7168
showDropdown.value = false
72-
73-
console.log('[BasemapControl] setStyle() called, waiting for style.load event...')
74-
75-
// Note: LocationsLayer component automatically re-adds its layers
76-
// when it detects the new style has loaded via its reactive watch
7769
}
7870
7971
function handleClickOutside(event) {

src/components/LayerPaintControl.vue

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,69 +23,47 @@ const { map } = useMap()
2323
// Helper function to check if layer is ready
2424
function isLayerReady() {
2525
const mapObj = unref(map)
26-
const exists = mapObj && mapObj.getLayer(props.id)
27-
console.log(`[LayerPaintControl] isLayerReady check for ${props.id}:`, exists)
28-
if (mapObj) {
29-
console.log(`[LayerPaintControl] Map style loaded:`, mapObj.isStyleLoaded())
30-
console.log(`[LayerPaintControl] All layers on map:`, mapObj.getStyle()?.layers?.map(l => l.id) || [])
31-
}
32-
return exists
26+
return mapObj && mapObj.getLayer(props.id)
3327
}
3428
3529
// Watch for paint changes and apply them to the layer
3630
watch(
3731
() => props.paint,
3832
(newPaint) => {
39-
console.log(`[LayerPaintControl] Paint prop changed for layer: ${props.id}`)
4033
const mapObj = unref(map)
4134
const layerExists = isLayerReady()
4235
4336
if (!layerExists) {
44-
console.log(`[LayerPaintControl] Layer ${props.id} not ready, will retry in 100ms`)
4537
// Retry after a short delay if layer doesn't exist yet
4638
setTimeout(() => {
4739
const retryMapObj = unref(map)
4840
const retryLayerExists = retryMapObj && retryMapObj.getLayer(props.id)
49-
console.log(`[LayerPaintControl] Retry check for ${props.id}:`, retryLayerExists)
5041
if (retryLayerExists) {
51-
console.log(`[LayerPaintControl] Applying paint properties on retry for ${props.id}`)
5242
applyPaintProperties(retryMapObj, newPaint)
53-
} else {
54-
console.log(`[LayerPaintControl] Layer ${props.id} still not available after retry`)
5543
}
5644
}, 100)
5745
return
5846
}
5947
60-
console.log(`[LayerPaintControl] Layer ${props.id} exists, applying paint properties`)
6148
applyPaintProperties(mapObj, newPaint)
6249
},
6350
{ deep: true, immediate: true }
6451
)
6552
6653
// Separate function to apply paint properties
6754
function applyPaintProperties(mapObj, paint) {
68-
console.log(`[LayerPaintControl] applyPaintProperties called for ${props.id}`)
69-
console.log(`[LayerPaintControl] Map object available:`, !!mapObj)
70-
console.log(`[LayerPaintControl] Layer exists:`, !!mapObj?.getLayer(props.id))
71-
console.log(`[LayerPaintControl] Paint properties to apply:`, Object.keys(paint))
72-
7355
if (!mapObj || !mapObj.getLayer(props.id)) {
74-
console.log(`[LayerPaintControl] Cannot apply paint - map or layer not available`)
7556
return
7657
}
7758
7859
// Apply each paint property to the layer
7960
Object.keys(paint).forEach((property) => {
8061
try {
81-
console.log(`[LayerPaintControl] Setting paint property "${property}" for ${props.id}`)
8262
mapObj.setPaintProperty(props.id, property, paint[property])
83-
console.log(`[LayerPaintControl] Successfully set "${property}" for ${props.id}`)
8463
} catch (error) {
85-
console.error(`[LayerPaintControl] Failed to set paint property ${property} for layer ${props.id}:`, error)
64+
console.error(`Failed to set paint property ${property} for layer ${props.id}:`, error)
8665
}
8766
})
88-
console.log(`[LayerPaintControl] Finished applying all paint properties for ${props.id}`)
8967
}
9068
</script>
9169

src/components/MapComponent.vue

Lines changed: 3 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ const map = computed(() => mapInstance.value)
6666
provide('map', map)
6767
6868
function onMapCreated(map) {
69-
console.log('[MapComponent] onMapCreated called')
70-
mapInstance.value = map
69+
mapInstance.value = map
7170
7271
// Create popup instance for hover
7372
hoverPopup.value = new mapboxgl.Popup({
@@ -78,19 +77,13 @@ function onMapCreated(map) {
7877
7978
// Listen for style changes (when basemap is changed)
8079
map.on('style.load', () => {
81-
console.log('[MapComponent] style.load event fired')
82-
console.log('[MapComponent] Current layers on map:', map.getStyle().layers?.map(l => l.id) || [])
83-
console.log('[MapComponent] Current sources on map:', Object.keys(map.getStyle().sources || {}))
84-
8580
// Increment counter to force MapLayer components to re-render with new keys
8681
styleChangeCounter.value++
87-
console.log('[MapComponent] Style change counter incremented to:', styleChangeCounter.value)
8882
8983
// Wait for style to be fully loaded before re-initializing layers
9084
// MapboxLayer components need the style to be ready before they can add layers
9185
const waitForStyleReady = () => {
9286
if (map.isStyleLoaded()) {
93-
console.log('[MapComponent] Style is ready, re-initializing layers')
9487
// Clear existing layers from store to force re-render
9588
mapStore.mapboxLayers = []
9689
// Small delay to ensure MapboxLayer components have time to clean up
@@ -99,7 +92,6 @@ function onMapCreated(map) {
9992
initializeMap()
10093
}, 50)
10194
} else {
102-
console.log('[MapComponent] Style not ready yet, waiting...')
10395
setTimeout(waitForStyleReady, 50)
10496
}
10597
}
@@ -108,49 +100,28 @@ function onMapCreated(map) {
108100
109101
// Wait for initial style to load before adding sources/layers
110102
if (map.isStyleLoaded()) {
111-
console.log('[MapComponent] Style already loaded, initializing immediately')
112103
setupActiveLocationLayer()
113104
initializeMap()
114105
} else {
115-
console.log('[MapComponent] Style not loaded yet, waiting for style.load event')
116106
map.once('style.load', () => {
117-
console.log('[MapComponent] Initial style.load event fired')
118107
setupActiveLocationLayer()
119108
initializeMap()
120109
})
121110
}
122111
}
123112
124113
function initializeMap() {
125-
console.log('[MapComponent] initializeMap called')
126-
const mapObj = mapInstance.value
127-
console.log('[MapComponent] Map instance available:', !!mapObj)
128-
console.log('[MapComponent] Map style loaded:', mapObj?.isStyleLoaded())
129-
130114
mapStore.initializeMapboxLayers()
131-
console.log('[MapComponent] mapboxLayers after initializeMapboxLayers:', mapStore.mapboxLayers.map(l => l.id))
132-
133115
locationsStore.fetchLocations().then(() => {
134-
console.log('[MapComponent] Locations fetched, refreshing layers')
135-
console.log('[MapComponent] Locations count:', locationsStore.locations.length)
136116
mapStore.refreshLayers()
137-
console.log('[MapComponent] Layers refreshed, mapboxLayers:', mapStore.mapboxLayers.map(l => l.id))
138117
})
139118
}
140119
141120
// Setup active-location layer for highlighting selected location
142121
function setupActiveLocationLayer() {
143122
const mapObj = mapInstance.value
144-
console.log('[MapComponent] setupActiveLocationLayer called')
145-
console.log('[MapComponent] Map object available:', !!mapObj)
146-
console.log('[MapComponent] active-location source exists:', !!mapObj?.getSource('active-location'))
147-
148-
if (!mapObj || mapObj.getSource('active-location')) {
149-
console.log('[MapComponent] Skipping setupActiveLocationLayer - map not available or source already exists')
150-
return
151-
}
123+
if (!mapObj || mapObj.getSource('active-location')) return
152124
153-
console.log('[MapComponent] Adding active-location source and layer')
154125
mapObj.addSource('active-location', {
155126
type: 'geojson',
156127
data: { type: 'FeatureCollection', features: [] },
@@ -166,7 +137,6 @@ function setupActiveLocationLayer() {
166137
'circle-stroke-color': '#ff0000',
167138
},
168139
})
169-
console.log('[MapComponent] active-location layer added successfully')
170140
}
171141
172142
// Handle click on location layer
@@ -261,33 +231,21 @@ function handleLayerMouseleave(layerId) {
261231
262232
// Function to update locations layer source data with filtered locations
263233
function updateLocationsSourceData() {
264-
console.log('[MapComponent] updateLocationsSourceData called')
265234
const mapObj = mapInstance.value
266-
console.log('[MapComponent] Map object available:', !!mapObj)
267-
console.log('[MapComponent] locations-layer exists:', !!mapObj?.getLayer('locations-layer'))
268-
269235
if (!mapObj || !mapObj.getLayer('locations-layer')) {
270-
console.log('[MapComponent] Cannot update source data - map or layer not available')
271236
return
272237
}
273238
274239
const layer = mapObj.getLayer('locations-layer')
275240
const sourceId = layer.source || 'locations-layer'
276241
const source = mapObj.getSource(sourceId)
277242
278-
console.log('[MapComponent] Source ID:', sourceId)
279-
console.log('[MapComponent] Source exists:', !!source)
280-
console.log('[MapComponent] Source type:', source?.type)
281-
282243
if (!source || source.type !== 'geojson') {
283-
console.log('[MapComponent] Cannot update source data - source not available or wrong type')
284244
return
285245
}
286246
287247
const featureCollection = locationsStore.locationsFeatureCollection
288-
console.log('[MapComponent] Setting source data with', featureCollection.features?.length || 0, 'features')
289248
source.setData(featureCollection)
290-
console.log('[MapComponent] Source data updated successfully')
291249
}
292250
293251
@@ -372,23 +330,17 @@ let setupInProgress = false // Flag to prevent concurrent setups
372330
watch(
373331
() => mapboxLayers.value.find(l => l.id === 'locations-layer'),
374332
(locationsLayer, oldLocationsLayer) => {
375-
console.log('[MapComponent] Watcher triggered for locations-layer')
376-
console.log('[MapComponent] locationsLayer found:', !!locationsLayer)
377-
console.log('[MapComponent] mapInstance available:', !!mapInstance.value)
378-
379333
// Only reset if layer state actually changed (not found → found)
380334
const wasFound = !!oldLocationsLayer
381335
const isFound = !!locationsLayer
382336
383337
if (!wasFound && isFound) {
384338
// Layer just appeared, reset flags
385-
console.log('[MapComponent] Layer state changed: not found → found, resetting flags')
386339
locationsLayerListenersAttached = false
387340
retryCount = 0
388341
} else if (wasFound && isFound) {
389342
// Layer already existed, don't reset - might be a duplicate trigger
390343
if (locationsLayerListenersAttached) {
391-
console.log('[MapComponent] Layer already set up, skipping duplicate setup')
392344
return
393345
}
394346
}
@@ -399,33 +351,27 @@ watch(
399351
const mapObj = mapInstance.value
400352
const layerExists = mapObj?.getLayer('locations-layer')
401353
const styleLoaded = mapObj?.isStyleLoaded()
402-
console.log('[MapComponent] checkAndSetup - locations-layer exists:', !!layerExists)
403-
console.log('[MapComponent] checkAndSetup - map style loaded:', styleLoaded)
404354
405355
if (layerExists && styleLoaded) {
406-
console.log('[MapComponent] Setting up locations layer listeners and data')
407356
retryCount = 0 // Reset on success
408357
setupLocationsLayerListeners()
409358
updateLocationsSourceData()
410359
411360
if (mapObj.getLayer('active-location-layer') && mapObj.getLayer('locations-layer')) {
412361
try {
413362
mapObj.moveLayer('active-location-layer')
414-
console.log('[MapComponent] Moved active-location-layer to top')
415363
} catch (e) {
416-
console.warn('[MapComponent] Layer movement failed:', e)
364+
// Layer movement failed, but not critical
417365
}
418366
}
419367
setupInProgress = false // Clear flag on success
420368
} else {
421369
retryCount++
422370
if (retryCount >= MAX_RETRIES) {
423-
console.error('[MapComponent] Max retries reached, giving up on locations-layer setup')
424371
retryCount = 0
425372
setupInProgress = false
426373
return
427374
}
428-
console.log(`[MapComponent] Layer not ready yet (retry ${retryCount}/${MAX_RETRIES}), retrying in 100ms`)
429375
setTimeout(checkAndSetup, 100)
430376
}
431377
}

src/components/MapLayer.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,8 @@
2323
},
2424
},
2525
mounted () {
26-
console.log(`[MapLayer] Component mounted for layer: ${this.layer?.id}`)
2726
const { map } = useMap()
2827
this.map = map
29-
console.log(`[MapLayer] Map instance available for ${this.layer?.id}:`, !!unref(map))
30-
},
31-
updated () {
32-
console.log(`[MapLayer] Component updated for layer: ${this.layer?.id}`)
3328
},
3429
methods: {
3530
onLayerClicked (e) {

src/stores/map.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,28 @@ export const useMapStore = defineStore('map', {
1111

1212
actions: {
1313
initializeMapboxLayers () {
14-
console.log('[MapStore] initializeMapboxLayers called')
1514
const locationsStore = useLocationsStore()
1615

1716
// Collect all layer configs
1817
const allLayerConfigs = []
1918

2019
// 1. Add locations layer from locations store
2120
const locationsLayerConfig = locationsStore.locationsLayerConfig
22-
console.log('[MapStore] locationsLayerConfig:', !!locationsLayerConfig)
2321
if (locationsLayerConfig) {
2422
allLayerConfigs.push(locationsLayerConfig)
25-
console.log('[MapStore] Added locationsLayerConfig to allLayerConfigs')
2623
}
2724

2825
// 2. Add static layers (WMS/WMTS from config files if needed in future)
2926
allLayerConfigs.push(...this.staticLayerConfigs)
30-
console.log('[MapStore] Total layer configs before transform:', allLayerConfigs.length)
3127

3228
// Transform all configs to Mapbox format
3329
this.mapboxLayers = allLayerConfigs
3430
.map(layerConfig => buildMapboxLayer(layerConfig))
3531
.filter(layer => layer != null)
36-
37-
console.log('[MapStore] mapboxLayers after transform:', this.mapboxLayers.map(l => l.id))
3832
},
3933

4034
// Method to update layers when locations change
4135
refreshLayers () {
42-
console.log('[MapStore] refreshLayers called')
4336
this.initializeMapboxLayers()
4437
},
4538
},

0 commit comments

Comments
 (0)