I am using Sketch widget to reduce overhead on some items and it mostly works (mostly).
This is how i set it up:
let sketch = new Sketch({
availableCreateTools: ["point", "polyline", "polygon"],
layer: this.graphicsLayer,
view: this.view,
creationMode: "single",
defaultUpdateOptions: {
enableRotation: false,
enableScaling: false,
enableZ: false,
toggleToolOnClick: false,
},
visibleElements: {
settingsMenu: false,
selectionTools: {
"lasso-selection": false,
"rectangle-selection": false
}
}
});
Solved! Go to Solution.
The MapView's hitTest method is what you're looking for, here is a sample.
I suspect the answer from @BenElan to the post
may help you
How does this help attach listeners to shapes created through Sketch widget?
Sorry i might not be clear with what i am trying to achieve.
Lets assume i have a bunch of graphics on the map, in this case they were added in by Sketch.
Is it possible to attach a listener to each graphic, so that when clicked on it alerts("hello world").
I am fairly new to ArcgJS and the documentation is not as clear as i am used to.
The MapView's hitTest method is what you're looking for, here is a sample.