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

208
Views
Bing Maps: Handle right click event separately for map and for pin layer

I am using the Bing Maps library (v8) and I have two different context menu's that I want to pop up, one when they right click on a blank area of the map and another one when they right click on a pin.

Here's my right click initialization code:

let map = new Microsoft.Maps.Map(/*element reference*/, {/*some options*/});

let pinLayer = new Microsoft.Maps.Layer();

Microsoft.Maps.Events.addHandler(pinLayer, 'rightclick', (e: any) => console.log("pin clicked");
map.layers.insert(pinLayer);

Microsoft.Maps.Events.addHandler(map, 'rightclick', (e: any) => console.log("map clicked");

It works just fine when I right click the map, I just get "map clicked"

But when I right click a pin, it says "map clicked" "pin clicked"

Is there a clean way for me to only fire the pin event when a pin is right clicked? (other than resorting to setTimeout)

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!