如何关闭 Google 地图 V2 上的可拖动行为 (javascript)
我正在尝试在设备上设置 Google 地图,并在其顶部显示一些简单的按钮。但我附加到这些按钮的事件似乎会以某种方式干扰地图拖动功能。基本上完全拖动不起作用,而且还让我这个按钮不起作用。我真的不关心这个阻力(我不需要它) - 但我不知道如何禁用它。
你们有人尝试过吗? (我不想只使用静态谷歌图像,我仍然希望有一个选项可以移动、放大和缩小,但可以使用我自己的按钮)。最大的问题是标记 - 因为我想让它们可点击。所以可能有两种解决方案:
如何禁用可拖动行为?
如何仅使标记可点击(在地图层之外,但能够与地图一起移动)。
如何仅使标记可点击(在地图层之外,但能够与地图一起移动
我正在考虑以一种黑客的方式创建一个只传递很少事件的覆盖层,但这不起作用......有人有任何想法吗?
提前致谢,
I'm trying to set up a Google Maps on device and on top of it show some simple buttons. But events that I attach to those buttons seems to interferee somehow with map drag functionaliy. Basically drag completly doesnt work and also gives me this button not workin. I really dont care about this drag (I dont need it) - but i cant figure out how to disable it.
Does any of you tried that? (I dont want to use static google images only, I still want to have an option to move around, zoom in and out, but on my own buttons). Biggest problem is markers - because I want to have them be clickable. So There might be 2 solutions:
How to disable dragable behaviour?
How to make only markers clickable (outside of a Map layer somehow, but able to move together with map).
I was thinking in hacky way to create an overlay that would pass only few events but this doesnt work... Anyone has any ideas?
Thanks in advance,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要防止地图滚动,您必须在 UiSettings 上将ScrollGesturesEnabled 设置为 false:
To prevent map from scrolling you must setScrollGesturesEnabled to false on UiSettings: