Add Rotate with view option

Use a checkbox to demonstrate the rotateWithView option
This commit is contained in:
mike-000
2019-09-13 13:41:45 +01:00
committed by GitHub
parent 763cc15c52
commit ae132643c7

View File

@@ -6,6 +6,8 @@ import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
const rotateWithView = document.getElementById('rotateWithView');
const overviewMapControl = new OverviewMap({
// see in overviewmap-custom.html to see the custom CSS used
className: 'ol-overviewmap ol-custom-overviewmap',
@@ -22,6 +24,10 @@ const overviewMapControl = new OverviewMap({
collapsed: false
});
rotateWithView.addEventListener('change', function() {
overviewMapControl.setRotateWithView(this.checked);
});
const map = new Map({
controls: defaultControls().extend([
overviewMapControl