Skip to content

Commit

Permalink
Edge and arrow not correctly rendered after changing width style pro…
Browse files Browse the repository at this point in the history
…perty cytoscape#799
  • Loading branch information
maxkfranz committed Jan 30, 2015
1 parent 3aae4fa commit 7a63386
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
19 changes: 12 additions & 7 deletions debug/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ require(['cytoscape'], function(rjsCy){

$(function(){

var addRandomEles = true;
var addRandomEles = false;
var height, width;

var cliques = 2;
var numNodes = 40;
var numEdges = 120;

var defaultSty = window.defaultSty = cytoscape.stylesheet()
// .selector('node, edge')
Expand Down Expand Up @@ -77,12 +81,12 @@ $(function(){
// 'control-point-distance': 100,
'width': '3',
// 'source-arrow-shape': 'triangle-backcurve',
// 'target-arrow-shape': 'triangle',
'target-arrow-shape': 'triangle',
// 'mid-target-arrow-shape': 'triangle',
// 'mid-source-arrow-shape': 'triangle-backcurve',
// 'target-arrow-fill': 'filled',
// 'source-arrow-shape': 'data(srcShape)',
'curve-style': 'haystack',
// 'curve-style': 'haystack',
'opacity': 0.5
//'content': 'data(weight)'
})
Expand All @@ -100,6 +104,10 @@ $(function(){
'mid-source-arrow-color': '#000',
'mid-target-arrow-color': '#000'
})
.selector('.foo')
.css({
'width': 15
})
// .selector('#ae')
// .css({
// 'curve-style': 'unbundled-bezier',
Expand All @@ -108,6 +116,7 @@ $(function(){
;

window.options = {
boxSelectionEnabled: true,
// hideEdgesOnViewport: true,
// hideLabelsOnViewport: true,
// textureOnViewport: true,
Expand Down Expand Up @@ -154,10 +163,6 @@ $(function(){
}
};

var cliques = 2;
var numNodes = 40;
var numEdges = 120;

function randNodeId( clique ){
var min = numNodes * clique / cliques;
var max = numNodes * (clique + 1) / cliques - (cliques == 1 ? 0 : 1);
Expand Down
5 changes: 5 additions & 0 deletions src/extensions/renderer.canvas.coord-ele-math.js
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,9 @@
var tgtH1 = rs.lastTgtCtlPtH;
var tgtH2 = tgt.outerHeight();

var width1 = rs.lastW;
var width2 = eStyle['control-point-step-size'].pxValue;

if( badBezier ){
rs.badBezier = true;
} else {
Expand All @@ -976,6 +979,7 @@

if( srcX1 === srcX2 && srcY1 === srcY2 && srcW1 === srcW2 && srcH1 === srcH2
&& tgtX1 === tgtX2 && tgtY1 === tgtY2 && tgtW1 === tgtW2 && tgtH1 === tgtH2
&& width1 === width2
&& ((edgeIndex1 === edgeIndex2 && numEdges1 === numEdges2) || edgeIsUnbundled) ){
// console.log('edge ctrl pt cache HIT')
continue; // then the control points haven't changed and we can skip calculating them
Expand All @@ -990,6 +994,7 @@
rs.lastTgtCtlPtH = tgtH2;
rs.lastEdgeIndex = edgeIndex2;
rs.lastNumEdges = numEdges2;
rs.lastWidth = width2;
// console.log('edge ctrl pt cache MISS')
}

Expand Down

0 comments on commit 7a63386

Please sign in to comment.