Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!