ui.Map.setLocked
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Schränkt das Schwenken und Zoomen auf der Karte ein.
– Wenn Sie sowohl das Schwenken als auch das Zoomen sperren möchten, setzen Sie „locked“ auf „true“ und nichts anderes.
– Wenn Sie das Schwenken zulassen und den minimalen und maximalen Zoom begrenzen möchten, setzen Sie „locked“ auf „false“ und geben Sie die Parameter „minZoom“ und „maxZoom“ an.
– Wenn Sie das Schwenken nicht zulassen und die minimale und maximale Zoomstufe begrenzen möchten, setzen Sie „locked“ auf „true“ und geben Sie die Parameter „minZoom“ und „maxZoom“ an.
– Wenn Sie die Karte auf die Standardeinstellung zurücksetzen möchten, legen Sie „locked“ auf „false“ fest.
Nutzung | Ausgabe |
---|
Map.setLocked(locked, minZoom, maxZoom) | |
Argument | Typ | Details |
---|
So gehts: ui.map | ui.Map | Die ui.Map-Instanz. |
locked | Boolesch | Gibt an, ob die Karte gesperrt werden soll. |
minZoom | Nummer, optional | (Optional) Die minimale Zoomstufe für die Karte (zwischen 0 und 24, einschließlich). |
maxZoom | Nummer, optional | (Optional) Der maximale Zoomfaktor für die Karte zwischen 0 und 24 (einschließlich). |
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-07-26 (UTC).
[null,null,["Zuletzt aktualisiert: 2025-07-26 (UTC)."],[[["\u003cp\u003e\u003ccode\u003eMap.setLocked()\u003c/code\u003e controls the panning and zooming behavior of the map.\u003c/p\u003e\n"],["\u003cp\u003eSetting \u003ccode\u003elocked\u003c/code\u003e to \u003ccode\u003etrue\u003c/code\u003e restricts panning and, optionally, allows setting zoom limits with \u003ccode\u003eminZoom\u003c/code\u003e and \u003ccode\u003emaxZoom\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eSetting \u003ccode\u003elocked\u003c/code\u003e to \u003ccode\u003efalse\u003c/code\u003e with no other parameters resets the map to default behavior.\u003c/p\u003e\n"],["\u003cp\u003eProviding \u003ccode\u003eminZoom\u003c/code\u003e and/or \u003ccode\u003emaxZoom\u003c/code\u003e along with \u003ccode\u003elocked\u003c/code\u003e sets zoom limitations, while the presence or absence of \u003ccode\u003elocked\u003c/code\u003e dictates panning restrictions.\u003c/p\u003e\n"]]],[],null,["# ui.Map.setLocked\n\n\u003cbr /\u003e\n\nLimits panning and zooming on the map.\n\n\u003cbr /\u003e\n\n- To lock both panning and zooming, set locked to true and nothing else.\n\n- To allow panning and limit the min and max zoom, set locked to false and supply the minZoom and maxZoom parameters.\n\n- To disallow panning and limit min and max zoom, set locked to true and supply the minZoom and maxZoom parameters.\n\n- To reset the map to default, set locked to false and nothing else.\n\n| Usage | Returns |\n|----------------------------------------------------|---------|\n| Map.setLocked`(locked, `*minZoom* `, `*maxZoom*`)` | |\n\n| Argument | Type | Details |\n|----------------|------------------|-----------------------------------------------------------------------|\n| this: `ui.map` | ui.Map | The ui.Map instance. |\n| `locked` | Boolean | Whether the map should be locked or not. |\n| `minZoom` | Number, optional | (optional) The minimum zoom for the map, between 0 and 24, inclusive. |\n| `maxZoom` | Number, optional | (optional) The maximum zoom for the map, between 0 and 24, inclusive. |"]]