cytoscape / wineandcheesemap

http://www.wineandcheesemap.com/
MIT License
80 stars 52 forks source link

Migrate to Cytoscape 3.x ? #3

Closed RK-Veltec closed 4 years ago

RK-Veltec commented 6 years ago

The example uses Cytoscape.js 2.7.2 Is there any plans to update this example to Cytoscape.js +3.0.0?

Just updating the files works decently as it is, but I wrote this event and it didn't work:

cy.on('tapdragover', 'node', _.debounce( function(e){
 var target = e.cyTarget;
 if(target.selected()){
  return;
 }
 if( target.nonempty() ){
  showNodeInfo( node );
 } 
}, 100) );

It returns "cannot find property selected of null". This error doesn't occur using 2.7.2.

RK-Veltec commented 6 years ago

The difference is basically the e.cyTarget that was updated to e.target in the 3.x.x^ releases. I saw no other problems with compatibility.

That code works with this changes:

cy.on('tapdragover', 'node', _.debounce( function(e){
 var ctarget = e.target;
 if(ctarget.selected()){
  return;
 }
 if( ctarget.nonempty() ){
  showNodeInfo( node );
 } 
}, 100) );
maxkfranz commented 6 years ago

It would be great to eventually update this demo, but it doesn't make much practical difference whether it uses 2.x or 3.x. I don't think that people should be using this as a basis for an app or copying and pasting it: It's just a little demo to show what the lib can do with a little code.

The main motivator for updating to 3.x on this demo would be to improve the options used for the concentric layout. Currently, it spreads things out more than necessary. There are options in 3.x to mitigate this.

Anyway, updating this demo to 3.x is not a high priority at the moment. If you already have the upgrade working, I'd appreciate a PR.

zouhairm commented 5 years ago

I don't think that people should be using this as a basis for an app or copying and pasting it: It's just a little demo to show what the lib can do with a little code.

Funny because that's exactly what I intended to do. Do you have suggestions for another code to copy/paste as a starting point for a fun project?

maxkfranz commented 5 years ago

If you don't want to create an app's scaffolding yourself you should use something like create-react-app or yeoman.