Skip to content

Commit

Permalink
Add marker-change-on-hover functionality to debug.html.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLoer committed Apr 6, 2018
1 parent 866ab7b commit d09e7dd
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions debug/debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,39 @@
"text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"]
}
});

map.addLayer({
id: "marker",
type: "symbol",
source: "points",
layout: {
"icon-image": "bus-11",
"icon-size": 2,
"icon-ignore-placement": true,
"icon-allow-overlap": true
}
});

map.addLayer({
id: "marker-hover",
type: "symbol",
filter: ["==", "name", ""],
source: "points",
layout: {
"icon-image": "bus-15",
"icon-size": 2,
"icon-ignore-placement": true,
"icon-allow-overlap": true
}
});

map.on('mouseenter', 'marker', function(e) {
map.setFilter('marker-hover', ['==', 'name', e.features[0].properties.name])
});
map.on('mouseleave', 'marker', function(e) {
map.setFilter('marker-hover', ['==', 'name', ''])
});

});

map.on('click', function(e) {
Expand Down

0 comments on commit d09e7dd

Please sign in to comment.