此示例演示如何在 MapView 上使用内边距属性。使用此选项可使中心、范围等成为完整视图的子部分。设置内边距后,可以将 UI 元素放置在内边距区域中,同时仍使地图在视图中正确居中。
在此示例中,一个 320px 宽的侧边栏放置在视图右侧的顶部。我们可以将视图的中心偏移相同的宽度,以便缩放和 UI 元素正确放置在剩余的视图空间中。
1 2 // Same value as the #sidebar width in CSS view.padding.right = 320;
1 2
Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.