ngx-openlayers: stretching problem

I found an error that I already had in my project. Let me try to describe it: I have a page with a toggle able side bar, the rest of the page is filled with the map. Now if i toggle the sidebar the view port of the map gets changed in size, but the page content is stretched.

I fixed this problem before by adding the following to my map page:

ngDoCheck() {
    this.map.updateSize();
  }

I don’t know if this is the best, or right solution, but it worked for me, you should have a look at it.

If you have any questions or need more info, just let me know!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

ngAfterViewChecked is called many times so, the performance of your application will fall. I recommend you to use events provided by ol, for example: map.once('postrender', function (event) { self.map.updateSize(); }); This works fine for me.