Do not move marker on double click
Zoom but do not move the marker on double click on the map.
This commit is contained in:
parent
365114dd8c
commit
719148aa1c
|
@ -60,7 +60,8 @@ var These3Words = (function () {
|
|||
});
|
||||
|
||||
google.maps.event.addListener(that.map, 'click', function (evt) {
|
||||
that.moveTo(evt.latLng);
|
||||
that.mapZoom = that.map.getZoom();
|
||||
setTimeout(function() {that.moveTo(evt.latLng)}, 300);
|
||||
});
|
||||
|
||||
that.searchInput = document.createElement('input');
|
||||
|
@ -111,6 +112,12 @@ var These3Words = (function () {
|
|||
|
||||
Map.prototype.moveTo = function (latLng) {
|
||||
var that = this;
|
||||
// if zoom level has changed then the user
|
||||
// double clicked instead of single clicked
|
||||
// so we do not want to move, just zoom
|
||||
if (that.map.getZoom() != that.mapZoom) {
|
||||
return;
|
||||
}
|
||||
apiGetFromLatLng(latLng, function (status, data) {
|
||||
if (status >= 200 && status < 400) {
|
||||
that.update(latLng, data.three);
|
||||
|
|
Loading…
Reference in New Issue