GraphStream Users

Archives de la liste Aide

Re: sprite help

Chronologique Discussions 
  • From: "Gergely Zahoransky-Kohalmi" <gzahoransky-kohalmi AT>
  • To: <antoine.dutot AT>,<graphstream-users AT>
  • Subject: Re: sprite help
  • Date: Wed, 13 Nov 2013 15:41:29 -0700

Hi Antoine,

Thank you so much for your help!

I was able to make the sprites disappear using the "ui.hide" attribute,
and make the re-appear when removing that attribute.
However, I realized, that zooming-in or out breaks this hide-unhide
routine. It seems to me that something takes over control of the view
upon zooming in/out, but I don't know what it can be.

Also, I could not find the method to override that you were referencing,
i.e. elementMoving(). I looked for it in the Element class, the Sprite
class, the MouseManager class.

I also wonder if there is a more in-depth documentation on MouseManager
and DefaultMouseManager. Whet I am specifically curious about is what
sorts of MouseManagers are to choose from. Or did you mean by changing
the DefaultMouseManager to actually changing things inside the
DefaultMouseManager class?

I appreciate your help!



>>> Antoine Dutot 11/12/13 4:07 AM >>>

For question 1 : You can have a look at the DefaultMouseManager used by
each View (Viewer.getDefaultView()) and change it using

The method to override is elementMoving(). Just add a test on the kind
element (instance of GraphicSprite), and they will not receive mouse

For questions 2 and 3 you can use a mix of MouseManager, Stylesheet and
the « ui.hide » attribute (see
Also you can reset the sprite position in Sprite.setPosition (see
org.graphstream.ui.spriteManager) if it has been moved.

Hope this helps.



> Hello List,
> First of all I'd like to say thanks for your effort to create this
> graph
> visualizer!
> I'd like to ask your help in three questions related to handling
> 1. Can I make the sprites non-clickable so that users can't move them
> around?
> 2. Can I reset (re-position to edge) sprites in the case user
> drags them away from their edge?
> 3. Can I make sprites hide and reappear (at the respective edge) upon
> initiated event (e.g. mouse click)? I tried using the detach method of
> sprites
> but that put all the sprites on top of each other, but I could not
> them
> disappear. I also noticed that in the case of moving a sprite away
from its
> edge, then doing the detach-reattach cycle the sprite won't appear at
> original edge but somewhere else.
> Any help would be greatly appreciated!
> Thanks,
> Gergely

  • sprite help, gzahoransky-kohalmi, 11/11/2013
    • <Suite(s) possible(s)>
    • Re: sprite help, Gergely Zahoransky-Kohalmi, 13/11/2013

Archives gérées par MHonArc 2.6.16.

Top of page