Anuncio: Todos los proyectos no comerciales registrados para usar Earth Engine antes del
15 de abril de 2025 deben
verificar su elegibilidad no comercial para mantener el acceso a Earth Engine.
Map.setGestureHandling
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Controla cómo se controlan los gestos en el mapa.
Consulta https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions.gestureHandling.
Uso | Muestra |
---|
Map.setGestureHandling(option) | |
Argumento | Tipo | Detalles |
---|
option | String | Opción que controla cómo se manejan los gestos en el mapa. Valores permitidos:
- "cooperative": Los eventos de desplazamiento y los gestos táctiles con un dedo desplazan la página y no acercan ni alejan el mapa. Los gestos táctiles con dos dedos permiten desplazar y acercar el mapa. Los eventos de desplazamiento con la tecla Ctrl o ⌘ presionada acercan el mapa. En este modo, el mapa coopera con la página.
- "greedy": Todos los gestos táctiles y los eventos de desplazamiento lateral o zoom mueven el mapa.
- "none": El usuario no puede desplazarse lateralmente por el mapa ni acercarlo o alejarlo con gestos.
- "auto": (predeterminado) El control de gestos es cooperativo o greedy, según si la página se puede desplazar o está en un iframe.
|
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-26 (UTC)
[null,null,["Última actualización: 2025-07-26 (UTC)"],[[["\u003cp\u003e\u003ccode\u003egestureHandling\u003c/code\u003e option controls how users interact with the map through gestures like scrolling and touch.\u003c/p\u003e\n"],["\u003cp\u003eOptions include "cooperative", "greedy", "none", and the default "auto", each affecting how the map responds to user input.\u003c/p\u003e\n"],["\u003cp\u003e"cooperative" allows page scrolling with one finger and map interaction with two fingers, while "greedy" makes all gestures control the map.\u003c/p\u003e\n"],["\u003cp\u003e"none" disables map panning and zooming via gestures, whereas "auto" intelligently switches between "cooperative" and "greedy" based on context.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the Google Maps documentation for detailed information and implementation instructions.\u003c/p\u003e\n"]]],["The `Map.setGestureHandling(option)` method controls map gesture behavior. The `option` argument, a string, determines how the map interacts with user gestures. \"cooperative\" mode allows page scrolling with single-finger or scroll events while reserving two-finger gestures for map manipulation. \"greedy\" mode assigns all touch and scroll actions to the map. \"none\" disables map panning/zooming via gestures. \"auto\" (default) switches between cooperative and greedy modes.\n"],null,["# 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| `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. |"]]