If you run this code you'll notice that when a locator's position is on another polygon the locator does not work anymore.

Question: How can the code above be changed so that a click on a locator always works? Why was it necessary to use two two EventHandlers, and what is a good rule to decide on wether to use the PassEventsDown option?

I'll first explain the causes of the unwanted behavior and then explain my solution.

At the base of the problem lies the fact that LocatorPane needs to get its own events, the clicks on the pane that (re)set the position of the locators. The 3 (not 2, if you look closely) EventHandlers get priority above the LocatorPane when you click in their elements. If you don't do a PassEventsDown->TrueLocatorPane won't see the event at all. It'll be eaten up by the handler. However, if you would pass down the event to the LocatorPane it would set a new position for the locator while at the same time the polygon is being dragged. You get a very erratic result.

My solution consists of the following:

Pass the events to LocatorPane by setting PassEventsDown->True in the deepest event handlers

If we have a dragging event, disable the LocaterPane using the option setting Enabled -> Dynamic[drag == 0]

Enable locator actions on overlapped locators by multiplying the drag variable with Boole[\[Not]CurrentValue["ShiftKey"]], which then disables the polygon dragging behavior if the shift key is pressed. Locator dragging can then proceed as normal.

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.