forked from MapComplete/MapComplete
		
	selected_element layer which highlights the selected element
This commit is contained in:
		
							parent
							
								
									e8ff43312f
								
							
						
					
					
						commit
						42bd301389
					
				
					 13 changed files with 146 additions and 32 deletions
				
			
		|  | @ -286,7 +286,6 @@ export default class ShowDataLayerImplementation { | |||
|         // Leaflet cannot handle geojson points natively
 | ||||
|         // We have to convert them to the appropriate icon
 | ||||
|         // Click handling is done in the next step
 | ||||
| 
 | ||||
|         const layer: LayerConfig = this._layerToShow | ||||
|         if (layer === undefined) { | ||||
|             return | ||||
|  | @ -337,7 +336,6 @@ export default class ShowDataLayerImplementation { | |||
|         const self = this | ||||
| 
 | ||||
|         function activate (event: LeafletMouseEvent) { | ||||
|             console.log("Activating!") | ||||
|             if (infobox === undefined) { | ||||
|                 const tags = | ||||
|                     self.allElements?.getEventSourceById(key) ?? | ||||
|  | @ -350,6 +348,14 @@ export default class ShowDataLayerImplementation { | |||
|                 }) | ||||
|             } | ||||
|             infobox.Activate() | ||||
|             self._selectedElement.setData( self.allElements.ContainingFeatures.get(feature.id) ?? feature ) | ||||
|             event?.originalEvent?.preventDefault() | ||||
|             event?.originalEvent?.stopPropagation() | ||||
|             event?.originalEvent?.stopImmediatePropagation() | ||||
|             if(event?.originalEvent){ | ||||
|                 // This is a total workaround, as 'preventDefault' and everything above seems to be not working
 | ||||
|                 event.originalEvent["dismissed"] = true | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         leafletLayer.addEventListener('click', activate) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue