KK 13
KK 13

Reputation: 53

How to initialize library extension correctly?

I want to use cytoscape.js extension named edgehandler in my project but it doesn't work. All I need is on that demo: DEMO EDGEHANDLES

I've add script:

<script src="{% static "js/cytoscape-edgehandles.js"%}"></script>

And initialization from GitHub cytoscape.js-edgehandles right under cytoscape.js variable:

let defaults = {
    preview: true, 
    hoverDelay: 150, 
    handleNodes: 'node', 
    snap: false, 
    snapThreshold: 50, 
    snapFrequency: 15, 
    noEdgeEventsInDraw: false, 
    disableBrowserGestures: true, 
    handlePosition: function( node ){
      return 'middle top'; 
    },
    handleInDrawMode: false,
  };
  
  let eh = cy.edgehandles( defaults );

Upvotes: 0

Views: 131

Answers (1)

Hasan Balcı
Hasan Balcı

Reputation: 1088

You should also add <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.10/lodash.js"></script> before js/cytoscape-edgehandles.js script. See demo file in extension: https://github.com/cytoscape/cytoscape.js-edgehandles/blob/master/demo.html

Upvotes: 1

Related Questions