From 314e785af8aaa876ca5d13eac4f17df5a7395ad1 Mon Sep 17 00:00:00 2001 From: tristen Date: Mon, 2 Mar 2015 15:56:15 -0500 Subject: [PATCH] Change hover to mousemove - Fixes #713 --- API.md | 2 +- docs/_posts/3400-01-01-api.html | 2 +- docs/_posts/examples/3400-01-05-featuresat.html | 2 +- docs/_posts/examples/3400-01-05-mouse-position.html | 4 ++-- js/ui/handlers.js | 4 ++-- js/ui/interaction.js | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/API.md b/API.md index 2492bb45c4a..0cec3c59cfc 100644 --- a/API.md +++ b/API.md @@ -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 diff --git a/docs/_posts/3400-01-01-api.html b/docs/_posts/3400-01-01-api.html index 25e9d62ecb2..3653c3121bf 100644 --- a/docs/_posts/3400-01-01-api.html +++ b/docs/_posts/3400-01-01-api.html @@ -445,7 +445,7 @@

Events

- + diff --git a/docs/_posts/examples/3400-01-05-featuresat.html b/docs/_posts/examples/3400-01-05-featuresat.html index cba68644716..854deba0d51 100644 --- a/docs/_posts/examples/3400-01-05-featuresat.html +++ b/docs/_posts/examples/3400-01-05-featuresat.html @@ -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); diff --git a/docs/_posts/examples/3400-01-05-mouse-position.html b/docs/_posts/examples/3400-01-05-mouse-position.html index 95b8e1a88dc..c3bad64ca26 100644 --- a/docs/_posts/examples/3400-01-05-mouse-position.html +++ b/docs/_posts/examples/3400-01-05-mouse-position.html @@ -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) + '
' + // using map.unproject() we can turn that point into a latitude, longitude diff --git a/js/ui/handlers.js b/js/ui/handlers.js index d885bc177cd..66d6cd92593 100644 --- a/js/ui/handlers.js +++ b/js/ui/handlers.js @@ -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'); diff --git a/js/ui/interaction.js b/js/ui/interaction.js index c3b8707eb08..5be316791b7 100644 --- a/js/ui/interaction.js +++ b/js/ui/interaction.js @@ -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) { @@ -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); } } }
Fired on map click
hover(point)mousemove(point) Fired when the mouse moves over the map