cytoscape
Advanced tools
Comparing version 2.7.17 to 2.7.18
/*! | ||
Cytoscape.js 2.7.17 (MIT licensed) | ||
Cytoscape.js 2.7.18 (MIT licensed) | ||
@@ -6,0 +6,0 @@ Copyright (c) The Cytoscape Consortium |
{ | ||
"name": "cytoscape", | ||
"version": "2.7.17", | ||
"version": "2.7.18", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Graph theory (a.k.a. network) library for analysis and visualisation", |
@@ -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 @@ |
@@ -37,2 +37,4 @@ 'use strict'; | ||
var style = cy.style(); | ||
// NB the animation loop will exec in headless environments if style enabled | ||
@@ -187,3 +189,2 @@ // and explicit cy.destroy() is necessary to stop the loop | ||
var ele = self; | ||
var style = cy._private.style; | ||
var ani_p = ani._private; | ||
@@ -218,3 +219,2 @@ | ||
function step( self, ani, now, isCore ){ | ||
var style = cy._private.style; | ||
var isEles = !isCore; | ||
@@ -538,3 +538,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 ){ | ||
@@ -561,3 +586,3 @@ percent = 0; | ||
if( is.number( start ) && is.number( end ) ){ | ||
return easingFn( start, end, percent ); | ||
return getEasedValue( type, start, end, percent, easingFn ); | ||
@@ -572,6 +597,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 ); | ||
@@ -578,0 +601,0 @@ } else { |
@@ -672,2 +672,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 ){ | ||
@@ -686,8 +692,2 @@ properties.duration = 400; | ||
var propertiesEmpty = Object.keys( properties ).length === 0; | ||
if( propertiesEmpty ){ | ||
return new Animation( all[0], properties ); // nothing to animate | ||
} | ||
if( isEles ){ | ||
@@ -694,0 +694,0 @@ properties.style = style.getPropsList( properties.style || properties.css ); |
@@ -595,3 +595,3 @@ 'use strict'; | ||
isOverThresholdDrag = dist2 >= r.desktopTapThreshold2; | ||
r.hoverData.isOverThresholdDrag = isOverThresholdDrag = dist2 >= r.desktopTapThreshold2; | ||
} | ||
@@ -910,2 +910,3 @@ | ||
&& !r.hoverData.selecting // not box selection | ||
&& !r.hoverData.isOverThresholdDrag // didn't move too much | ||
){ | ||
@@ -1006,2 +1007,3 @@ triggerEvents( down, ['click', 'tap', 'vclick'], e, { | ||
r.hoverData.selecting = false; | ||
r.hoverData.isOverThresholdDrag = false; | ||
r.dragData.didDrag = false; | ||
@@ -1008,0 +1010,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 ); | ||
@@ -553,3 +557,3 @@ | ||
var css = {}; | ||
var style = {}; | ||
@@ -596,3 +600,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 | ||
@@ -609,27 +613,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'); | ||
@@ -636,0 +640,0 @@ _p.transitioning = false; |
@@ -101,3 +101,5 @@ 'use strict'; | ||
rstyle.push( styleProp ); | ||
if( styleProp ){ | ||
rstyle.push( styleProp ); | ||
} | ||
} | ||
@@ -104,0 +106,0 @@ } |
@@ -359,4 +359,3 @@ 'use strict'; | ||
strValue: '' + value, | ||
bypass: propIsBypass, | ||
roundValue: true | ||
bypass: propIsBypass | ||
}; | ||
@@ -363,0 +362,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 = "2.7.17"; | ||
module.exports = "2.7.18"; |
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
4328191
43817