在Google地图上切换缩放和平移功能。 [英] Toggling zooming and panning ability on Google Maps.

查看:274
本文介绍了在Google地图上切换缩放和平移功能。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在加载我的谷歌地图时最初禁止平移和缩放。只有当我的所有标记都已加载并调用fitbounds时,才允许用户控制视图。什么是切换这个最好的方法?

解决方案

有很多 map options ,包括


  • disableDefaultUI li>
  • disableDoubleClickZoom

  • 可拖动

  • keyboardShortcuts

  • overviewMapControl

  • 滚动



- 根据需要设置为true或false。 disableDefaultUI删除了很多控件,因此无法使用它们,但仍然需要处理拖动,滚轮缩放等操作。


I need to prevent panning and zooming initially when loading my google map. Only when all my markers have been loaded and fitbounds called, should the user be allowed to control the view. What's the best way of toggling this?

解决方案

There are lots of map options you can set, including

  • disableDefaultUI
  • disableDoubleClickZoom
  • draggable
  • keyboardShortcuts
  • overviewMapControl
  • scrollwheel

-- just set to true or false as required. disableDefaultUI removes a lot of controls so they can't be used, but you still need to take care of dragging, wheel-zoom, etc.

这篇关于在Google地图上切换缩放和平移功能。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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