javascriptarcgis-js-apiesri-maps

ArcGis JS API 4.11, 4.12 Incorrect work GraphicsView2D (from esri/views/2d/layers/grapics/GraphicsView2D) hitTest method


ArcGis JS API 4.11, 4.12 GraphicsView2D (from esri/views/2d/layers/grapics/GraphicsView2D) hitTest method return only one feature(graphic) with zero index. Better to be return all graphics.

Is it issue or correct work?

UPD: I opened source code https://github.com/Esri/jsapi-resources Go to 4master branch Open /views/2d/layers/graphics/GraphicsView2D.js

in hitTest method see implementation like

t.prototype.hitTest = function (e, t) {
    if (!this.view || !this.view.position) return l.resolve();
    var r = this.view.toMap(g.createScreenPoint(e, t));
    return this.searchFeatures(r).then(function (e) {
        return e && e.length ? e[0] : null
    })
}

From all features from graphicsView return only one value (e[0] with zero index)

I created example https://jsfiddle.net/catcherholms/dmp1z387/143/ with many objects

When I clicked here here in hitTest result I receive one feature and should be more than one


Solution

  • This is what hitTest supposed to return:
    "Returns the topmost feature from each layer that intersects the specified screen coordinates. The following layer types will return a result"