Skip to content

Commit

Permalink
Fix bug to apply hover style only to lines, not markers
Browse files Browse the repository at this point in the history
  • Loading branch information
mvl22 committed Mar 28, 2018
1 parent a43ddb2 commit 32ea853
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/Leaflet.LayerViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1886,16 +1886,17 @@ var layerviewer = (function ($) {
layer.bindPopup(popupContent, {autoPan: false, className: layerId});

// Add hover style if enabled
// #!# setStyle should be applied to lines only
if (_settings.hover || _layerConfig[layerId].hover) {
layer.on('mouseover', function () {
this.setStyle ({
weight: 12
if (layer instanceof L.Path) { // Do not apply to markers; see: https://stackoverflow.com/a/30852790/180733
if (_settings.hover || _layerConfig[layerId].hover) {
layer.on('mouseover', function () {
this.setStyle ({
weight: 12
});
});
});
layer.on('mouseout', function () {
_currentDataLayer[layerId].resetStyle(this);
});
layer.on('mouseout', function () {
_currentDataLayer[layerId].resetStyle(this);
});
}
}
},

Expand Down

0 comments on commit 32ea853

Please sign in to comment.