cytoscape
Advanced tools
Comparing version 2.7.4 to 2.7.5
{ | ||
"name": "cytoscape", | ||
"version": "2.7.4", | ||
"version": "2.7.5", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Graph theory (a.k.a. network) library for analysis and visualisation", |
@@ -69,3 +69,3 @@ 'use strict'; | ||
return cy.elements().not( this ); | ||
return cy.mutableElements().not( this ); | ||
}, | ||
@@ -179,3 +179,3 @@ | ||
var selector = toAdd; | ||
toAdd = cy.elements( selector ); | ||
toAdd = cy.mutableElements().filter( selector ); | ||
} | ||
@@ -211,3 +211,3 @@ | ||
var selector = toAdd; | ||
toAdd = cy.elements( selector ); | ||
toAdd = cy.mutableElements().filter( selector ); | ||
} | ||
@@ -278,3 +278,3 @@ | ||
var selector = toRemove; | ||
toRemove = cy.elements( selector ); | ||
toRemove = cy.mutableElements().filter( selector ); | ||
} | ||
@@ -281,0 +281,0 @@ |
@@ -89,3 +89,3 @@ 'use strict'; | ||
// remove old elements | ||
var oldEles = cy.elements(); | ||
var oldEles = cy.mutableElements(); | ||
if( oldEles.length > 0 ){ | ||
@@ -107,3 +107,3 @@ oldEles.remove(); | ||
type: 'load', | ||
eles: cy.elements() | ||
eles: cy.mutableElements() | ||
} ); | ||
@@ -119,3 +119,3 @@ | ||
var layoutOpts = util.extend( {}, cy._private.options.layout ); | ||
layoutOpts.eles = cy.$(); | ||
layoutOpts.eles = cy.elements(); | ||
@@ -122,0 +122,0 @@ cy.layout( layoutOpts ); |
@@ -260,2 +260,3 @@ 'use strict'; | ||
var _p = cy._private; | ||
var eles = cy.mutableElements(); | ||
@@ -305,3 +306,3 @@ if( is.plainObject( obj ) ){ // set | ||
// elements not specified in json should be removed | ||
cy.elements().stdFilter( function( ele ){ | ||
eles.stdFilter( function( ele ){ | ||
return !idInJson[ ele.id() ]; | ||
@@ -347,3 +348,3 @@ } ).remove(); | ||
json.elements = {}; | ||
cy.elements().each( function( i, ele ){ | ||
eles.forEach( function( ele ){ | ||
var group = ele.group(); | ||
@@ -350,0 +351,0 @@ |
@@ -60,2 +60,6 @@ 'use strict'; | ||
} | ||
}, | ||
mutableElements: function(){ | ||
return this._private.elements; | ||
} | ||
@@ -62,0 +66,0 @@ |
@@ -247,3 +247,3 @@ 'use strict'; | ||
} else if( !is.elementOrCollection( elements ) ){ | ||
elements = this.elements(); | ||
elements = this.mutableElements(); | ||
} | ||
@@ -449,5 +449,5 @@ | ||
var selector = elements; | ||
elements = this.elements( selector ); | ||
elements = this.mutableElements().filter( selector ); | ||
} else if( !is.elementOrCollection( elements ) ){ | ||
elements = this.elements(); | ||
elements = this.mutableElements(); | ||
} | ||
@@ -454,0 +454,0 @@ |
@@ -20,7 +20,19 @@ 'use strict'; | ||
var overrideErr = function( field ){ | ||
util.error( 'Can not register `' + name + '` for `' + type + '` since `' + field + '` already exists in the prototype and can not be overridden' ); | ||
}; | ||
if( type === 'core' ){ | ||
Core.prototype[ name ] = registrant; | ||
if( Core.prototype[ name ] ){ | ||
return overrideErr( name ); | ||
} else { | ||
Core.prototype[ name ] = registrant; | ||
} | ||
} else if( type === 'collection' ){ | ||
Collection.prototype[ name ] = registrant; | ||
if( Collection.prototype[ name ] ){ | ||
return overrideErr( name ); | ||
} else { | ||
Collection.prototype[ name ] = registrant; | ||
} | ||
@@ -114,4 +126,3 @@ } else if( type === 'layout' ){ | ||
if( existsInR ){ | ||
util.error( 'Can not register renderer `' + name + '` since it overrides `' + pName + '` in its prototype' ); | ||
return; | ||
return overrideErr( pName ); | ||
} | ||
@@ -118,0 +129,0 @@ |
@@ -609,8 +609,6 @@ 'use strict'; | ||
BRp.getCachedZSortedEles = function( forceRecalc ){ | ||
var cyEles = this.cy.elements(); | ||
var eles = []; | ||
if( forceRecalc || !this.cachedZSortedEles ){ | ||
//console.time('cachezorder') | ||
var cyEles = this.cy.mutableElements(); | ||
var eles = []; | ||
@@ -617,0 +615,0 @@ |
@@ -355,3 +355,3 @@ 'use strict'; | ||
bb = r.textureCache.bb = cy.elements().boundingBox(); | ||
bb = r.textureCache.bb = cy.mutableElements().boundingBox(); | ||
@@ -358,0 +358,0 @@ r.textureCache.texture = r.data.bufferCanvases[ r.TEXTURE_BUFFER ]; |
@@ -17,3 +17,3 @@ 'use strict'; | ||
var cy = this.cy; | ||
var eles = cy.elements(); | ||
var eles = cy.mutableElements(); | ||
var bb = eles.boundingBox(); | ||
@@ -87,3 +87,3 @@ var width = options.full ? Math.ceil( bb.w ) : this.container.clientWidth; | ||
var pan = cy.pan(); | ||
var translation = { | ||
@@ -90,0 +90,0 @@ x: pan.x * scale, |
@@ -16,5 +16,7 @@ 'use strict'; | ||
if( self._private.newStyle ){ // clear style caches | ||
if( _p.newStyle ){ // clear style caches | ||
_p.contextStyles = {}; | ||
_p.propDiffs = {}; | ||
self.cleanElements( eles, true ); | ||
} | ||
@@ -25,6 +27,2 @@ | ||
if( self._private.newStyle ){ // clear style from old sheets | ||
ele._private.style = {}; | ||
} | ||
var cxtMeta = self.getContextMeta( ele ); | ||
@@ -505,6 +503,34 @@ var cxtStyle = self.getContextStyle( cxtMeta ); | ||
styfn.cleanElements = function( eles, keepBypasses ){ | ||
var self = this; | ||
var props = self.properties; | ||
for( var i = 0; i < eles.length; i++ ){ | ||
var ele = eles[i]; | ||
if( !keepBypasses ){ | ||
ele._private.style = {}; | ||
} else { | ||
var style = ele._private.style; | ||
for( var j = 0; j < props.length; j++ ){ | ||
var prop = props[j]; | ||
var eleProp = style[ prop.name ]; | ||
if( eleProp ){ | ||
if( eleProp.bypass ){ | ||
eleProp.bypassed = null; | ||
} else { | ||
style[ prop.name ] = null; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
// updates the visual style for all elements (useful for manual style modification after init) | ||
styfn.update = function(){ | ||
var cy = this._private.cy; | ||
var eles = cy.elements(); | ||
var eles = cy.mutableElements(); | ||
@@ -511,0 +537,0 @@ eles.updateStyle(); |
@@ -20,4 +20,3 @@ 'use strict'; | ||
cy: cy, | ||
coreStyle: {}, | ||
newStyle: true | ||
coreStyle: {} | ||
}; | ||
@@ -27,3 +26,3 @@ | ||
this.addDefaultStylesheet(); | ||
this.resetToDefault(); | ||
}; | ||
@@ -43,4 +42,7 @@ | ||
this.length = 0; | ||
this._private.newStyle = true; | ||
var _p = this._private; | ||
_p.newStyle = true; | ||
return this; // chaining | ||
@@ -47,0 +49,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
"2.7.4" | ||
"2.7.5" |
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
723242
20988