Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
How to add FULLSCREEN control properly?

I am trying to add a full screen control (I had a switcher too). when i create this control inside map creation new ol.MAP...(following documentation) i dont get errors but they(layersSwitcher and Fullscreen control) dont appear.

map = new ol.Map({
        controls:[new ol.control.LayerSwitcher({
            tipLabel: 'Leyenda',
    
        }),
        new ol.control.defaults().extend([new ol.control.FullScreen()])],
        layers: [
            new ol.layer.Group({
                'title': 'Mapas de base',
                layers: [grisOSM, mapaOSM]
            }),

I also tried creating the map, then create and add controls like this:

 map = new ol.Map({
        layers: [
            new ol.layer.Group({
                'title': 'Mapas de base',
                layers: [grisOSM, mapaOSM]
            }),

    const layerSwitcher = new ol.control.LayerSwitcher({
        tipLabel: 'Leyenda',

    });
    map.addControl(layerSwitcher);
    const fullScreen = new ol.control.defaults().extend([new ol.control.FullScreen()]);

    map.addControl(fullScreen);

I get Uncaught TypeError: t.element.setMap is not a function error and can't see none of them

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Either

 map = new ol.Map({
        controls: ol.control.defaults().extend([new ol.control.FullScreen()]),
        layers: [
            new ol.layer.Group({
                'title': 'Mapas de base',
                layers: [grisOSM, mapaOSM]
            }),
         ],
     });

or

 map = new ol.Map({
        layers: [
            new ol.layer.Group({
                'title': 'Mapas de base',
                layers: [grisOSM, mapaOSM]
            })
        ],
    });

    map.addControl(new ol.control.FullScreen());

ol.control.defaults is not a constructor so does not need new

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!