公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ui.Map.setGestureHandling
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
控制地图上手势的处理方式。
请参阅 https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions.gestureHandling。
用法 | 返回 |
---|
Map.setGestureHandling(option) | |
参数 | 类型 | 详细信息 |
---|
此:ui.map | ui.Map | ui.Map 实例。 |
option | 字符串 | 用于控制如何在地图上处理手势的选项。允许的值:
- “cooperative”:滚动事件和单指触控手势会滚动网页,而不会缩放或平移地图。双指触摸手势可平移和缩放地图。按住 Ctrl 键或 ⌘ 键滚动鼠标滚轮可缩放地图。在此模式下,地图会与网页协同工作。
- “greedy”:所有触摸手势和滚动事件都会平移或缩放地图。
- “none”:用户无法通过手势平移或缩放地图。
- “auto”(默认):手势处理是协作式还是贪婪式,取决于网页是否可滚动或是否位于 iframe 中。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eDefines how users interact with the map through gestures like scrolling, panning, and zooming.\u003c/p\u003e\n"],["\u003cp\u003eOffers four options: "cooperative", "greedy", "none", and the default "auto", to control gesture behavior.\u003c/p\u003e\n"],["\u003cp\u003e"Cooperative" mode prioritizes page scrolling over map interaction for single-finger gestures, while "greedy" mode prioritizes map interactions for all gestures.\u003c/p\u003e\n"],["\u003cp\u003eAllows developers to disable all gestures with the "none" option or let the map automatically determine the best gesture handling based on context with "auto".\u003c/p\u003e\n"],["\u003cp\u003eCan be set using the \u003ccode\u003eMap.setGestureHandling(option)\u003c/code\u003e method, where 'option' is one of the allowed string values.\u003c/p\u003e\n"]]],[],null,["# ui.Map.setGestureHandling\n\n\u003cbr /\u003e\n\nControls how gestures are handled on the map.\n\n\u003cbr /\u003e\n\nSee https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions.gestureHandling.\n\n| Usage | Returns |\n|----------------------------------|---------|\n| Map.setGestureHandling`(option)` | |\n\n| Argument | Type | Details |\n|----------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `ui.map` | ui.Map | The ui.Map instance. |\n| `option` | String | The option that controls how gestures are handled on the map. Allowed values: - \"cooperative\": Scroll events and one-finger touch gestures scroll the page, and do not zoom or pan the map. Two-finger touch gestures pan and zoom the map. Scroll events with a ctrl key or ⌘ key pressed zoom the map. In this mode the map cooperates with the page. - \"greedy\": All touch gestures and scroll events pan or zoom the map. - \"none\": The map cannot be panned or zoomed by user gestures. - \"auto\": (default) Gesture handling is either cooperative or greedy, depending on whether the page is scrollable or in an iframe. |"]]