公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ui.Map.setLocked
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
限制地图上的平移和缩放操作。
- 如需同时锁定平移和缩放,请将 locked 设置为 true,无需进行其他设置。
- 如需允许平移并限制最小和最大缩放级别,请将 locked 设置为 false,并提供 minZoom 和 maxZoom 参数。
- 如需禁止平移并限制最小和最大缩放级别,请将 locked 设置为 true,并提供 minZoom 和 maxZoom 参数。
- 如需将地图重置为默认状态,请将 locked 设置为 false,而无需执行其他操作。
用法 | 返回 |
---|
Map.setLocked(locked, minZoom, maxZoom) | |
参数 | 类型 | 详细信息 |
---|
此:ui.map | ui.Map | ui.Map 实例。 |
locked | 布尔值 | 地图是否应锁定。 |
minZoom | 数字,可选 | (可选)地图的最小缩放级别,介于 0 到 24 之间(含边界值)。 |
maxZoom | 数字,可选 | (可选)地图的最大缩放级别,介于 0 和 24 之间(含边界值)。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\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. |"]]