GraphStream Users

Archives de la liste Aide


Re: sprite help


Chronologique Discussions 
  • From: "Gergely Zahoransky-Kohalmi" <gzahoransky-kohalmi AT salud.unm.edu>
  • To: <antoine.dutot AT gmail.com>,<graphstream-users AT litislab.fr>
  • 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!


Best,


Gergely




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

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

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

For questions 2 and 3 you can use a mix of MouseManager, Stylesheet and
the « ui.hide » attribute (see
http://graphstream-project.org/doc/FAQ/Attributes/Is-there-a-list-of-attributes-with-a-predefined-meaning-for-the-graph-viewer_1.0/).
Also you can reset the sprite position in Sprite.setPosition (see
org.graphstream.ui.spriteManager) if it has been moved.

Hope this helps.

Antoine

2013/11/11

> Hello List,
>
> First of all I'd like to say thanks for your effort to create this
great
> graph
> visualizer!
>
> I'd like to ask your help in three questions related to handling
sprites.
>
> 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
incidentally
> drags them away from their edge?
>
> 3. Can I make sprites hide and reappear (at the respective edge) upon
user
> 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
make
> 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
the
> 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