Giter Site home page Giter Site logo

Comments (2)

jwasilgeo avatar jwasilgeo commented on June 18, 2024 1

I am pretty sure this has to do with the ArcGIS API for JavaScript, and not anything to do with TS, Angular, or this lib. The jsfiddle points to a working example with v3.x, but you're writing and using v4.x of the ArcGIS API for JavaScript. Mouse interaction listeners are quite different in this version.

The error I think is because there are only 2 (documented) events you can listen to from the GraphicsLayer.

I suggest you listen for a click on the MapView in v4.x.

https://developers.arcgis.com/javascript/latest/sample-code/layers-scenelayer-query-popup/index.html?search=click%20event

https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#event:click

from angular-esri-loader.

andygup avatar andygup commented on June 18, 2024 1

@LudoFont adding onto Jacob's comments, I'd also recommend using the hitTest() pattern to check for graphics in a GraphicsLayer or FeatureLayer. Here's a sample: https://developers.arcgis.com/javascript/latest/sample-code/view-hittest/index.html

// Get the screen point from the view's click event
view.on("click", function(event){
    var screenPoint = {
       x: event.x,
       y: event.y
    };

    // Search for graphics at the clicked location 
    view.hitTest(screenPoint).then(function(response){
        if(response.results[0].graphic){
           console.log("Top graphic found! Here it is: ", response.results[0].graphic);
        }
    });
})

from angular-esri-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.