Code Monkey home page Code Monkey logo

Comments (9)

nickcam avatar nickcam commented on May 28, 2024 1

Hey man, yeah I'm pretty sure it is possible to do. Didn't do it before as the flare graphics may also represent multiple points and the graphics are temporary. They get fully destroyed when the cluster is deactivated.

I'm doing some work on this again to make it work with v4.12, so I'll take a look at implementing this while I'm in there. Can't give a time frame though sorry.

from flareclusterlayer.

nickcam avatar nickcam commented on May 28, 2024 1

Finally got around to looking at this. The pointer events are only disabled over the text svg elements, so a click event on the flares works fine.

I added an event emitter to the layer that will emit an event with a Flare object as the argument. Subscribe to the event on the layer like this -

clusterLayer.on("flare-clicked", function (flare) {
   console.log('flare clicked', flare);
});

Any time you click a flare this will then get hit get. All of the data you need to make a popup appear should be in the Flare object that's passed in. If it's a flare representing only one point, then the Flare object will contain a property called singleData. This is your data object. You can use the existence of this property to test if you want to create a popup or not.

It's a bit of a cop out not creating the popup within the layer (certainly is easier), but this is bit more flexible so you can anything you want on any flare click.

from flareclusterlayer.

nickcam avatar nickcam commented on May 28, 2024 1

Hi @apaleja, no worries - added a cluster-clicked event as well. Use it the same way as the flare-clicked event.

clusterLayer.on("cluster-clicked", function (cluster) {
    console.log('cluster clicked', cluster);
 });

from flareclusterlayer.

roy0633 avatar roy0633 commented on May 28, 2024

@nickcam thank you for updating to the latest version...
If I make an interesting online system, I will share it with you first.

from flareclusterlayer.

basisbit avatar basisbit commented on May 28, 2024

Other mouse-events like mouse-scrolling (probably for the same reason) also don't work. You can reproduce this by opening the https://flareclusterlayer.azurewebsites.net/index_v4.html sample, zooming in a bit on Melbourne, Australia so that lots of screen space if occupied by the bubbles/circles and then try to zoom in/out on the map using mouse scrolling.

from flareclusterlayer.

nickcam avatar nickcam commented on May 28, 2024

Yeah from memory all mouse (pointer) events are disabled over the cluster graphics. There was a good reason for this but I can't remember what is was right now. Will have to take a look when I get a chance.

from flareclusterlayer.

apaleja avatar apaleja commented on May 28, 2024

@nickcam +1 for this. I also would like to show popup similar to ArcGIS 3.x Implementation Can you give some pointers, how to do that ? I will see if I can make required changes.

from flareclusterlayer.

apaleja avatar apaleja commented on May 28, 2024

Hi @nickcam Thank you very much for quick change implementation. I believe this change allows to capture click on Flare of Cluster. I am looking for a solution when displayFlares: false and user click on cluster icon.

Is it possible to emit similar event for cluster click as well ?

from flareclusterlayer.

apaleja avatar apaleja commented on May 28, 2024

@nickcam Thank very much for for quick turn around.

from flareclusterlayer.

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.