Skip to content

Commit

Permalink
Change hover to mousemove
Browse files Browse the repository at this point in the history
- Fixes #713
  • Loading branch information
tristen committed Mar 2, 2015
1 parent 7248b06 commit 314e785
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Event | Description
`zoom` | Fired when the map zoom changes
`rotate` | Fired when the map bearing changes
`click(point)` | Fired on map click
`hover(point)` | Fired when the mouse moves over the map
`mousemove(point)` | Fired when the mouse moves over the map
`resize` | Fired when the map changes size
`source.add(source)` | Fired when a data source is added
`source.remove(source)` | Fired when a data source is removed
Expand Down
2 changes: 1 addition & 1 deletion docs/_posts/3400-01-01-api.html
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ <h3 id="new-mapboxgl-map-options--events">Events</h3><table>
<td>Fired on map click</td>
</tr>
<tr>
<td><code>hover(point)</code></td>
<td><code>mousemove(point)</code></td>
<td>Fired when the mouse moves over the map</td>
</tr>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion docs/_posts/examples/3400-01-05-featuresat.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
zoom: 3
});

map.on('hover', function(e) {
map.on('mousemove', function(e) {
map.featuresAt(e.point, {radius: 5}, function(err, features) {
if (err) throw err;
document.getElementById('features').innerHTML = JSON.stringify(features, null, 2);
Expand Down
4 changes: 2 additions & 2 deletions docs/_posts/examples/3400-01-05-mouse-position.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
zoom: 9 // starting zoom
});

map.on('hover', function(e) {
map.on('mousemove', function(e) {
document.getElementById('info').innerHTML =
// e.point is the x, y coordinates of the hover event relative
// e.point is the x, y coordinates of the mousemove event relative
// to the top-left corner of the map
JSON.stringify(e.point) + '<br />' +
// using map.unproject() we can turn that point into a latitude, longitude
Expand Down
4 changes: 2 additions & 2 deletions js/ui/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ function Handlers(map) {
.on('click', function(e) {
map.fire('click', e);
})
.on('hover', function(e) {
map.fire('hover', e);
.on('mousemove', function(e) {
map.fire('mousemove', e);
})
.on('down', function() {
map.fire('movestart');
Expand Down
6 changes: 3 additions & 3 deletions js/ui/interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ function Interaction(el) {
interaction.fire('click', {point: point});
}

function hover(point) {
interaction.fire('hover', {point: point});
function mousemove(point) {
interaction.fire('mousemove', {point: point});
}

function pan(point) {
Expand Down Expand Up @@ -162,7 +162,7 @@ function Interaction(el) {
var target = ev.toElement || ev.target;
while (target && target !== el && target.parentNode) target = target.parentNode;
if (target === el) {
hover(point);
mousemove(point);
}
}
}
Expand Down

0 comments on commit 314e785

Please sign in to comment.