Just brain storming here but are you adding your onClick handler to each graphic or is it on the actual graphicsLayer?
All of that looks like pretty standard, straight forward stuff. I'm not sure where the delay is being introduced. Any chance your app in on a public server?
How are you connecting a graphics layer to a map service?
Something does seem off about that...can you post your event handling code for your graphics layer?
For the markers, I am just using a GraphicsLayer, connecting it to a map service,and doing layer.add(graphic) calls based on filtered sets of them.
It does seem that there is a problem with the simple onclick handling for this graphic layer. If I click in an area where there are maybe 10-15 markers under the cursor tip (and more nearby), it can take 2-3 seconds before the onclick handler gets called. In less crowded areas it's instantaneous. This surprised me because I presumed the (instantaneous) tooltips had to do the same work.
Hi Rex,When you mention "toolkit" ...what specifically are you talking about? Is this something you or someone else assembled? How does it differ from the core API?
I'm guessing your using a dynamic map service layer. If that's the case, then yes, it does require a server round trip to get actual feature geometry and feature attributes. The mechanism to do this is an identify or query task.
By default, the UI seems to act as if obscured markers just don't exist.
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".
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.