iVis-at-Bilkent/cytoscape.js-grid-guide

Name: cytoscape.js-grid-guide

Owner: iVis-at-Bilkent

Description: A Cytsocape.js extension to provide a framework for grid interactions such as grid lines and snapping to grid, and guidelines and snap support for alignment of nodes.

Created: 2016-06-27 08:02:07.0

Updated: 2017-12-29 01:50:11.0

Pushed: 2017-12-19 11:27:34.0

Homepage:

Size: 343

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

cytoscape-grid-guide

Description

A sophisticated and highly customizable Cytoscape.js extension for grid and guideline interactions, distributed under The MIT License. The following features are provided:

The users are allowed to customize various things about the functionality including:

Demo

Click here for demo

API

Default Undo/Redo Actions

o("align", {
nodes: cy.nodes(":selected"),
vertical: "left",
horizontal: "top",
alignTo: cy.nodes(":selected")[0],

Default Options
options = {
// On/Off Modules
/* From the following four snap options, at most one should be true at a given time */
snapToGridOnRelease: true, // Snap to grid on release
snapToGridDuringDrag: false, // Snap to grid during drag
snapToAlignmentLocationOnRelease: false, // Snap to alignment location on release
snapToAlignmentLocationDuringDrag: false, // Snap to alignment location during drag
distributionGuidelines: false, // Distribution guidelines
geometricGuideline: false, // Geometric guidelines
initPosAlignment: false, // Guideline to initial mouse position
centerToEdgeAlignment: false, // Center to edge alignment
resize: false, // Adjust node sizes to cell sizes
parentPadding: false, // Adjust parent sizes to cell sizes by padding
drawGrid: true, // Draw grid background

// General
gridSpacing: 20, // Distance between the lines of the grid.

// Draw Grid
zoomDash: true, // Determines whether the size of the dashes should change when the drawing is zoomed in and out if grid is drawn.
panGrid: false, // Determines whether the grid should move then the user moves the graph if grid is drawn.
gridStackOrder: -1, // Namely z-index
gridColor: '#dedede', // Color of grid lines
lineWidth: 1.0, // Width of grid lines

// Guidelines
guidelinesStackOrder: 4, // z-index of guidelines
guidelinesTolerance: 2.00, // Tolerance distance for rendered positions of nodes' interaction.
guidelinesStyle: { // Set ctx properties of line. Properties are here:
    strokeStyle: "#8b7d6b", // color of geometric guidelines
    geometricGuidelineRange: 400, // range of geometric guidelines
    range: 100, // max range of distribution guidelines
    minDistRange: 10, // min range for distribution guidelines
    distGuidelineOffset: 10, // shift amount of distribution guidelines
    horizontalDistColor: "#ff0000", // color of horizontal distribution alignment
    verticalDistColor: "#00ff00", // color of vertical distribution alignment
    initPosAlignmentColor: "#0000ff", // color of alignment to initial mouse location
    lineDash: [0, 0], // line style of geometric guidelines
    horizontalDistLine: [0, 0], // line style of horizontal distribution guidelines
    verticalDistLine: [0, 0], // line style of vertical distribution guidelines
    initPosAlignmentLine: [0, 0], // line style of alignment to initial mouse position
},

// Parent Padding
parentSpacing: -1 // -1 to set paddings of parents to gridSpacing

Dependencies
Usage instructions

Download the library:

require() the library as appropriate for your project:

CommonJS:

cytoscape = require('cytoscape');
grid-guide = require('cytoscape-grid-guide');

-guide( cytoscape, jquery ); // register extension

AMD:

ire(['cytoscape', 'cytoscape-grid-guide'], function( cytoscape, grid-guide ){
grid-guide( cytoscape ); // register extension

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

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-grid-guide https://github.com/iVis-at-Bilkent/cytoscape.js-grid-guide.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.