GraphStream Users

Archives de la liste Aide

Re: Issue with sprites, can't click nodes

Chronologique Discussions 
  • From: Cézanne Alves <cezannealves AT>
  • To: matheus.g.unicamp AT
  • Cc: "graphstream-users AT" <graphstream-users AT>
  • Subject: Re: Issue with sprites, can't click nodes
  • Date: Mon, 6 Feb 2017 02:32:03 -0300

Hi, Matheus, thanks for the help.

for what I saw in your thread, your problem is not the same as mine. Or they didn't get it.

pigne commented on 19 Aug 2016

Well I beg to differ on that comment.

  • Sprites can be moved with the mouse.
  • But their position is also relative to their attached node. Move the node and the sprite will move accordingly/relatively.

If you click on the sprite, you'll move the sprite. If you want to move both the sprite and the node then click on the node.

I don't know about your precise scenario or your precise needs but from a general point of view (keep in ming that GraphStream is a general-purpose dynamic graph library) I believe this is the desired behavior.

If it was behaving like that I would be verry happy. That's exacly what I want.
In my case I can't even click on or move the node while the sprites are overlapping (even if they are below the nodes). the clicks and the drags aways afect only the sprites.

2017-02-04 16:58 GMT-03:00 <matheus.g.unicamp AT>:

I already opened na issue on GitHub about it ( ) . They fixed few stuff but the problem remained, they said its the default behaviour.



De: Cézanne Alves
Enviado:sábado, 4 de fevereiro de 2017 05:45
Para: graphstream-users AT
Assunto: Issue with sprites, can't click nodes


Hello people, thanks you for the openess and sorry for bothering you.


I'm trying to make a dynamic and responsive interface for a project, where I need to show the comunication radius of the elements like in the picture (I don't realy know if you will be able to see through this mail list).


I tried to use sprites attached in the nodes for the radiuses, stylized like in the following css




text-alignment: under;











the problem is when I try to click and drag in the nodes only the sprites move. I'm only able to click a node when no sprite overlap. 

I tried "fill-mode:none;" and "z-index:1;", but even if the sprite is rendered below the node I can only drag the sprite.


I looked at the source and find:

"public void mousePressed(MouseEvent event) {

curElement = view.findNodeOrSpriteAt(event.getX(), event.getY());


and  view.findNodeOrSpriteAt doc says:



       Search for the first node or sprite (in that order) that contains the point at coordinates (x, y)




then I folowed the source until DefaultCamera.findNodeOrSpriteAt() and it seems exacly this what it does:



public GraphicElement findNodeOrSpriteAt(GraphicGraph graph, double x,


                                             double y) {

        for (Node n : graph) {

            GraphicNode node = (GraphicNode) n;


            if (nodeContains(node, x, y))


                return node;



        for (GraphicSprite sprite : graph.spriteSet()) {

            if (spriteContains(sprite, x, y))


                return sprite;



        return null;





Then I gave up and tried to do it with nodes:











And the same thing happen. Whatever node I click the clicks aways hit the radius node, even that they where added after.


It seems like the clicks tend to hit big targets first. but it doesn't make sense when I look at findNodeOrSpriteAt().


Does someone know what is happening?




Archives gérées par MHonArc 2.6.16.

Top of page