Skip to content

Commit

Permalink
possible fix for cytoscape#819 w/ dagre and re-used layout
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkfranz committed Feb 12, 2015
1 parent 08d2ad5 commit 6e4647c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
$$.fn.core({

layout: function( params ){
var layout = this._private.prevLayout = ( params == null ? this._private.prevLayout : this.initLayout( params ) );
var layout;

// always use a new layout w/ init opts; slightly different backwards compatibility
// but fixes layout reuse issues like dagre #819
if( params == null ){
params = $$.util.extend({}, this._private.options.layout);
params.eles = this.$();
}

layout = this.initLayout( params );
layout.run();

return this; // chaining
Expand Down

0 comments on commit 6e4647c

Please sign in to comment.