GraphStream Users

Archives de la liste Aide


RES: Issue with sprites, can't click nodes


Chronologique Discussions 
  • From: <matheus.g.unicamp AT gmail.com>
  • To: Cézanne Alves <cezannealves AT gmail.com>, "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>
  • Subject: RES: Issue with sprites, can't click nodes
  • Date: Sat, 4 Feb 2017 17:58:03 -0200
  • Importance: normal

I already opened na issue on GitHub about it (https://github.com/graphstream/gs-core/issues/199 ) . 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 litislab.fr
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

 

node{

size:6gu;

text-alignment: under;

}

 

sprite.radius{

size:50gu;

fill-mode:none;

stroke-mode:plain;

z-index:1;

fill-color:yellow;

}

 

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:

 

"

node.radius{

size:50gu;

fill-mode:none;

stroke-mode:plain;

z-index:1;

/*fill-color:yellow;*/

}

"

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