Map.onChangeBounds
Registers 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.
Returns an ID which can be passed to unlisten() to unregister the callback.
Usage | Returns |
---|
Map.onChangeBounds(callback) | String |
Argument | Type | Details |
---|
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. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["Registers a callback function that is triggered whenever the map's boundaries are modified, including panning, zooming, or programmatic changes."],["Provides an ID that can be used with the `unlisten()` function to remove the registered callback."],["The callback function receives the new map center coordinates (longitude, latitude, and zoom level) and the map widget as arguments."]]],["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"]]