cytoscape
Advanced tools
Comparing version 3.0.0 to 3.0.1
{ | ||
"name": "cytoscape", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"license": "MIT", | ||
@@ -109,3 +109,3 @@ "description": "Graph theory (a.k.a. network) library for analysis and visualisation", | ||
"js": [ | ||
"http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js", | ||
"https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.3/fetch.min.js", | ||
"/build/cytoscape.js" | ||
@@ -112,0 +112,0 @@ ], |
@@ -5,3 +5,3 @@ # Cytoscape.js | ||
[![npm](https://img.shields.io/npm/v/cytoscape.svg?maxAge=1)](https://www.npmjs.com/package/cytoscape) | ||
[![npm installs](https://img.shields.io/npm/dt/cytoscape.svg?maxAge=1&label=npm%20installs)](https://www.npmjs.com/package/cytoscape) | ||
[![npm installs](https://img.shields.io/npm/dm/cytoscape.svg?maxAge=1&label=npm%20installs)](https://www.npmjs.com/package/cytoscape) | ||
[![master branch tests](https://img.shields.io/travis/cytoscape/cytoscape.js/master.svg?maxAge=1&label=master%20branch)](https://travis-ci.org/cytoscape/cytoscape.js) | ||
@@ -8,0 +8,0 @@ [![unstable branch tests](https://img.shields.io/travis/cytoscape/cytoscape.js/unstable.svg?maxAge=1&label=unstable%20branch)](https://travis-ci.org/cytoscape/cytoscape.js) |
@@ -8,6 +8,2 @@ 'use strict'; | ||
var Animation = function( target, opts, opts2 ){ | ||
if( !(this instanceof Animation) ){ | ||
return new Animation( target, opts, opts2 ); | ||
} | ||
var _p = this._private = util.extend( { | ||
@@ -185,2 +181,4 @@ duration: 1000 | ||
if( _pa == null ){ return; } | ||
_p[ a ] = _p[ b ]; | ||
@@ -195,9 +193,11 @@ _p[ b ] = _pa; | ||
// swap styles | ||
for( var i = 0; i < _p.style.length; i++ ){ | ||
var prop = _p.style[ i ]; | ||
var name = prop.name; | ||
var startStyleProp = _p.startStyle[ name ]; | ||
if( _p.style ){ | ||
for( var i = 0; i < _p.style.length; i++ ){ | ||
var prop = _p.style[ i ]; | ||
var name = prop.name; | ||
var startStyleProp = _p.startStyle[ name ]; | ||
_p.startStyle[ name ] = prop; | ||
_p.style[ i ] = startStyleProp; | ||
_p.startStyle[ name ] = prop; | ||
_p.style[ i ] = startStyleProp; | ||
} | ||
} | ||
@@ -204,0 +204,0 @@ |
@@ -790,3 +790,6 @@ 'use strict'; | ||
case 'label': | ||
ele.recalculateRenderedStyle(); | ||
return _p.rstyle[ opts.labelName ] || 0; | ||
default: | ||
@@ -793,0 +796,0 @@ return d.pfValue; |
@@ -37,2 +37,4 @@ 'use strict'; | ||
var style = cy.style(); | ||
// NB the animation loop will exec in headless environments if style enabled | ||
@@ -183,3 +185,2 @@ // and explicit cy.destroy() is necessary to stop the loop | ||
var ele = self; | ||
var style = cy._private.style; | ||
var ani_p = ani._private; | ||
@@ -214,3 +215,2 @@ | ||
function step( self, ani, now, isCore ){ | ||
var style = cy._private.style; | ||
var isEles = !isCore; | ||
@@ -534,3 +534,28 @@ var _p = self._private; | ||
function getEasedValue( type, start, end, percent, easingFn ){ | ||
var val = easingFn( start, end, percent ); | ||
if( type == null ){ | ||
return val; | ||
} | ||
if( type.roundValue || type.color ){ | ||
val = Math.round( val ); | ||
} | ||
if( type.min !== undefined ){ | ||
val = Math.max( val, type.min ); | ||
} | ||
if( type.max !== undefined ){ | ||
val = Math.min( val, type.max ); | ||
} | ||
return val; | ||
} | ||
function ease( startProp, endProp, percent, easingFn ){ | ||
var propSpec = startProp.name != null ? style.properties[ startProp.name ] : null; | ||
var type = propSpec != null ? propSpec.type : null; | ||
if( percent < 0 ){ | ||
@@ -557,3 +582,3 @@ percent = 0; | ||
if( is.number( start ) && is.number( end ) ){ | ||
return easingFn( start, end, percent ); | ||
return getEasedValue( type, start, end, percent, easingFn ); | ||
@@ -568,6 +593,4 @@ } else if( is.array( start ) && is.array( end ) ){ | ||
if( si != null && ei != null ){ | ||
var val = easingFn( si, ei, percent ); | ||
var val = getEasedValue( type, si, ei, percent, easingFn ); | ||
if( startProp.roundValue ){ val = Math.round( val ); } | ||
easedArr.push( val ); | ||
@@ -574,0 +597,0 @@ } else { |
@@ -655,2 +655,8 @@ 'use strict'; | ||
var propertiesEmpty = Object.keys( properties ).length === 0; | ||
if( propertiesEmpty ){ | ||
return new Animation( all[0], properties ); // nothing to animate | ||
} | ||
if( properties.duration === undefined ){ | ||
@@ -669,8 +675,2 @@ properties.duration = 400; | ||
var propertiesEmpty = Object.keys( properties ).length === 0; | ||
if( propertiesEmpty ){ | ||
return new Animation( all[0], properties ); // nothing to animate | ||
} | ||
if( isEles ){ | ||
@@ -677,0 +677,0 @@ properties.style = style.getPropsList( properties.style || properties.css ); |
@@ -601,3 +601,3 @@ 'use strict'; | ||
isOverThresholdDrag = dist2 >= r.desktopTapThreshold2; | ||
r.hoverData.isOverThresholdDrag = isOverThresholdDrag = dist2 >= r.desktopTapThreshold2; | ||
} | ||
@@ -914,2 +914,3 @@ | ||
&& !r.hoverData.selecting // not box selection | ||
&& !r.hoverData.isOverThresholdDrag // didn't move too much | ||
){ | ||
@@ -1010,2 +1011,3 @@ triggerEvents( down, ['click', 'tap', 'vclick'], e, { | ||
r.hoverData.selecting = false; | ||
r.hoverData.isOverThresholdDrag = false; | ||
r.dragData.didDrag = false; | ||
@@ -1012,0 +1014,0 @@ r.hoverData.dragged = false; |
@@ -52,3 +52,3 @@ 'use strict'; | ||
var bgImgCrossOrigin = node.pstyle( 'background-image-crossorigin' ); | ||
var bgImgCrossOrigin = node.pstyle('background-image-crossorigin').value; | ||
@@ -55,0 +55,0 @@ // get image, and if not loaded then ask to redraw when later loaded |
@@ -185,2 +185,6 @@ 'use strict'; | ||
// reset ele area in texture | ||
txr.context.setTransform( 1, 0, 0, 1, 0, 0 ); | ||
txr.context.clearRect( txr.usedWidth, 0, eleScaledW, txrH ); | ||
if( scalableFrom(oneUpCache) ){ | ||
@@ -376,2 +380,3 @@ // then we can relatively cheaply rescale the existing image w/o rerendering | ||
txr.context.setTransform( 1, 0, 0, 1, 0, 0 ); | ||
txr.context.clearRect( 0, 0, txr.width, txr.height ); | ||
@@ -421,3 +426,3 @@ | ||
ETCp.dequeue = function( pxRatio, extent ){ | ||
ETCp.dequeue = function( pxRatio /*, extent*/ ){ | ||
var self = this; | ||
@@ -424,0 +429,0 @@ var q = self.getElementQueue(); |
'use strict'; | ||
var util = require( '../util' ); | ||
var is = require( '../is' ); | ||
var util = require('../util'); | ||
var is = require('../is'); | ||
var Promise = require('../promise'); | ||
@@ -30,3 +31,6 @@ var styfn = {}; | ||
self.updateTransitions( ele, app.diffProps ); | ||
if( !_p.newStyle ){ | ||
self.updateTransitions( ele, app.diffProps ); | ||
} | ||
self.updateStyleHints( ele ); | ||
@@ -530,3 +534,3 @@ | ||
var css = {}; | ||
var style = {}; | ||
@@ -573,3 +577,3 @@ // build up the style to animate towards | ||
if( diff ){ | ||
css[ prop ] = toProp.strValue; // to val | ||
style[ prop ] = toProp.strValue; // to val | ||
this.applyBypass( ele, prop, initVal ); // from val | ||
@@ -586,27 +590,27 @@ anyPrev = true; | ||
ele.stop(); | ||
( new Promise(function( resolve ){ | ||
if( delay > 0 ){ | ||
ele.delayAnimation( delay ).play().promise().then( resolve ); | ||
} else { | ||
resolve(); | ||
} | ||
}) ).then(function(){ | ||
return ele.animation( { | ||
style: style, | ||
duration: duration, | ||
easing: ele.pstyle( 'transition-timing-function' ).value, | ||
queue: false | ||
} ).play().promise(); | ||
}).then(function(){ | ||
// if( !isBypass ){ | ||
self.removeBypasses( ele, props ); | ||
ele.rtrigger('style'); | ||
// } | ||
if( delay > 0 ){ | ||
ele.delay( delay ); | ||
} | ||
_p.transitioning = false; | ||
}); | ||
ele.animate( { | ||
css: css | ||
}, { | ||
duration: duration, | ||
easing: ele.pstyle( 'transition-timing-function' ).value, | ||
queue: false, | ||
complete: function(){ | ||
if( !isBypass ){ | ||
self.removeBypasses( ele, props ); | ||
} | ||
_p.transitioning = false; | ||
} | ||
} ); | ||
} else if( _p.transitioning ){ | ||
ele.stop(); | ||
this.removeBypasses( ele, props ); | ||
ele.rtrigger('style'); | ||
@@ -613,0 +617,0 @@ _p.transitioning = false; |
@@ -101,3 +101,5 @@ 'use strict'; | ||
rstyle.push( styleProp ); | ||
if( styleProp ){ | ||
rstyle.push( styleProp ); | ||
} | ||
} | ||
@@ -104,0 +106,0 @@ } |
@@ -333,4 +333,3 @@ 'use strict'; | ||
strValue: '' + value, | ||
bypass: propIsBypass, | ||
roundValue: true | ||
bypass: propIsBypass | ||
}; | ||
@@ -337,0 +336,0 @@ |
@@ -49,2 +49,6 @@ 'use strict'; | ||
clonePosition: function( pos ){ | ||
return { x: pos.x, y: pos.y }; | ||
}, | ||
uuid: function( | ||
@@ -82,3 +86,3 @@ a,b // placeholders | ||
util.extend = Object.assign != null ? Object.assign : function( tgt ){ | ||
util.extend = Object.assign != null ? Object.assign.bind( Object ) : function( tgt ){ | ||
var args = arguments; | ||
@@ -85,0 +89,0 @@ |
@@ -1,1 +0,1 @@ | ||
module.exports = "3.0.0"; | ||
module.exports = "3.0.1"; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
4345414
52365