|
521 | 521 | let zoom = mapml.getAttribute("zoom") || nativeZoom, title = mapml.querySelector("featurecaption"); |
522 | 522 | title = title ? title.innerHTML : "Feature"; |
523 | 523 |
|
524 | | - let propertyContainer = document.createElement('div'); |
525 | | - propertyContainer.classList.add("mapml-popup-content"); |
526 | | - propertyContainer.insertAdjacentHTML('afterbegin', mapml.querySelector("properties").innerHTML); |
527 | | - |
528 | | - options.properties = propertyContainer; |
| 524 | + if(mapml.querySelector("properties")) { |
| 525 | + options.properties = document.createElement('div'); |
| 526 | + options.properties.classList.add("mapml-popup-content"); |
| 527 | + options.properties.insertAdjacentHTML('afterbegin', mapml.querySelector("properties").innerHTML); |
| 528 | + } |
529 | 529 |
|
530 | 530 | let layer = this.geometryToLayer(mapml, options, nativeCS, +zoom, title); |
531 | 531 | if (layer) { |
|
4826 | 4826 | L.setOptions(this, options); |
4827 | 4827 |
|
4828 | 4828 | this.group = this.options.group; |
| 4829 | + this.options.interactive = this.options.link || (this.options.properties && this.options.onEachFeature); |
4829 | 4830 |
|
4830 | 4831 | this._parts = []; |
4831 | 4832 | this._markup = markup; |
|
5151 | 5152 | //creates the main parts and sub parts paths |
5152 | 5153 | for (let p of layer._parts) { |
5153 | 5154 | if (p.rings){ |
5154 | | - this._createPath(p, layer.options.className, layer.featureAttributes['aria-label'], true, layer.featureAttributes); |
| 5155 | + this._createPath(p, layer.options.className, layer.featureAttributes['aria-label'], layer.options.interactive, layer.featureAttributes); |
5155 | 5156 | if(layer.outlinePath) p.path.style.stroke = "none"; |
5156 | 5157 | } |
5157 | 5158 | if (p.subrings) { |
|
5411 | 5412 |
|
5412 | 5413 | L.LayerGroup.prototype.initialize.call(this, layers, options); |
5413 | 5414 |
|
5414 | | - if(this.options.onEachFeature || this.options.link) { |
| 5415 | + if((this.options.onEachFeature && this.options.properties) || this.options.link) { |
5415 | 5416 | this.options.group.setAttribute('tabindex', '0'); |
5416 | 5417 | L.DomUtil.addClass(this.options.group, "leaflet-interactive"); |
5417 | 5418 | L.DomEvent.on(this.options.group, "keyup keydown mousedown", this._handleFocus, this); |
|
5455 | 5456 | * @param layer |
5456 | 5457 | */ |
5457 | 5458 | addLayer: function (layer) { |
5458 | | - if(!layer.options.link && this.options.onEachFeature) { |
| 5459 | + if(!layer.options.link && layer.options.interactive) { |
5459 | 5460 | this.options.onEachFeature(this.options.properties, layer); |
5460 | 5461 | } |
5461 | 5462 | L.FeatureGroup.prototype.addLayer.call(this, layer); |
|
0 commit comments