cytoscape
Advanced tools
Comparing version 2.7.2 to 2.7.3
{ | ||
"name": "cytoscape", | ||
"version": "2.7.2", | ||
"version": "2.7.3", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Graph theory (a.k.a. network) library for analysis and visualisation", |
@@ -224,2 +224,4 @@ 'use strict'; | ||
function update( parent ){ | ||
if( !parent.isParent() ){ return; } | ||
var _p = parent._private; | ||
@@ -264,3 +266,3 @@ var children = parent.children(); | ||
// go up, level by level | ||
var eles = this.parent(); | ||
var eles = this; | ||
while( eles.nonempty() ){ | ||
@@ -293,2 +295,5 @@ | ||
var updateBounds = function( b, x1, y1, x2, y2 ){ | ||
// don't update with zero area boxes | ||
if( x2 - x1 === 0 || y2 - y1 === 0 ){ return; } | ||
b.x1 = x1 < b.x1 ? x1 : b.x1; | ||
@@ -667,3 +672,5 @@ b.x2 = x2 > b.x2 ? x2 : b.x2; | ||
// expand bounds by 1 because antialiasing can increase the visual/effective size by 1 on all sides | ||
math.expandBoundingBox( bounds, 1 ); | ||
if( bounds.w > 0 && bounds.h > 0 && displayed ){ | ||
math.expandBoundingBox( bounds, 1 ); | ||
} | ||
@@ -670,0 +677,0 @@ return bounds; |
@@ -312,2 +312,5 @@ 'use strict'; | ||
// the traversal cache should start fresh when ele is added | ||
_private.traversalCache = null; | ||
// set id and validate | ||
@@ -568,8 +571,18 @@ if( data.id === undefined ){ | ||
var alteredParents = []; | ||
alteredParents.ids = {}; | ||
function removeChildRef( parent, ele ){ | ||
ele = ele[0]; | ||
parent = parent[0]; | ||
var children = parent._private.children; | ||
var pid = parent.id(); | ||
util.removeFromArray( children, ele ); | ||
if( !alteredParents.ids[ pid ] ){ | ||
alteredParents.ids[ pid ] = true; | ||
alteredParents.push( parent ); | ||
} | ||
} | ||
@@ -632,16 +645,8 @@ | ||
// check for empty remaining parent nodes | ||
var checkedParentId = {}; | ||
for( var i = 0; i < elesToRemove.length; i++ ){ | ||
var ele = elesToRemove[ i ]; | ||
var isNode = ele._private.group === 'nodes'; | ||
var parentId = ele._private.data.parent; | ||
// the parents who were modified by the removal need their style updated | ||
for( var i = 0; i < alteredParents.length; i++ ){ | ||
var ele = alteredParents[ i ]; | ||
if( isNode && parentId !== undefined && !checkedParentId[ parentId ] ){ | ||
checkedParentId[ parentId ] = true; | ||
var parent = cy.getElementById( parentId ); | ||
if( parent && parent.length !== 0 && !parent._private.removed && parent.children().length === 0 ){ | ||
parent.updateStyle(); | ||
} | ||
if( !ele.removed() ){ | ||
ele.updateStyle(); | ||
} | ||
@@ -697,5 +702,5 @@ } | ||
} | ||
return cy.add( jsons ).union( descsEtc.restore() ); | ||
} | ||
return cy.add( jsons ).union( descsEtc.restore() ); | ||
} | ||
@@ -702,0 +707,0 @@ |
@@ -124,4 +124,4 @@ 'use strict'; | ||
// only update if dirty | ||
if( useCache && rstyle.clean ){ continue; } | ||
// only update if dirty and in graph | ||
if( (useCache && rstyle.clean) || ele.removed() ){ continue; } | ||
@@ -128,0 +128,0 @@ if( _p.group === 'nodes' ){ |
@@ -42,13 +42,17 @@ 'use strict'; | ||
BRp.nodeIsDraggable = function( node ){ | ||
if( node && node.isNode() | ||
&& node.pstyle( 'opacity' ).value !== 0 | ||
&& node.pstyle( 'visibility' ).value == 'visible' | ||
&& node.pstyle( 'display' ).value == 'element' | ||
return ( | ||
node | ||
&& node.isNode() | ||
&& !node.locked() | ||
&& node.grabbable() ){ | ||
&& node.grabbable() | ||
); | ||
}; | ||
return true; | ||
} | ||
return false; | ||
BRp.nodeIsGrabbable = function( node ){ | ||
return ( | ||
this.nodeIsDraggable( node ) | ||
&& node.pstyle( 'opacity' ).value !== 0 | ||
&& node.pstyle( 'visibility' ).value === 'visible' | ||
&& node.pstyle( 'display' ).value === 'element' | ||
); | ||
}; | ||
@@ -415,3 +419,3 @@ | ||
if( r.nodeIsDraggable( near ) ){ | ||
if( r.nodeIsGrabbable( near ) ){ | ||
@@ -435,3 +439,3 @@ var grabEvent = new Event( e, { | ||
var selectedNodes = cy.$( function(){ return this.isNode() && this.selected() && r.nodeIsDraggable( this ); } ); | ||
var selectedNodes = cy.$( function(){ return this.isNode() && this.selected() && r.nodeIsGrabbable( this ); } ); | ||
@@ -685,3 +689,3 @@ addNodesToDrag( selectedNodes, { addToList: draggedElements } ); | ||
if( near != last ){ | ||
if( ( !down || !down.grabbed() ) && near != last ){ | ||
@@ -1163,3 +1167,3 @@ if( last ){ | ||
if( r.nodeIsDraggable( near ) ){ | ||
if( r.nodeIsGrabbable( near ) ){ | ||
@@ -1175,3 +1179,3 @@ var draggedEles = r.dragData.touchDragEles = []; | ||
var selectedNodes = cy.$( function(){ | ||
return this.selected() && r.nodeIsDraggable( this ); | ||
return this.selected() && r.nodeIsGrabbable( this ); | ||
} ); | ||
@@ -1475,3 +1479,3 @@ | ||
} else if( capture && e.touches[0] ){ | ||
} else if( e.touches[0] ){ | ||
var start = r.touchData.start; | ||
@@ -1485,3 +1489,3 @@ var last = r.touchData.last; | ||
if( start != null ){ | ||
if( capture && start != null ){ | ||
e.preventDefault(); | ||
@@ -1491,3 +1495,3 @@ } | ||
// dragging nodes | ||
if( start != null && r.nodeIsDraggable( start ) ){ | ||
if( capture && start != null && r.nodeIsDraggable( start ) ){ | ||
@@ -1520,3 +1524,3 @@ if( isOverThresholdDrag ){ // then dragging can happen | ||
if( updatePos && is.number( dragDelta[0] ) && is.number( dragDelta[1] ) ){ | ||
if( updatePos && dragDelta && is.number( dragDelta[0] ) && is.number( dragDelta[1] ) ){ | ||
dPos.x += dragDelta[0]; | ||
@@ -1567,3 +1571,3 @@ dPos.y += dragDelta[1]; | ||
if( near != last ){ | ||
if( ( !start || !start.grabbed() ) && near != last ){ | ||
if( last ){ last.trigger( new Event( e, { type: 'tapdragout', cyPosition: { x: now[0], y: now[1] } } ) ); } | ||
@@ -1577,8 +1581,10 @@ if( near ){ near.trigger( new Event( e, { type: 'tapdragover', cyPosition: { x: now[0], y: now[1] } } ) ); } | ||
// check to cancel taphold | ||
for( var i = 0;i < now.length;i++ ){ | ||
if( now[ i ] | ||
&& r.touchData.startPosition[ i ] | ||
&& isOverThresholdDrag ){ | ||
if( capture ){ | ||
for( var i = 0; i < now.length; i++ ){ | ||
if( now[ i ] | ||
&& r.touchData.startPosition[ i ] | ||
&& isOverThresholdDrag ){ | ||
r.touchData.singleTouchMoved = true; | ||
r.touchData.singleTouchMoved = true; | ||
} | ||
} | ||
@@ -1781,3 +1787,3 @@ } | ||
triggerEvents( start, [ 'touchend', 'tapend', 'vmouseup' ], e, { | ||
triggerEvents( start, [ 'touchend', 'tapend', 'vmouseup', 'tapdragout' ], e, { | ||
cyPosition: { x: now[0], y: now[1] } | ||
@@ -1793,3 +1799,3 @@ } ); | ||
triggerEvents( near, [ 'touchend', 'tapend', 'vmouseup' ], e, { | ||
triggerEvents( near, [ 'touchend', 'tapend', 'vmouseup', 'tapdragout' ], e, { | ||
cyPosition: { x: now[0], y: now[1] } | ||
@@ -1796,0 +1802,0 @@ } ); |
@@ -12,2 +12,8 @@ 'use strict'; | ||
var self = this; | ||
// function values can't be cached in all cases, and there isn't much benefit of caching them anyway | ||
if( is.fn( value ) ){ | ||
return self.parseImpl( name, value, propIsBypass, propIsFlat ); | ||
} | ||
var argHash = [ name, value, propIsBypass, propIsFlat ].join( '$' ); | ||
@@ -14,0 +20,0 @@ var propCache = self.propCache = self.propCache || {}; |
@@ -1,1 +0,1 @@ | ||
"2.7.2" | ||
"2.7.3" |
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
721335
20933