cytoscape-automove
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -1,2 +0,2 @@ | ||
;(function(){ 'use strict'; | ||
(function(){ 'use strict'; | ||
@@ -18,14 +18,2 @@ var defaults = { | ||
// for `reposition: 'mean'`, specify nodes that should be ignored in the mean calculation | ||
// - a function that returns true for nodes to be ignored | ||
// - a selector that matches the nodes to be ignored | ||
// - a collection of nodes to be ignored (very good for performance) | ||
meanIgnores: function( node ){ return false; }, | ||
// for `reposition: 'drag'`, specify nodes that when dragged cause the matched nodes to move along | ||
// - a function that returns true for nodes to be listened to for drag events | ||
// - a selector that matches the nodes to be listened to for drag events | ||
// - a collection of nodes to be ignored (very good for performance) | ||
dragWith: function( node ){ return false; }, | ||
// specify when the repositioning should occur by specifying a function that | ||
@@ -41,3 +29,30 @@ // calls update() when reposition updates should occur | ||
// - default/undefined => on a position event for any node (not as efficient...) | ||
when: undefined | ||
when: undefined, | ||
// | ||
// customisation options for non-function `reposition` values | ||
// | ||
// `reposition: 'mean'` | ||
// specify nodes that should be ignored in the mean calculation | ||
// - a function that returns true for nodes to be ignored | ||
// - a selector that matches the nodes to be ignored | ||
// - a collection of nodes to be ignored (very good for performance) | ||
meanIgnores: function( node ){ return false; }, | ||
// specify whether moving a particular `nodesMatching` node causes repositioning | ||
// - true : the mid node can't be independently moved/dragged | ||
// - false : the mid node can be independently moved/dragged (useful if you want the mid node to use `reposition: 'drag' in another rule with its neighbourhood`) | ||
meanOnSelfPosition: function( node ){ return true; }, | ||
// `reposition: 'drag'` | ||
// specify nodes that when dragged cause the matched nodes to move along (i.e. the master nodes) | ||
// - a function that returns true for nodes to be listened to for drag events | ||
// - a selector that matches the nodes to be listened to for drag events | ||
// - a collection of nodes to be listened to for drag events (very good for performance) | ||
dragWith: function( node ){ return false; } | ||
}; | ||
@@ -52,3 +67,3 @@ | ||
var isFunction = function( x ){ return typeof x === typeofFn; }; | ||
var isCollection = function( x ){ return isObject( x ) && isFunction( x.collection ) }; | ||
var isCollection = function( x ){ return isObject( x ) && isFunction( x.collection ); }; | ||
@@ -117,11 +132,2 @@ // Object.assign() polyfill | ||
var unbindAll = function( cy ){ | ||
var sameCy = function( b ){ return cy === b.cy; }; | ||
var unbind = function( b ){ b.cy.off( b.events, b.selector, b.fn ); }; | ||
bindings.filter( sameCy ).forEach( unbind ); | ||
bindings = []; | ||
}; | ||
var unbindAllOnRule = function( rule ){ | ||
@@ -160,3 +166,3 @@ var unbind = function( b ){ b.cy.off( b.events, b.selector, b.fn ); }; | ||
y: pos.y + delta.y | ||
} | ||
}; | ||
} | ||
@@ -237,3 +243,6 @@ }; | ||
if( movedNode.closedNeighborhood().some( matches ) ){ | ||
if( | ||
movedNode.neighborhood().some( matches ) || | ||
( rule.meanOnSelfPosition( movedNode ) && matches( movedNode ) ) | ||
){ | ||
update( cy, [ rule ] ); | ||
@@ -338,3 +347,3 @@ } | ||
rule.matches = function( ele ){ return eleExists( ele ) && matches( ele ) }; | ||
rule.matches = function( ele ){ return eleExists( ele ) && matches( ele ); }; | ||
} | ||
@@ -491,5 +500,5 @@ | ||
if( typeof cytoscape !== 'undefined' ){ // expose to global cytoscape (i.e. window.cytoscape) | ||
register( cytoscape ); | ||
register( cytoscape ); // eslint-disable-line | ||
} | ||
})(); |
@@ -20,3 +20,3 @@ var gulp = require('gulp'); | ||
gulp.task('publish', [], function( next ){ | ||
runSequence('confver', 'lint', 'pkgver', 'push', 'tag', 'npm', next); | ||
runSequence('confver', 'pkgver', 'push', 'tag', 'npm', next); | ||
}); | ||
@@ -77,22 +77,1 @@ | ||
])); | ||
// http://www.jshint.com/docs/options/ | ||
gulp.task('lint', function(){ | ||
return gulp.src( 'cytoscape-*.js' ) | ||
.pipe( jshint({ | ||
funcscope: true, | ||
laxbreak: true, | ||
loopfunc: true, | ||
strict: true, | ||
unused: 'vars', | ||
eqnull: true, | ||
sub: true, | ||
shadow: true, | ||
laxcomma: true | ||
}) ) | ||
.pipe( jshint.reporter(jshStylish) ) | ||
//.pipe( jshint.reporter('fail') ) | ||
; | ||
}); |
{ | ||
"name": "cytoscape-automove", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "An extension for Cytoscape.js that automatically updates node positions based on specified rules", | ||
"main": "cytoscape-automove.js", | ||
"spm": { | ||
"main": "cytoscape-automove.js" | ||
}, | ||
"scripts": { | ||
"publish": "gulp publish", | ||
"lint": "eslint cytoscape-automove.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -26,2 +25,6 @@ }, | ||
"devDependencies": { | ||
"eslint": "^3.19.0", | ||
"eslint-config-standard": "^10.2.1", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"gulp": "^3.8.8", | ||
@@ -28,0 +31,0 @@ "gulp-jshint": "^1.8.5", |
@@ -69,14 +69,2 @@ cytoscape-automove | ||
// for `reposition: 'mean'`, specify nodes that should be ignored in the mean calculation | ||
// - a function that returns true for nodes to be ignored | ||
// - a selector that matches the nodes to be ignored | ||
// - a collection of nodes to be ignored (very good for performance) | ||
meanIgnores: function( node ){ return false; }, | ||
// for `reposition: 'drag'`, specify nodes that when dragged cause the matched nodes to move along (i.e. the master nodes) | ||
// - a function that returns true for nodes to be listened to for drag events | ||
// - a selector that matches the nodes to be listened to for drag events | ||
// - a collection of nodes to be listened to for drag events (very good for performance) | ||
dragWith: function( node ){ return false; }, | ||
// specify when the repositioning should occur by specifying a function that | ||
@@ -92,3 +80,30 @@ // calls update() when reposition updates should occur | ||
// - default/undefined => on a position event for any node (not as efficient...) | ||
when: undefined | ||
when: undefined, | ||
// | ||
// customisation options for non-function `reposition` values | ||
// | ||
// `reposition: 'mean'` | ||
// specify nodes that should be ignored in the mean calculation | ||
// - a function that returns true for nodes to be ignored | ||
// - a selector that matches the nodes to be ignored | ||
// - a collection of nodes to be ignored (very good for performance) | ||
meanIgnores: function( node ){ return false; }, | ||
// specify whether moving a particular `nodesMatching` node causes repositioning | ||
// - true : the mid node can't be independently moved/dragged | ||
// - false : the mid node can be independently moved/dragged (useful if you want the mid node to use `reposition: 'drag' in another rule with its neighbourhood`) | ||
meanOnSelfPosition: function( node ){ return true; }, | ||
// `reposition: 'drag'` | ||
// specify nodes that when dragged cause the matched nodes to move along (i.e. the master nodes) | ||
// - a function that returns true for nodes to be listened to for drag events | ||
// - a selector that matches the nodes to be listened to for drag events | ||
// - a collection of nodes to be listened to for drag events (very good for performance) | ||
dragWith: function( node ){ return false; } | ||
}; | ||
@@ -95,0 +110,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26784
9
148
11