1

In Git-Repro https://github.com/Turbo87/sidebar-v2 sidebar-v2 is presented but I can not bring it to work with ol5 when I like to import in a external .js file the necessary sidebar-v2 methods.

Tried to include the repros content into my repro but still can not run ol.control.sidebar

JohPel
  • 61
  • 1
  • 5
  • It was developed for OL3/4. Until an NPM version is available you could copy the code from `https://raw.githubusercontent.com/Turbo87/sidebar-v2/master/js/ol3-sidebar.js` add the necessary imports such as `ol.control` and `ol.inherits` and edit the code to use them - or simply but less efficiently use `import * as ol from 'ol';` – Mike Apr 17 '19 at 19:44
  • Thank you for the fast reply! It works via the line "sidebar-v2": "umbe1987/sidebar-v2#ol5-sidebar" in the package.json file and then npm install. See https://github.com/Turbo87/sidebar-v2/issues/143. Unfortunately, the tabs in the sidebar are not showing up and also the sidebar is not in height like map. – JohPel Apr 18 '19 at 12:41

2 Answers2

0

The div of the sidebar hast to be in the div of the map. Additionally add display: block; position: relative; into the css #map style.

JohPel
  • 61
  • 1
  • 5
0

Solved the problem by adding

export {default as Sidebar} from 'sidebar-v2/js/ol5-sidebar.js';

to node_modules/ol/control.js AND

import {Sidebar} from 'ol/control.js';

into the .js where the map is created.

JohPel
  • 61
  • 1
  • 5