From ae132643c7daf2d1d8fc63491bcf1ab25cef2355 Mon Sep 17 00:00:00 2001 From: mike-000 <49240900+mike-000@users.noreply.github.com> Date: Fri, 13 Sep 2019 13:41:45 +0100 Subject: [PATCH] Add Rotate with view option Use a checkbox to demonstrate the rotateWithView option --- examples/overviewmap-custom.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/overviewmap-custom.js b/examples/overviewmap-custom.js index abf6dae5d1..e82ff9ceb4 100644 --- a/examples/overviewmap-custom.js +++ b/examples/overviewmap-custom.js @@ -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