Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

39
Vistas
Hover event over shapefile while drawing on Leaflet

I am using Leaflet.Draw to draw some features such as line, polygon and etc on the map. I also have a shapefile (here named mypoly) already on my map. What I now want is that during the drawing of a new feature such as a line if my mouse cursor moves over mypoly , the mypoly should get highlighted immediately. Here is my attempt :

Map.on('draw:drawstart', function() {

    console.log('drawing started');
    
    mypoly.on('mouseover', function() {

      mypoly.setStyle({
        opacity: 1})
    });

    mypoly.on('mouseout', function() {
 
      mypoly.setStyle({
        opacity: 0.5})
    });


});

It seems to be working when I select a drawing tool and hover over the mypoly but the moment I start real drawing and try to move my mouse cursor over the mypoly, the highlight functionality doesn't work. Any suggestion/ solution would be appreciated. Thanks in advance.

7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos