Skip to content

Commit

Permalink
Reinstate vector onEachFeature function
Browse files Browse the repository at this point in the history
This restores the onEachFeature function to vector layer options for internal layers. It was removed in SMK 1.1.6 when changes were made to support conditional styling. When a radius is used with the Identify tool, its styling is lost and the radius draws as a black circle; this change restores prior radius styling.
  • Loading branch information
michaelpnelson committed May 3, 2023
1 parent 014d843 commit 36a41d7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/smk/viewer-leaflet/layer/layer-vector-leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ include.module( 'layer-leaflet.layer-vector-leaflet-js', [ 'layer.layer-vector-j
var layerOptions = {
coordsToLatLng: projectCoord,
pointToLayer: function ( geojson, latlng ) {
// return markerForStyle( self, latlng, layers[ 0 ].config.style )
return markerForStyle( self, latlng, styles[ 0 ], layers[ 0 ].config )
.on( 'moveend', function ( ev ) {
var ll = ev.target.getLatLng()
Expand All @@ -174,10 +173,16 @@ include.module( 'layer-leaflet.layer-vector-leaflet-js', [ 'layer.layer-vector-j
});
return convertStyle(combinedStyle, feature.geometry.type, layerPaneId);
};
} else if (layers[0].config.isInternal) {
layerOptions.onEachFeature = function ( feature, layer ) {
if (layer.setStyle) {
layer.setStyle(convertStyle(feature.style, feature.geometry.type));
}
};
} else {
layerOptions.style = function(feature) {
return convertStyle(layers[0].config.style, feature.geometry.type, layerPaneId);
}
};
}

var layer = new L.geoJson(null, layerOptions);
Expand Down

0 comments on commit 36a41d7

Please sign in to comment.