Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dinamically new nodes : which API for PIXI graphics VS vivagraph? #31

Open
gg4u opened this issue Jul 27, 2017 · 0 comments
Open

add dinamically new nodes : which API for PIXI graphics VS vivagraph? #31

gg4u opened this issue Jul 27, 2017 · 0 comments

Comments

@gg4u
Copy link

gg4u commented Jul 27, 2017

Hi,

I would like to to switch from vivagraph SVG rendering to webGL based on PIXI.
I am looking at the PIXI examples, but struggle to understand how the logic works respect to vivagraph.

In the PIXI example, you define a getNodeAt function on stage, to return the node at coordinates x,y.
But like that the stage is bounded to graphics, and while I can interact with coordinates, I can't interact with the graph object. So I don't know how to call graph.addNodes or createNodeUI to add new graphs elements.

So I tried to add a native PIXI event to the sprite of nodes themselves, when I initialise a new node - http://pixijs.download/v4.3.4/docs/PIXI.interaction.InteractionManager.html#event:click -
like:

function initNode(node) {

var bunny = new PIXI.Sprite.fromImage('2.png');
    bunny.interactive = true;
    bunny.on('tap',  function(e) {
        alert("tap!!");
    });
 
    graphics.addChild(bunny);

}

But, despite I don't see any error, it does not work and the event does not fire.
Only stage.movedown seems to work.

Instead, with Viva it was really great API, for I could just swtich the renderer engine between svg and webgl.

Could you show examples on how to handle adding or removing graph elements in pixigraphics ?
Can pixi rendering be integrated in vivagraph , instead of WebGL rendering ? Could someone show an example?
That would be ideal, for PIXI can already handle well all the webgl part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant