cytoscape
Advanced tools
Comparing version 3.14.2 to 3.15.0
{ | ||
"build/cytoscape.umd.js": { | ||
"bundled": 929677, | ||
"minified": 345303, | ||
"gzipped": 107548 | ||
"bundled": 933539, | ||
"minified": 346722, | ||
"gzipped": 107965 | ||
}, | ||
"build/cytoscape.cjs.js": { | ||
"bundled": 856806, | ||
"minified": 364183, | ||
"gzipped": 109877 | ||
"bundled": 860494, | ||
"minified": 366052, | ||
"gzipped": 110357 | ||
}, | ||
"build/cytoscape.esm.js": { | ||
"bundled": 856633, | ||
"minified": 364040, | ||
"gzipped": 109841, | ||
"bundled": 860321, | ||
"minified": 365909, | ||
"gzipped": 110322, | ||
"treeshaked": { | ||
"rollup": { | ||
"code": 339962, | ||
"code": 341370, | ||
"import_statements": 51 | ||
}, | ||
"webpack": { | ||
"code": 340872 | ||
"code": 342758 | ||
} | ||
@@ -27,12 +27,12 @@ } | ||
"build/cytoscape.esm.min.js": { | ||
"bundled": 344163, | ||
"minified": 344188, | ||
"gzipped": 107087, | ||
"bundled": 346527, | ||
"minified": 346036, | ||
"gzipped": 107770, | ||
"treeshaked": { | ||
"rollup": { | ||
"code": 343646, | ||
"code": 345526, | ||
"import_statements": 0 | ||
}, | ||
"webpack": { | ||
"code": 344433 | ||
"code": 346814 | ||
} | ||
@@ -39,0 +39,0 @@ } |
{ | ||
"name": "cytoscape", | ||
"version": "3.14.2", | ||
"version": "3.15.0", | ||
"license": "MIT", | ||
@@ -112,3 +112,3 @@ "description": "Graph theory (a.k.a. network) library for analysis and visualisation", | ||
"watch": "run-s watch:fast", | ||
"watch:sync": "livereload -w 500 \"build, debug\"", | ||
"watch:sync": "livereload \"build, debug\" -w 500", | ||
"watch:http": "http-server -s -c -1 -o", | ||
@@ -139,6 +139,10 @@ "watch:fast": "run-p watch:sync watch:http watch:build:fast", | ||
"@babel/preset-env": "^7.5.5", | ||
"@rollup/plugin-babel": "^5.0.0", | ||
"@rollup/plugin-commonjs": "^11.1.0", | ||
"@rollup/plugin-node-resolve": "^7.1.3", | ||
"@rollup/plugin-replace": "^2.3.2", | ||
"benchmark": "^2.1.4", | ||
"bluebird": "^3.5.0", | ||
"chai": "^4.1.2", | ||
"cpy-cli": "^3.0.0", | ||
"cpy-cli": "^3.1.1", | ||
"cross-env": "^7.0.0", | ||
@@ -149,19 +153,15 @@ "download-cli": "^1.0.5", | ||
"gh-pages": "^2.1.1", | ||
"handlebars": "^4.5.3", | ||
"highlight.js": "^9.15.6", | ||
"http-server": "^0.12.0", | ||
"handlebars": "^4.7.6", | ||
"highlight.js": "^10.0.0", | ||
"http-server": "^0.12.3", | ||
"jsonlint": "^1.6.2", | ||
"livereload": "^0.9.0", | ||
"marked": "^0.8.0", | ||
"mocha": "^7.0.1", | ||
"livereload": "^0.9.1", | ||
"marked": "^1.0.0", | ||
"mocha": "^7.1.2", | ||
"npm-run-all": "^4.1.5", | ||
"rimraf": "^3.0.0", | ||
"rollup": "^1.27.8", | ||
"rollup-plugin-babel": "^4.3.0", | ||
"rollup-plugin-commonjs": "^10.0.0", | ||
"rollup-plugin-license": "^0.13.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-replace": "^2.0.0", | ||
"rollup": "^2.8.2", | ||
"rollup-plugin-license": "^2.0.0", | ||
"rollup-plugin-size-snapshot": "^0.11.0", | ||
"rollup-plugin-terser": "^5.1.3" | ||
"rollup-plugin-terser": "^5.3.0" | ||
}, | ||
@@ -168,0 +168,0 @@ "dependencies": { |
@@ -1,5 +0,5 @@ | ||
import nodeResolve from 'rollup-plugin-node-resolve'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import babel from 'rollup-plugin-babel'; | ||
import replace from 'rollup-plugin-replace'; | ||
import nodeResolve from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import babel from '@rollup/plugin-babel'; | ||
import replace from '@rollup/plugin-replace'; | ||
import { terser } from "rollup-plugin-terser"; | ||
@@ -27,4 +27,3 @@ import { sizeSnapshot } from 'rollup-plugin-size-snapshot'; | ||
const getBabelOptions = () => ({ | ||
exclude: '**/node_modules/**', | ||
externalHelpers: true | ||
exclude: '**/node_modules/**' | ||
}); | ||
@@ -31,0 +30,0 @@ |
@@ -161,3 +161,2 @@ import * as math from '../../../math'; | ||
defineArrowShape( 'triangle-tee', { | ||
@@ -195,2 +194,20 @@ points: [ | ||
defineArrowShape( 'circle-triangle', { | ||
radius: 0.15, | ||
pointsTr: [0, -0.15, 0.15, -0.45, -0.15, -0.45, 0, -0.15], | ||
collide: function collide(x, y, size, angle, translation, edgeWidth, padding) { | ||
var t = translation; | ||
var circleInside = Math.pow(t.x - x, 2) + Math.pow(t.y - y, 2) <= Math.pow((size + 2 * padding) * this.radius, 2); | ||
var triPts = pointsToArr(transformPoints(this.points, size + 2 * padding, angle, translation)); | ||
return math.pointInsidePolygonPoints(x, y, triPts) || circleInside; | ||
}, | ||
draw: function draw(context, size, angle, translation, edgeWidth) { | ||
var triPts = transformPoints(this.pointsTr, size, angle, translation); | ||
renderer.arrowShapeImpl(this.name)(context, triPts, translation.x, translation.y, this.radius * size); | ||
}, | ||
spacing: function spacing(edge) { | ||
return renderer.getArrowWidth(edge.pstyle('width').pfValue, edge.pstyle('arrow-scale').value) * this.radius; | ||
} | ||
} ); | ||
defineArrowShape( 'triangle-cross', { | ||
@@ -329,2 +346,2 @@ points: [ | ||
export default BRp; | ||
export default BRp; |
@@ -1040,5 +1040,7 @@ import * as is from '../../../is'; | ||
var cy = r.cy; | ||
var zoom = cy.zoom(); | ||
var pan = cy.pan(); | ||
var pos = r.projectIntoViewport( e.clientX, e.clientY ); | ||
var rpos = [ pos[0] * cy.zoom() + cy.pan().x, | ||
pos[1] * cy.zoom() + cy.pan().y ]; | ||
var rpos = [ pos[0] * zoom + pan.x, | ||
pos[1] * zoom + pan.y ]; | ||
@@ -1079,4 +1081,10 @@ if( r.hoverData.draggingEles || r.hoverData.dragging || r.hoverData.cxtStarted || inBoxSelection() ){ // if pan dragging or cxt dragging, wheel movements make no zoom | ||
var newZoom = cy.zoom() * Math.pow( 10, diff ); | ||
if( e.type === 'gesturechange' ){ | ||
newZoom = r.gestureStartZoom * e.scale; | ||
} | ||
cy.zoom( { | ||
level: cy.zoom() * Math.pow( 10, diff ), | ||
level: newZoom, | ||
renderedPosition: { x: rpos[0], y: rpos[1] } | ||
@@ -1106,2 +1114,17 @@ } ); | ||
// desktop safari pinch to zoom start | ||
r.registerBinding( r.container, 'gesturestart', function gestureStartHandler(e){ | ||
r.gestureStartZoom = r.cy.zoom(); | ||
if( !r.hasTouchStarted ){ // don't affect touch devices like iphone | ||
e.preventDefault(); | ||
} | ||
}, true ); | ||
r.registerBinding( r.container, 'gesturechange', function(e){ | ||
if( !r.hasTouchStarted ){ // don't affect touch devices like iphone | ||
wheelHandler(e); | ||
} | ||
}, true ); | ||
// Functions to help with handling mouseout/mouseover on the Cytoscape container | ||
@@ -1146,2 +1169,4 @@ // Handle mouseout on Cytoscape container | ||
r.registerBinding( r.container, 'touchstart', touchstartHandler = function( e ){ | ||
r.hasTouchStarted = true; | ||
if( !eventInContainer(e) ){ return; } | ||
@@ -1148,0 +1173,0 @@ |
@@ -52,2 +52,17 @@ var CRp = {}; | ||
function circleTriangle(context, trianglePoints, rx, ry, r) { | ||
if (context.beginPath) { context.beginPath(); } | ||
context.arc(rx, ry, r, 0, Math.PI * 2, false); | ||
var triPts = trianglePoints; | ||
var firstTrPt = triPts[0]; | ||
context.moveTo(firstTrPt.x, firstTrPt.y); | ||
for (var i = 0; i < triPts.length; i++) { | ||
var pt = triPts[i]; | ||
context.lineTo(pt.x, pt.y); | ||
} | ||
if (context.closePath) { | ||
context.closePath(); | ||
} | ||
} | ||
function circle( context, rx, ry, r ){ | ||
@@ -65,2 +80,4 @@ context.arc( rx, ry, r, 0, Math.PI * 2, false ); | ||
'circle-triangle' : circleTriangle, | ||
'triangle-cross': triangleTee, | ||
@@ -72,2 +89,2 @@ | ||
export default CRp; | ||
export default CRp; |
@@ -264,10 +264,19 @@ import * as util from '../util'; | ||
_p.styleKeys[ grKey ] = 0; | ||
_p.styleKeys[ grKey ] = [ util.DEFAULT_HASH_SEED, util.DEFAULT_HASH_SEED_ALT ]; | ||
} | ||
let updateGrKey = (val, grKey) => _p.styleKeys[ grKey ] = util.hashInt( val, _p.styleKeys[ grKey ] ); | ||
let updateGrKey1 = (val, grKey) => _p.styleKeys[ grKey ][0] = util.hashInt( val, _p.styleKeys[ grKey ][0] ); | ||
let updateGrKey2 = (val, grKey) => _p.styleKeys[ grKey ][1] = util.hashIntAlt( val, _p.styleKeys[ grKey ][1] ); | ||
let updateGrKey = (val, grKey) => { | ||
updateGrKey1(val, grKey); | ||
updateGrKey2(val, grKey); | ||
}; | ||
let updateGrKeyWStr = (strVal, grKey) => { | ||
for( let j = 0; j < strVal.length; j++ ){ | ||
updateGrKey(strVal.charCodeAt(j), grKey); | ||
let ch = strVal.charCodeAt(j); | ||
updateGrKey1(ch, grKey); | ||
updateGrKey2(ch, grKey); | ||
} | ||
@@ -332,3 +341,3 @@ }; | ||
let hash = 0; | ||
let hash = [ util.DEFAULT_HASH_SEED, util.DEFAULT_HASH_SEED_ALT ]; | ||
@@ -339,6 +348,7 @@ for( let i = 0; i < propGrKeys.length; i++ ){ | ||
hash = util.hashInt( grHash, hash ); | ||
hash[0] = util.hashInt( grHash[0], hash[0] ); | ||
hash[1] = util.hashIntAlt( grHash[1], hash[1] ); | ||
} | ||
_p.styleKey = hash; | ||
_p.styleKey = util.combineHashes(hash[0], hash[1]); | ||
@@ -348,13 +358,19 @@ // label dims | ||
let labelDimsKey = _p.labelDimsKey = _p.styleKeys.labelDimensions; | ||
let sk = _p.styleKeys; | ||
_p.labelDimsKey = util.combineHashesArray(sk.labelDimensions); | ||
_p.labelKey = propHash( ele, ['label'], labelDimsKey ); | ||
_p.labelStyleKey = util.hashInt( _p.styleKeys.commonLabel, _p.labelKey ); | ||
let labelKeys = propHash( ele, ['label'], sk.labelDimensions ); | ||
_p.labelKey = util.combineHashesArray(labelKeys); | ||
_p.labelStyleKey = util.combineHashesArray(util.hashArrays(sk.commonLabel, labelKeys)); | ||
if( !isNode ){ | ||
_p.sourceLabelKey = propHash( ele, ['source-label'], labelDimsKey ); | ||
_p.sourceLabelStyleKey = util.hashInt( _p.styleKeys.commonLabel, _p.sourceLabelKey ); | ||
let sourceLabelKeys = propHash( ele, ['source-label'], sk.labelDimensions ); | ||
_p.sourceLabelKey = util.combineHashesArray(sourceLabelKeys); | ||
_p.sourceLabelStyleKey = util.combineHashesArray(util.hashArrays(sk.commonLabel, sourceLabelKeys)); | ||
_p.targetLabelKey = propHash( ele, ['target-label'], labelDimsKey ); | ||
_p.targetLabelStyleKey = util.hashInt( _p.styleKeys.commonLabel, _p.targetLabelKey ); | ||
let targetLabelKeys = propHash( ele, ['target-label'], sk.labelDimensions ); | ||
_p.targetLabelKey = util.combineHashesArray(targetLabelKeys); | ||
_p.targetLabelStyleKey = util.combineHashesArray(util.hashArrays(sk.commonLabel, targetLabelKeys)); | ||
} | ||
@@ -368,4 +384,6 @@ | ||
_p.nodeKey = util.hashIntsArray([ nodeBorder, backgroundImage, compound, pie ], nodeBody); | ||
_p.hasPie = pie != 0; | ||
let nodeKeys = [nodeBorder, backgroundImage, compound, pie ].reduce(util.hashArrays, nodeBody); | ||
_p.nodeKey = util.combineHashesArray(nodeKeys); | ||
_p.hasPie = pie[0] !== util.DEFAULT_HASH_SEED && pie[1] !== util.DEFAULT_HASH_SEED_ALT; | ||
} | ||
@@ -372,0 +390,0 @@ |
@@ -140,3 +140,3 @@ import * as util from '../util'; | ||
styfn.getNonDefaultPropertiesHash = function( ele, propNames, seed ){ | ||
let hash = seed; | ||
let hash = seed.slice(); | ||
let name, val, strVal, chVal; | ||
@@ -152,3 +152,4 @@ let i, j; | ||
} else if( val.pfValue != null ){ | ||
hash = util.hashInt( chVal, hash ); | ||
hash[0] = util.hashInt( chVal, hash[0] ); | ||
hash[1] = util.hashIntAlt( chVal, hash[1] ); | ||
} else { | ||
@@ -159,3 +160,4 @@ strVal = val.strValue; | ||
chVal = strVal.charCodeAt(j); | ||
hash = util.hashInt( chVal, hash ); | ||
hash[0] = util.hashInt( chVal, hash[0] ); | ||
hash[1] = util.hashIntAlt( chVal, hash[1] ); | ||
} | ||
@@ -162,0 +164,0 @@ } |
@@ -73,3 +73,3 @@ import * as util from '../util'; | ||
compoundIncludeLabels: { enums: [ 'include', 'exclude' ] }, | ||
arrowShape: { enums: [ 'tee', 'triangle', 'triangle-tee', 'triangle-cross', 'triangle-backcurve', 'vee', 'square', 'circle', 'diamond', 'chevron', 'none' ] }, | ||
arrowShape: { enums: [ 'tee', 'triangle', 'triangle-tee', 'circle-triangle', 'triangle-cross', 'triangle-backcurve', 'vee', 'square', 'circle', 'diamond', 'chevron', 'none' ] }, | ||
arrowFill: { enums: [ 'filled', 'hollow' ] }, | ||
@@ -751,2 +751,2 @@ display: { enums: [ 'element', 'none' ] }, | ||
export default styfn; | ||
export default styfn; |
@@ -1,4 +0,6 @@ | ||
const DEFAULT_SEED = 5381; | ||
export const DEFAULT_HASH_SEED = 9261; | ||
const K = 65599; // 37 also works pretty well | ||
export const DEFAULT_HASH_SEED_ALT = 5381; | ||
export const hashIterableInts = function( iterator, seed = DEFAULT_SEED ){ // djb2/string-hash | ||
export const hashIterableInts = function( iterator, seed = DEFAULT_HASH_SEED ){ // sdbm/string-hash | ||
let hash = seed; | ||
@@ -12,3 +14,3 @@ let entry; | ||
hash = ((hash << 5) + hash + entry.value) | 0; | ||
hash = ((hash * K) + entry.value) | 0; | ||
} | ||
@@ -19,6 +21,25 @@ | ||
export const hashInt = function( num, seed = DEFAULT_SEED ){ // djb2/string-hash | ||
export const hashInt = function( num, seed = DEFAULT_HASH_SEED ){ // sdbm/string-hash | ||
return ((seed * K) + num) | 0; | ||
}; | ||
export const hashIntAlt = function( num, seed = DEFAULT_HASH_SEED_ALT ){ // djb2/string-hash | ||
return ((seed << 5) + seed + num) | 0; | ||
}; | ||
export const combineHashes = function(hash1, hash2){ | ||
return hash1 * 0x200000 + hash2; | ||
}; | ||
export const combineHashesArray = function(hashes){ | ||
return hashes[0] * 0x200000 + hashes[1]; | ||
}; | ||
export const hashArrays = function(hashes1, hashes2){ | ||
return [ | ||
hashInt(hashes1[0], hashes2[0]), | ||
hashIntAlt(hashes1[1], hashes2[1]) | ||
]; | ||
}; | ||
export const hashIntsArray = function( ints, seed ){ | ||
@@ -25,0 +46,0 @@ let entry = { value: 0, done: false }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
4240984
171
107030