stop idle event in Google Maps API v3

I'm using a Google map with markers setup to show locations on a map. I'm using the idle event to determine when to submit the request for new data, so that when a user pans or zooms the map, an ajax service will be called and the markers will be updated to find locations in the new viewport. The problem is that when a user clicks on a marker to pop up the infowindow, the map often mov

在Google Maps API v3中停止空闲事件

我正在使用带有标记设置的Google地图来显示地图上的位置。 我正在使用idle事件来确定何时提交新数据请求,以便用户平移或缩放地图时,将调用ajax服务并更新标记以在新视口中查找位置。 问题在于,当用户点击标记弹出infowindow时,地图往往略微移动以使infowindow居中 - 触发另一个idle事件并重置地图,关闭infowindow。 对此有最佳做法吗? 有一种方法可以在infowindow打开时禁用idle侦听器,或者是否有标准的解决方法?

trigger google maps marker click

I have a google map set up to find the user's current location, and center the map at that closest marker to their location. The markers, when clicked, open up an infobox (note this is a little different than an infoWindow - http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/examples.html). What I want to do, however, is automatically open up the nearest marker with

触发谷歌地图标记点击

我设置了谷歌地图来查找用户的当前位置,并将地图放在距离他们位置最近的标记处。 点击标记时,打开一个信息框(请注意,这与infoWindow稍有不同 - http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/examples.html )。 然而,我想要做的是自动打开最近的标记,而不需要用户实际点击。 以下是触发标记打开的代码: //loop through all locations to add a marker: addMarker = function(loc) {

Google Maps JS API v2

I'm fairly new to gmaps and Im using v2 because of the search function that I didnt find in v3. I've got an array of data that I want to loop through and put the markers on the map =) It seems really easy but I cant get it to work with v2 at all... Here is my what my array format and code looks like: function createMarkers(myLatLng,html) { var marker = new GMarker(myLatLng, marke

Google Maps JS API v2

我对gmaps和Im使用v2相当陌生,因为我没有在v3中找到搜索功能。 我有一组数据,我想循环并将标记放在地图上=) 这似乎很容易,但我不能让它与V2一起工作...... 这是我的数组格式和代码的样子: function createMarkers(myLatLng,html) { var marker = new GMarker(myLatLng, markerOptions); GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(html); }); return marker; } var

Google maps fitBounds with padding?

This question already has an answer here: Google Maps API 3 fitBounds padding - ensure markers are not obscured by overlaid controls 6 answers After a while I found a solution that works. if (this.map.getProjection()) { var offsetx = 200; var offsety = 0; var point1 = this.map.getProjection().fromLatLngToPoint(bounds.getSouthWest()); this.map.fitBounds(bounds); var poin

谷歌地图fitBounds填充?

这个问题在这里已经有了答案: Google Maps API 3 fitBounds填充 - 确保标记不会被叠加控件遮盖6个答案 一段时间后,我发现了一个可行的解决方案。 if (this.map.getProjection()) { var offsetx = 200; var offsety = 0; var point1 = this.map.getProjection().fromLatLngToPoint(bounds.getSouthWest()); this.map.fitBounds(bounds); var point2 = new google.maps.Point( ( (typeof(offs

Google maps API V3 fitBounds() not working

I'm want to call fitBounds() on a google map so that a user can see their own location relative to a selected marker/location. Here is my function which handles this: var fitMapToShowResult = function(index){ var hereLatLng = new google.maps.LatLng (lat,lng); //location of the user defined outside this func var firstResultLatLng = new google.maps.LatLng(

Google地图API V3 fitBounds()不起作用

我想在谷歌地图上调用fitBounds() ,以便用户可以看到他们自己相对于选定标记/位置的位置。 这是我处理这个问题的函数: var fitMapToShowResult = function(index){ var hereLatLng = new google.maps.LatLng (lat,lng); //location of the user defined outside this func var firstResultLatLng = new google.maps.LatLng( $scope.searchResults[index].geometry.location.k,

fitBounds() shows whole earth (if map is first hidden and then shown)

I have a bunch or markers, and I want to show only the area containing them. I found a long list of similar questions (see at the bottom of the post for some), but none of the solutions works for me. The LatLngBounds is built correctly, but when I call fitBounds the result will be the following: Instead of: Can anybody spot an evident error in my code? var opt = { zoom: 8, mapTypeI

fitBounds()显示整个地球(如果地图首先隐藏然后显示)

我有一堆或标记,我只想显示包含它们的区域。 我发现了一长串类似的问题(请参阅帖子的底部),但没有一个解决方案适用于我。 LatLngBounds构建正确,但是当我调用fitBounds时,结果如下所示: 代替: 任何人都可以在我的代码中发现明显的错误? var opt = { zoom: 8, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map"),opt); var box = new google.maps.La

Google Maps map.getBounds() immediately after a call to map.fitBounds

I'm calling getBounds() directly after a call to fitBounds(), and I thought I'd get a valid bound back as the map recenters and zooms to fit the bounds. Unfortunately, getBounds() is returning nil. The code to reproduce this is as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.

Google地图map.getBounds()在调用map.fitBounds后立即生效

我在调用fitBounds()之后直接调用了getBounds(),并且我认为当地图缩回并缩放以适合边界时,我会得到有效的边界。 不幸的是,getBounds()返回零。 重现此代码如下所示: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> <head>

google maps fitBounds callback

I know there is a bounds_changed event that is triggered if the bounds have changed, however I need to know when fitBounds has completed (when bounds have changed or bounds have stayed the same). Google has some sort of tolerance where if the bounds have changed very little it will not actually change the bounds / call bounds_changed. I need to know when this happens. I have done this succes

谷歌地图fitBounds回调

我知道有一个bounds_changed事件会在边界发生变化时触发,但是我需要知道fitBounds何时完成(当边界发生变化或边界保持不变时)。 谷歌有某种宽容,如果边界变化很小,它实际上不会改变边界/边界调用bounds_changed。 我需要知道这是什么时候发生的。 我已经用超时的方式成功完成了这个任务,但是当bounds_changed需要超过100ms的时间触发时,它似乎很难做,并且可能会出现一些错误。 请参阅示例:http://jsbin.com/sosur

Greasemonkey script: for Google Maps to disable Zoom on Scroll

As a desktop browser user of Google Maps I'd like to switch off the Zooming that occurs every time I use my touch-pad two-finger gesture to scroll up/down. How do I get hold of the appropriate DOM object handle? So I can script Greasemonkey (or similar) to set the scrollwheel option to false as shown in this previous answer (which is for developers who use the GoogleMap API on their own si

Greasemonkey脚本:用于谷歌地图禁用滚动缩放

作为Google地图的桌面浏览器用户,我想关闭每次使用触摸板双指手势向上/向下滚动时发生的缩放。 我如何获得适当的DOM对象句柄? 所以我可以脚本Greasemonkey(或类似的)将scrollwheel选项设置为false ,如前面的答案所示(适用于在自己的站点上使用GoogleMap API的开发人员)如何使用Google Maps API禁用鼠标滚轮缩放

Google maps JS API zoom in/out mouse scroll wheel without panning map

When you zoom in/out with mouse scroll wheel it pans the map in wired way that i don't like, is there option to disable panning this with google maps API? I want map to zoom in/out with scroll wheel like when i press zoom in and out buttons on map interface (on center of map). http://jsfiddle.net/4ozyvknr/ function initMap() { map = new google.maps.Map(document.getElementById('map'), {

谷歌地图JS API放大/缩小鼠标滚轮,无需平移地图

当你用鼠标滚轮放大/缩小时,它会以我不喜欢的有线方式播放地图,有没有可以禁用谷歌地图API来平移地图的选项? 我想要使​​用滚轮放大/缩小地图,就像我在地图界面(地图中心)按下放大和缩小按钮一样。 http://jsfiddle.net/4ozyvknr/ function initMap() { map = new google.maps.Map(document.getElementById('map'), { center: {lat: -34.397, lng: 150.644}, zoom: 8 }); } 我想在用鼠标滚轮缩放时防止平