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

286
Visualizações
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 à 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