Map.onChangeBounds
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Rejestruje wywołanie zwrotne, które jest wywoływane, gdy zmieniają się granice mapy. Jest wywoływane podczas przesuwania i powiększania mapy oraz gdy jej granice są zmieniane programowo.
Zwraca identyfikator, który można przekazać do funkcji unlisten(), aby wyrejestrować wywołanie zwrotne.
Wykorzystanie | Zwroty |
---|
Map.onChangeBounds(callback) | Ciąg znaków |
Argument | Typ | Szczegóły |
---|
callback | Funkcja | Funkcja wywołania zwrotnego, która ma zostać wywołana po zmianie granic mapy. Funkcja wywołania zwrotnego otrzymuje 2 parametry: obiekt zawierający współrzędne nowego środka mapy (z kluczami lon, lat i zoom) oraz sam widżet mapy. |
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-26 UTC."],[[["\u003cp\u003eRegisters a callback function that is triggered whenever the map's boundaries are modified, including panning, zooming, or programmatic changes.\u003c/p\u003e\n"],["\u003cp\u003eProvides an ID that can be used with the \u003ccode\u003eunlisten()\u003c/code\u003e function to remove the registered callback.\u003c/p\u003e\n"],["\u003cp\u003eThe callback function receives the new map center coordinates (longitude, latitude, and zoom level) and the map widget as arguments.\u003c/p\u003e\n"]]],["The core content details how to register a callback function that triggers when map bounds change due to panning, zooming, or programmatic adjustments. `Map.onChangeBounds(callback)` registers this callback, which receives the new map center's coordinates (lon, lat, zoom) and the map widget itself. This function returns a unique ID, enabling later unregistration of the callback via `unlisten()`.\n"],null,["# Map.onChangeBounds\n\n\u003cbr /\u003e\n\nRegisters a callback that's fired when the map bounds change. This is fired during pan, zoom, and when the map's bounds are changed programmatically.\n\n\u003cbr /\u003e\n\nReturns an ID which can be passed to unlisten() to unregister the callback.\n\n| Usage | Returns |\n|--------------------------------|---------|\n| `Map.onChangeBounds(callback)` | String |\n\n| Argument | Type | Details |\n|------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `callback` | Function | The callback to fire when the map bounds change. The callback is passed two parameters: an object containing the coordinates of the new map center (with keys lon, lat, and zoom) and the map widget itself. |"]]