(features, loc)
| 432 | }); |
| 433 | |
| 434 | function displayFeaturesPopup(features, loc) { |
| 435 | if (features.length === 0) return; |
| 436 | let f = new MapFeatureLayer(features, { |
| 437 | // pass the vector layer a renderer of its own, otherwise leaflet |
| 438 | // puts everything into the overlayPane |
| 439 | renderer: featureRenderer(), |
| 440 | // pass the vector layer the container for the parent into which |
| 441 | // it will append its own container for rendering into |
| 442 | pane: container, |
| 443 | //color: 'yellow', |
| 444 | // instead of unprojecting and then projecting and scaling, |
| 445 | // a much smarter approach would be to scale at the current |
| 446 | // zoom |
| 447 | projection: map.options.projection, |
| 448 | _leafletLayer: layer, |
| 449 | query: true, |
| 450 | mapEl: map.options.mapEl |
| 451 | }); |
| 452 | |
| 453 | f.addTo(layer); |
| 454 | |
| 455 | let div = DomUtil.create('div', 'mapml-popup-content'), |
| 456 | c = DomUtil.create('iframe'); |
| 457 | c.style = 'border: none'; |
| 458 | c.srcdoc = features[0].querySelector( |
| 459 | 'map-feature map-properties' |
| 460 | ).innerHTML; |
| 461 | c.setAttribute('sandbox', 'allow-same-origin allow-forms'); |
| 462 | div.appendChild(c); |
| 463 | // passing a latlng to the popup is necessary for when there is no |
| 464 | // geometry / null geometry |
| 465 | layer._totalFeatureCount = features.length; |
| 466 | layer.bindPopup(div, popupOptions).openPopup(loc); |
| 467 | layer.on('popupclose', function () { |
| 468 | layer.removeLayer(f); |
| 469 | }); |
| 470 | f.showPaginationFeature({ |
| 471 | i: 0, |
| 472 | popup: layer._popup |
| 473 | }); |
| 474 | } |
| 475 | } |
| 476 | }); |
no test coverage detected