只允许在谷歌地图上滚动缩放 [英] Allow zooming only with scroll in google maps

查看:152
本文介绍了只允许在谷歌地图上滚动缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天以来,我们的用户只能在滚动时按下ctrl键进行缩放,这在我们的应用程序中没有意义。



有没有在Google地图中只允许使用滚动缩放(如之前那样)?



我已经看到这个ctrl + scroll的力量现在也在谷歌地图API参考(截图)中。



Google地图Javascript API参考的屏幕截图显示了新消息

解决方案在实例化过程中,将



例如:

  var map = new google.maps.Map (document.getElementById('map'),{
center:{0,0},
zoom:8,
gestureHandling:'greedy'
});
}


Since a few days our users can only zoom when they hit the "ctrl" key while scrolling which doesn't make sense in our applications.

Is there a way to allow zooming only with scrolling (as it was before) in Google Maps?

I've seen that this "ctrl + scroll" force now also is in the google maps api reference (screenshot).

Screenshot from the Google Maps Javascript API reference which shows the new message

解决方案

Add gestureHandling: 'greedy' to your map options during instantiation.

E.g:

var map = new google.maps.Map(document.getElementById('map'), {
    center: {0, 0},
    zoom: 8,
    gestureHandling: 'greedy'
  });
}

这篇关于只允许在谷歌地图上滚动缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆