Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

173
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda