HIi, I'm Darshan Hiranandani, currently working on implementing user interactions, such as clicks and drags, on a JavaScript SDK map for our project, and I'd appreciate some guidance from those who have experience in this area. Could you share your insights on how to handle these interactions effectively?
Hi @DarshanHiranandani ,
Thanks for asking your question. Here is a group of samples that demonstrate events and watching for property changes: https://developers.arcgis.com/javascript/latest/sample-code/?tagged=events.
https://developers.arcgis.com/javascript/latest/sample-code/event-explorer/
https://developers.arcgis.com/javascript/latest/sample-code/watch-for-changes/
https://developers.arcgis.com/javascript/latest/sample-code/view-hittest/
https://developers.arcgis.com/javascript/latest/sample-code/ge-geodesicbuffer/
https://developers.arcgis.com/javascript/latest/sample-code/sketch-update-validation/
https://developers.arcgis.com/javascript/latest/sample-code/layers-imagery-clientside/
In general the API favors watching property values with reactiveUtils over having lot's of events. Another good reference you'll likely want to check out and understand is how hit tests work: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#hitTest
I hope this helps
Strange the link I sent for samples tagged with events only pulls up two samples.
These are the samples I'd recommend looking at:
https://developers.arcgis.com/javascript/latest/sample-code/event-explorer/
https://developers.arcgis.com/javascript/latest/sample-code/watch-for-changes/
https://developers.arcgis.com/javascript/latest/sample-code/view-hittest/
https://developers.arcgis.com/javascript/latest/sample-code/ge-geodesicbuffer/
https://developers.arcgis.com/javascript/latest/sample-code/sketch-update-validation/
https://developers.arcgis.com/javascript/latest/sample-code/layers-imagery-clientside/