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

279
Vistas
Is there a way to take a screenshot of the map with views inside with react-leftlet?

I was trying to take a screenshot of a map on react-leflet but any library i tried didn't work because they require to use preferCanvas=true option, which i can't use because it doesn't render the image correctly.

Here is my snippet

import {useState} from "react";
import {useSelector} from "react-redux";
import {MapContainer, TileLayer} from "react-leaflet";
import {mapLimit, parisCoordinates} from "../Utils/constants";

import '../Styles/MapMenu.scss'

const MapContainerBox = () => {
    const [gridShow, setGridShow] = useState(false)
    const [stationShow, setStationShow] = useState(false)

    return (
        <MapContainer center={[22,0]}
                            zoom={3}
                            minZoom={1.5}
                            scrollWheelZoom={true}
                            style={{height: '80vh'}}
                            maxBounds={mapLimit}>
            <TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"/>
            {stationShow ? <GroundStationVisualizer curStation={parisCoordinates}/> : null}
            {gridShow ? <MapGridVisualizer/> : null}
            <div className={'map-menu'}>
                <button onClick={() => setGridShow(!gridShow)}>Toggle Grid</button>
                <button onClick={() => setStationShow(!stationShow)}>Toggle Station</button>
            </div>
        </MapContainer>
    )
}

export default MapContainerBox;

Is there a way to take a screenshot without using the canvas option?

about 4 years ago · Juan Pablo Isaza
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