https://github.com/cytoscape/cytoscape.js-edgehandles

Edge creation UI extension for Cytoscape.js

https://github.com/cytoscape/cytoscape.js-edgehandles

Science Score: 33.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    1 of 18 committers (5.6%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.6%) to scientific vocabulary

Keywords

cytoscapejs cytoscapejs-extension

Keywords from Contributors

network-visualization graph-theory visualisation transformation diagrams network-analysis graph-drawing
Last synced: 10 months ago · JSON representation

Repository

Edge creation UI extension for Cytoscape.js

Basic Info
  • Host: GitHub
  • Owner: cytoscape
  • License: mit
  • Language: HTML
  • Default Branch: master
  • Homepage:
  • Size: 15.9 MB
Statistics
  • Stars: 174
  • Watchers: 25
  • Forks: 85
  • Open Issues: 1
  • Releases: 17
Topics
cytoscapejs cytoscapejs-extension
Created over 12 years ago · Last pushed 11 months ago
Metadata Files
Readme License

README.md

cytoscape-edgehandles

DOI

Preview

Description

This extension allows for drawing edges between nodes (demo, demo (snapping disabled), compound demo, compound demo (snapping disabled))

You can use Popper to create your own handles, as shown in the demo.

Dependencies

  • Cytoscape.js 3.x, >= 3.2.0
  • Lodash 4.x, >= 4.1
    • memoize
    • throttle

Usage instructions

Download the library: * via npm: npm install cytoscape-edgehandles, * via bower: bower install cytoscape-edgehandles, or * via direct download in the repository (probably from a tag).

Import the library as appropriate for your project:

ES import:

```js import cytoscape from 'cytoscape'; import edgehandles from 'cytoscape-edgehandles';

cytoscape.use( edgehandles ); ```

CommonJS require:

```js let cytoscape = require('cytoscape'); let edgehandles = require('cytoscape-edgehandles');

cytoscape.use( edgehandles ); // register extension ```

AMD:

js require(['cytoscape', 'cytoscape-edgehandles'], function( cytoscape, edgehandles ){ edgehandles( cytoscape ); // register extension });

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

Initialisation

You initialise the extension on the Cytoscape instance:

```js

let cy = cytoscape({ container: document.getElementById('#cy'), /* ... */ });

// the default values of each option are outlined below: let defaults = { canConnect: function( sourceNode, targetNode ){ // whether an edge can be created between source and target return !sourceNode.same(targetNode); // e.g. disallow loops }, edgeParams: function( sourceNode, targetNode ){ // for edges between the specified source and target // return element object to be passed to cy.add() for edge return {}; }, hoverDelay: 150, // time spent hovering over a target node before it is considered selected snap: true, // when enabled, the edge can be drawn by just moving close to a target node (can be confusing on compound graphs) snapThreshold: 50, // the target node must be less than or equal to this many pixels away from the cursor/finger snapFrequency: 15, // the number of times per second (Hz) that snap checks done (lower is less expensive) noEdgeEventsInDraw: true, // set events:no to edges during draws, prevents mouseouts on compounds disableBrowserGestures: true // during an edge drawing gesture, disable browser gestures such as two-finger trackpad swipe and pinch-to-zoom };

let eh = cy.edgehandles( defaults );

```

API

The object returned by cy.edgehandles() has several functions available on it:

  • start( sourceNode ) : manually start the gesture (as if the handle were already held)
  • stop() : manually completes or cancels the gesture
  • disable() : disables edgehandles behaviour
  • enable() : enables edgehandles behaviour
  • enableDrawMode() : turn on draw mode (the entire node body acts like the handle)
  • disableDrawMode() : turn off draw mode
  • destroy() : remove edgehandles behaviour

Classes

These classes can be used for styling the graph as it interacts with the extension:

  • eh-source : The source node
  • eh-target : A target node
  • eh-preview : Preview edges (i.e. shown before releasing the mouse button and the edge creation is confirmed)
  • eh-hover : Added to nodes as they are hovered over as targets
  • eh-ghost-node : The ghost node (target), used when the cursor isn't pointed at a target node yet (i.e. in place of a target node)
  • eh-ghost-edge : The ghost handle line edge, used when the cursor isn't pointed at a target node yet (i.e. the edge is pointing to empty space)
  • eh-ghost : A ghost element
  • eh-presumptive-target : A node that, during an edge drag, may become a target when released
  • eh-preview-active : Applied to the source, target, and ghost edge when the preview is active

Events

During the course of a user's interaction with the extension, several events are generated and triggered on the core. Each event callback has a number of extra parameters, and certain events have associated positions.

  • ehstart : when the edge creation gesture starts
    • (event, sourceNode)
    • event.position : handle position
  • ehcomplete : when the edge is created
    • (event, sourceNode, targetNode, addedEdge)
    • event.position : cursor/finger position
  • ehstop : when the edge creation gesture is stopped (either successfully completed or cancelled)
    • (event, sourceNode)
    • event.position : cursor/finger position
  • ehcancel : when the edge creation gesture is cancelled
    • (event, sourceNode, cancelledTargets)
    • event.position : cursor/finger position
  • ehhoverover : when hovering over a target
    • (event, sourceNode, targetNode)
    • event.position : cursor/finger position
  • ehhoverout : when leaving a target node
    • (event, sourceNode, targetNode)
    • event.position : cursor/finger position
  • ehpreviewon : when a preview is shown
    • (event, sourceNode, targetNode, previewEdge)
    • event.position : cursor/finger position
  • ehpreviewoff : when the preview is removed
    • (event, sourceNode, targetNode, previewEdge)
    • event.position : cursor/finger position
  • ehdrawon : when draw mode is enabled
    • (event)
  • ehdrawoff : when draw mode is disabled
    • (event)

Example binding:

```js cy.on('ehcomplete', (event, sourceNode, targetNode, addedEdge) => { let { position } = event;

// ... }); ```

Build targets

  • npm run test : Run Mocha tests in ./test
  • npm run build : Build ./src/** into cytoscape-edgehandles.js
  • npm run watch : Automatically build on changes with live reloading (N.b. you must already have an HTTP server running)
  • npm run dev : Automatically build on changes with live reloading with webpack dev server
  • npm run lint : Run eslint on the source

N.b. all builds use babel, so modern ES features can be used in the src.

Publishing instructions

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

  1. Build the extension : npm run build:release
  2. Commit the build : git commit -am "Build for release"
  3. Bump the version number and tag: npm version major|minor|patch
  4. Push to origin: git push && git push --tags
  5. Publish to npm: npm publish .
  6. If publishing to bower for the first time, you'll need to run bower register cytoscape-edgehandles https://github.com/cytoscape/edgehandles.gita
  7. Make a new release for Zenodo.

Owner

  • Name: Cytoscape Consortium
  • Login: cytoscape
  • Kind: organization

GitHub Events

Total
  • Issues event: 7
  • Watch event: 8
  • Delete event: 3
  • Issue comment event: 13
  • Pull request event: 9
  • Create event: 1
Last Year
  • Issues event: 7
  • Watch event: 8
  • Delete event: 3
  • Issue comment event: 13
  • Pull request event: 9
  • Create event: 1

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 267
  • Total Committers: 18
  • Avg Commits per committer: 14.833
  • Development Distribution Score (DDS): 0.18
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Max Franz m****z@g****m 219
buffpojken d****l@s****m 16
Manfred Cheung m****n@u****a 8
tongbin x****n@g****m 4
Luke Szanto l****e@l****u 3
relliott r****t@f****m 3
Alex Nault n****x@g****m 2
Ivan Tadeu Ferreira Antunes Filho i****a@g****m 2
Werner Laurensse 1
Alexander Li a****0@g****m 1
Alexandre Bonaventure Geissmann a****x@l****m 1
Amadeusz Starzykiewicz m****r@g****m 1
Amaury Hernandez-Aguila a****g@g****m 1
Christophe Willemsen w****e@g****m 1
Luke Szanto l****o@g****m 1
William Emfinger w****r@g****m 1
Alexandr Sashin a****n@g****m 1
Enrique Meléndez Estrada e****z@i****s 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 88
  • Total pull requests: 34
  • Average time to close issues: 3 months
  • Average time to close pull requests: 2 months
  • Total issue authors: 64
  • Total pull request authors: 13
  • Average comments per issue: 2.31
  • Average comments per pull request: 2.15
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 17
Past Year
  • Issues: 5
  • Pull requests: 10
  • Average time to close issues: 16 days
  • Average time to close pull requests: 14 days
  • Issue authors: 5
  • Pull request authors: 2
  • Average comments per issue: 1.2
  • Average comments per pull request: 0.7
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 8
Top Authors
Issue Authors
  • maxkfranz (6)
  • aprudnikoff (5)
  • umdstu (4)
  • ketysek (4)
  • buffpojken (3)
  • SanderBreivik (3)
  • til2000 (2)
  • CBeuth10 (2)
  • anthonysapien (2)
  • hegoczkigabor (2)
  • mafar (2)
  • ajinkyagadgil (1)
  • tanishq1398 (1)
  • herosPan (1)
  • kprasad99 (1)
Pull Request Authors
  • dependabot[bot] (20)
  • wrnrlr (3)
  • itf (3)
  • luke-mckee-ol (2)
  • timmh (1)
  • umdstu (1)
  • buffpojken (1)
  • dwagin (1)
  • emmasuzuki (1)
  • Lachee (1)
  • jsphstls (1)
  • alexandrsashin (1)
  • finger563 (1)
Top Labels
Issue Labels
stale (33) enhancement (3) pinned (2) bug (2)
Pull Request Labels
stale (20) dependencies (20) javascript (6)

Packages

  • Total packages: 6
  • Total downloads:
    • npm 21 last-month
  • Total dependent packages: 1
    (may contain duplicates)
  • Total dependent repositories: 5
    (may contain duplicates)
  • Total versions: 73
  • Total maintainers: 1
bower.io: cytoscape-edgehandles

Edge creation UI extension for Cytoscape

  • License: MIT
  • Latest release: v4.0.1
    published almost 5 years ago
  • Versions: 61
  • Dependent Packages: 0
  • Dependent Repositories: 4
Rankings
Forks count: 6.0%
Dependent packages count: 6.0%
Average: 7.7%
Stargazers count: 8.9%
Dependent repos count: 9.7%
Last synced: 11 months ago
npmjs.org: cytoscape-edgehandles-no-jquery

Edge creation extension for Cytoscape.js without jquery

  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 21 Last month
Rankings
Forks count: 3.2%
Stargazers count: 4.3%
Dependent repos count: 10.3%
Average: 15.2%
Dependent packages count: 20.9%
Downloads: 37.2%
Maintainers (1)
Last synced: 11 months ago
repo1.maven.org: org.webjars.npm:cytoscape-edgehandles

WebJar for cytoscape-edgehandles

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 14.1%
Stargazers count: 18.7%
Average: 28.4%
Dependent repos count: 32.0%
Dependent packages count: 48.9%
Last synced: 11 months ago
repo1.maven.org: org.webjars.bowergithub.cytoscape:cytoscape.js-edgehandles

WebJar for cytoscape-edgehandles

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 14.1%
Stargazers count: 18.7%
Average: 28.4%
Dependent repos count: 32.0%
Dependent packages count: 48.9%
Last synced: 11 months ago
repo1.maven.org: org.webjars.npm:github-com-cytoscape-cytoscape-js-edgehandles

WebJar for cytoscape-edgehandles

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 14.1%
Stargazers count: 18.7%
Average: 28.4%
Dependent repos count: 32.0%
Dependent packages count: 48.9%
Last synced: 11 months ago
repo1.maven.org: org.webjars.bower:cytoscape-edgehandles

WebJar for cytoscape-edgehandles

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 14.1%
Stargazers count: 18.7%
Average: 28.4%
Dependent repos count: 32.0%
Dependent packages count: 48.9%
Last synced: 11 months ago

Dependencies

bower.json bower
  • cytoscape ^3.2.0
package-lock.json npm
  • 1097 dependencies
package.json npm
  • babel-core ^6.24.1 development
  • babel-loader ^7.0.0 development
  • babel-preset-env ^1.5.1 development
  • camelcase ^4.1.0 development
  • chai 4.0.2 development
  • cpy-cli ^1.0.1 development
  • cross-env ^5.0.0 development
  • eslint ^3.9.1 development
  • gh-pages ^1.0.0 development
  • mocha 3.4.2 development
  • npm-run-all ^4.1.2 development
  • rimraf ^2.6.2 development
  • update ^0.7.4 development
  • updater-license ^1.0.0 development
  • webpack ^2.6.1 development
  • webpack-dev-server ^2.4.5 development
  • lodash.memoize ^4.1.2
  • lodash.throttle ^4.1.1