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

161
Visualizações
React-Leaflet adding sign on center of map

I add a sign on map that shows the center.

<MapContainer fullscreenControl={true}
                    center={center} zoom={18}
                    maxNativeZoom = {22}
                    maxZoom={22}
                    className={"sign-of-center-of-map"}>

.sign-of-center-of-map:before {
    position: absolute;
    content: "\271B";
    z-index: 800;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    font-size: 3rem;
    opacity: 0.7;
}

But when i do that, layers on the map become non-clickable. I changed z-index of layers but this didn't solve the issue. Should i add something to CSS or use different method?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You should use a better method to reach this feature, React-leaflet has Control feature that you can add whatever you want to your map

For Example:

import L from "leaflet";

createDivControl() {
const MapHelp = L.Control.extend({
  onAdd: (map) => {
    const signOfCenterOfMap = L.DomUtil.create("div", "");
    this.signOfCenterOfMap = signOfCenterOfMap;
    // set the inner content from the props
    signOfCenterOfMap.innerHTML = this.props.title; // it can be your icon

    // return the div
    return signOfCenterOfMap;
  }
});
return new MapHelp({ position: "bottomright" })} // 'bottomleft','bottomright', ...

In this example, you must set the position of your div

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