Hi all
I'm hoping this is a simple query. On my map a customer is restricted to dropping a simple marker on our streets feature layer only. This stops customers dropping markers in fields or any other area when reporting an issue with a street. This happens via a hitTest event on the graphics (see sample below).
view.on("click", function (evt) {
var graphic = new Graphic({
geometry: {
type: "point",
x: evt.mapPoint.x,
y: evt.mapPoint.y,
spatialReference: view.spatialReference,
},
symbol: {
type: "simple-marker",
color: [255, 10, 10],
outline: {
color: [255, 255, 255],
width: 2,
},
},
});
view.hitTest(evt).then(({results}) => {
if (results.length) {
view.graphics.removeAll();
view.graphics.add(graphic);
}
});
});
This currently works brilliantly.

However if I add another feature layer to the map (in this case our county boundary layer), the restrict to hitTest part of the query for the graphics marker is ignored and it lets a customer drop a marker anywhere of their choosing.

Why is it doing this and what can I do to mitigate it? The hitTest is only linked to the streets layer and that part still works fine when a street in interacted with, it's just the graphics query which seems to be ignored now.
I've got my roads feature layer to load as 0 and the boundary layer as 1.
Thanks