I tried modifying code in several examples that use simplemarkersymbol and adding features as a collection of graphics but I could not find a sample that more closely matches my current situation. I am creating an empty feature layer like so
var featureLayer = new FeatureLayer({
fields: [
{
name: "ObjectID",
alias: "ObjectID",
type: "oid"
}
],
id: "CustomPointLayer",
objectIdField: "ObjectID",
geometryType: "point",
spatialReference: spatialReference,
source: sourceCollection
});
this.customPointLayer = featureLayer;
this.customPointLayer.then(() => {
defer.resolve();
});
localMap.add(this.customPointLayer);
And then im adding a graphic like so
var circleProperties: __esri.SimpleMarkerSymbolProperties = {
size: 40,
color: new Color("red"),
outline: {
color: new Color([255, 255, 255]),
width: 0
}
};
var circleSymbol = new SimpleMarkerSymbol(circleProperties);
var circleGraphic = new Graphic();
circleGraphic.geometry = point;
circleGraphic.symbol = circleSymbol;
circleGraphic.attributes = {
ObjectID: this.guidService.newGuid(),
recordsIds: clusterSymbolType.recordIds
}
customPointLayer.source.add(circleGraphic);
I then add a textsymbol on top of it like so
var countProperties: __esri.TextSymbolProperties = {
color: new Color("white"),
yoffset: -5,
text: count.toString(),
font: { // autocast as esri/symbols/Font
size: "20px",
family: "roboto",
weight: "400"
}
};
var countSymbol = new TextSymbol(countProperties);
var countGraphic = new Graphic();
countGraphic.geometry = point;
countGraphic.symbol = countSymbol;
countGraphic.attributes = {
ObjectID: this.guidService.newGuid(),
recordsIds: clusterSymbolType.recordIds
};
customPointLayer.source.add(countGraphic);
im then listening like so
this.mapView.then(() => {
this.mapView.on("click",
(p) => {
this.mapView.hitTest(p.screenPoint)
.then(response => {
// do something with the result graphic
var graphic = response.results[0].graphic;
});
});
this.mapViewDefer.resolve();
});
However no matter which browser the hitTest returns 0 length for the results property