@ -37,7 +37,7 @@ export default class extends Controller {
var layer = L . featureGroup ( ) ;
var layer2 = L . featureGroup ( ) ;
var overpassLayer = L . featureGroup ( ) ;
if ( this . overpassResultValue !== '' ) {
geojsons = JSON . parse ( this . overpassResultValue ) ;
if ( geojsons . elements . length > 0 ) {
@ -47,12 +47,12 @@ export default class extends Controller {
color : '#0dcaf0' ,
weight : 6 ,
opacity : 0.8 ,
} ) . addTo ( layer2 ) . bindPopup ( L . popup ( {
} ) . addTo ( overpassLayer ) . bindPopup ( L . popup ( {
overpassElement : element ,
} ) . setContent ( '…' ) ) ;
} ) ;
} ) ;
layer2 . on ( 'popupopen' , function ( event ) {
overpassLayer . on ( 'popupopen' , function ( event ) {
var element = event . popup . options . overpassElement ;
delete element . members ;
element [ 'map' ] = {
@ -69,11 +69,11 @@ export default class extends Controller {
event . popup . setContent ( text ) ;
} ) ;
} ) ;
layer2 . addTo ( layer ) ;
overpassLayer . addTo ( layer ) ;
}
}
var layer1 = L . featureGroup ( ) ;
var taskLayer = L . featureGroup ( ) ;
geojsons = JSON . parse ( this . geojsonValue ) ;
if ( geojsons . length > 0 ) {
geojsons . forEach ( function ( geojson ) {
@ -90,7 +90,7 @@ export default class extends Controller {
}
return { color : color } ;
}
} ) . bindTooltip ( feature0 . name ) . addTo ( layer1 ) . on ( 'click' , function ( event ) {
} ) . bindTooltip ( feature0 . name ) . addTo ( taskLayer ) . on ( 'click' , function ( event ) {
window . location . href = event . layer . feature . properties . url ;
} ) ;
@ -98,23 +98,23 @@ export default class extends Controller {
icon : icons [ feature0 . color ] ,
title : feature0 . name ,
clickUrl : feature0 . url ,
} ) . addTo ( layer1 ) . on ( 'click' , function ( event ) {
} ) . addTo ( taskLayer ) . on ( 'click' , function ( event ) {
window . location . href = event . target . options . clickUrl ;
} ) ;
} ) ;
layer1 . addTo ( layer ) ;
taskLayer . addTo ( layer ) ;
}
layer . addTo ( map ) ;
if ( this . overpassResultValue !== '' ) {
L . control . layers ( { } , {
'Overpass' : layer2 ,
'Tâches' : layer1 ,
'Overpass' : overpassLayer ,
'Tâches' : taskLayer ,
} ) . addTo ( map ) ;
}
map . fitBounds ( layer1 . getBounds ( ) ) ;
map . fitBounds ( taskLayer . getBounds ( ) ) ;
}
}