Add padding option for View

This commit is contained in:
Andreas Hocevar
2020-11-22 10:18:48 +01:00
parent 9d255be87c
commit 0e2d17b9c6
6 changed files with 264 additions and 8 deletions

View File

@@ -0,0 +1,23 @@
---
layout: example.html
title: View Padding
shortdesc: This example demonstrates the use of the view's padding option.
docs: >
This example demonstrates how a map's view can be configured to accommodate
for viewport space covered by other elements.
If the map viewport is partially covered with other content (overlays) along
its edges, the `padding` option allows to shift the center of the viewport away from
that content. The shifted viewport center will also be the anchor for zooming in and
out with the Zoom controls, and for rotating.
<p>Use <code>Alt+Shift+Drag</code> to rotate the map.</p>
tags: "center, padding, view, shift"
---
<div class="mapcontainer">
<div id="map" class="map"></div>
<div class="padding-top"></div>
<div class="padding-left"></div>
<div class="padding-right"></div>
<div class="padding-bottom"></div>
</div>
<button id="zoomtoswitzerland">Zoom to Switzerland</button>
<button id="centerlausanne">Center on Lausanne</button>