iVis-at-Bilkent/cytoscape.js-edge-bend-editing

Name: cytoscape.js-edge-bend-editing

Owner: iVis-at-Bilkent

Description: A Cytoscape.js extension enabling interactive editing of edge bend points

Created: 2016-06-27 08:03:50.0

Updated: 2017-09-22 06:24:44.0

Pushed: 2017-08-21 09:58:58.0

Homepage:

Size: 609

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

cytoscape-edge-bend-editing

Description

A Cytoscape.js extension enabling interactive editing of edge bend points, distributed under The MIT License.

Demo

Click here for demo

Dependencies
Usage instructions

Download the library:

require() the library as appropriate for your project:

CommonJS:

cytoscape = require('cytoscape');
jquery = require('jquery');
edgeBendEditing = require('cytoscape-edge-bend-editing');

BendEditing( cytoscape, jquery ); // register extension

AMD:

ire(['cytoscape', 'cytoscape-edge-bend-editing'], function( cytoscape, edge-bend-editing ){
ge-bend-editing( cytoscape ); // register extension

Plain HTML/JS has the extension registered for you automatically, because no require() is needed.

API
instance = cy.edgeBendEditing( options );

An instance has a number of functions available:


t segment points of the given edge in an array A,
2 * i] is the x coordinate and A[2 * i + 1] is the y coordinate
 the ith bend point. (Returns undefined if the curve style is not segments)

ance.getSegmentPoints(ele);
nitilize bend points for the given edges using 'options.bendPositionsFunction'
ance.initBendPoints(eles)

You can also get an existing instance:

dgeBendEditing('get'); // Returns undefined if the extension is not initialized yet

Or you can check if the extension is initilized before

dgeBendEditing('initialized');
Default Options
var options = {
  // this function specifies the positions of bend points
  bendPositionsFunction: function(ele) {
    return ele.data('bendPointPositions');
  },
  // whether to initilize bend points on creation of this extension automatically
  initBendPointsAutomatically: true,
  // whether the bend editing operations are undoable (requires cytoscape-undo-redo.js)
  undoable: false,
  // the size of bend shape is obtained by multipling width of edge with this parameter
  bendShapeSizeFactor: 6,
  // whether to start the plugin in the enabled state
  enabled: true,
  // title of add bend point menu item (User may need to adjust width of menu items according to length of this option)
  addBendMenuItemTitle: "Add Bend Point",
  // title of remove bend point menu item (User may need to adjust width of menu items according to length of this option)
  removeBendMenuItemTitle: "Remove Bend Point"
};
Publishing instructions

This project is set up to automatically be published to npm and bower. To publish:

  1. Set the version number environment variable: export VERSION=1.2.3
  2. Publish: gulp publish
  3. If publishing to bower for the first time, you'll need to run bower register cytoscape-edge-bend-editing https://github.com/iVis-at-Bilkent/cytoscape.js-edge-bend-editing.git
Team

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.