禁用Ctrl + Scroll缩放谷歌地图 [英] Disable the Ctrl + Scroll to Zoom google maps

查看:120
本文介绍了禁用Ctrl + Scroll缩放谷歌地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何禁用 CTRL + 滚动



当鼠标滚轮移动时,地图会放大/缩小。但现在它要求按 CTRL +鼠标滚轮滚动放大/缩小。



我们如何禁用此功能?我似乎无法在文档中找到任何内容:



解决方案

您需要传递 gestureHandling:'greedy'到您的地图选项。



文档: https://developers.google.com/maps/documentation/javascript/interaction#gestureHandling



例如:

  const map = new google.maps.Map(mapElement,{
center:{0,0},
zoom:4,
gestureHandling:'贪婪'
} );


Does anybody know how to disable the CTRL + Scroll?

First when the mouse wheel was moved the Map would Zoom in/out. But now it asks to press CTRL + Mouse Wheel Scroll to Zoom in/out.

How do we disable this feature? I can't seem to find anything in the documentation:

https://developers.google.com/maps/documentation/javascript/controls#ControlOptions

解决方案

You need to pass gestureHandling: 'greedy' to your map options.

Documentation: https://developers.google.com/maps/documentation/javascript/interaction#gestureHandling

For example:

const map = new google.maps.Map(mapElement, {
  center: { 0, 0 },
  zoom: 4,
  gestureHandling: 'greedy'
});

这篇关于禁用Ctrl + Scroll缩放谷歌地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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