rexbradford

Can I turn off layer events, and still hook mouse events and pass some to map?

Discussion created by rexbradford on Nov 4, 2011
Latest reply on Nov 9, 2011 by DSwingley-esristaff
I have developed some Javascript code to solve the problem of selecting markers where there are multiple markers overlapping.  By default, the UI seems to act as if obscured markers just don't exist.  My replacement system tracks all my layer markers, spatially organizes them for fast lookup, and then has a UI for tooltips and clicking which presents all the markers under the mouse cursor tip, rather than just the topmost.

It works fine, except that to get the mouse event in the first place to my system, I have had to tie into the layer's event handlers.  I.e., each layer gets its mouse events, and then just hands them off to the new system, which handles all layers together.  I would much rather turn off the marker layers' event handlers altogether, as I don't need them anymore, and just handle all mouse events directly, but still pass those that aren't over a marker on to the underlying map event handlers (for pan, zoom, etc.).  This would be faster (the toolkit has an unnecessary delay when clicking on markers in crowded areas), and I wouldn't have to worry about my marker detection having any pixel-level inaccuracies vis-a-vis the layer's detection, which is currently the "mouse gatekeeper".

Is there a way to capture all the mouse events in the map area, and then grab those I want, and pass the rest on?

Thanks,

Rex Bradford
Direct Relief International

Outcomes