Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

183
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda