公告:凡是在
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 | 字串 | 這個選項可控制地圖上的手勢處理方式。允許的值:
- 「合作」:捲動事件和單指觸控手勢會捲動頁面,不會縮放或平移地圖。雙指觸控手勢可平移及縮放地圖。按住 Ctrl 鍵或 ⌘ 鍵並捲動,即可縮放地圖。在此模式下,地圖會與網頁協同運作。
- 「greedy」:所有觸控手勢和捲動事件都會平移或縮放地圖。
- 「none」:使用者無法透過手勢平移或縮放地圖。
- 「auto」:(預設) 視網頁是否可捲動或位於 iframe 中,手勢處理方式為合作或貪婪。
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間: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. |"]]