From 6e4647c51468aa0358a0bed529998f957bec2bab Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 12 Feb 2015 15:04:47 -0500 Subject: [PATCH] possible fix for #819 w/ dagre and re-used layout --- src/core-layout.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core-layout.js b/src/core-layout.js index a13b7d1389..bbd8aa291b 100644 --- a/src/core-layout.js +++ b/src/core-layout.js @@ -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