Revision: 2796 http://vexi.svn.sourceforge.net/vexi/?rev=2796&view=rev Author: clrg Date: 2008-02-24 20:12:13 -0800 (Sun, 24 Feb 2008)
Log Message: ----------- Improve splitpane behaviour - fix 'over-sizing' bug by respecting content/max sizes for master - fix initialization with 'vshrink="true"' Modified Paths: -------------- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/splitpane.t Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/splitpane.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/splitpane.t 2008-02-25 00:02:52 UTC (rev 2795) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/splitpane.t 2008-02-25 04:12:13 UTC (rev 2796) @@ -16,13 +16,17 @@ thisbox.th_holding = null; // where children are actually contained thisbox.th_marker = null; // marker used when liveresize is false - var cur_d; - var cur_a; - var cur_b; - var dim_a; - var dim_b; - var tmp_a; - var tmp_b; + // horizontal splitpane: + // .-------. .-------. + // | a |d| b | + // '-------' '-------' + var cur_d; // current divder + var cur_a; // current child a + var cur_b; // current child b + var dim_a; // current width or height of a + var dim_b; // current width or height of b + var tmp_a; // temporary variable for a values + var tmp_b; // temporary variable for b values var max = function(a, b) { return a>b ? a : b; } var min = function(a, b) { return b>a ? a : b; } @@ -30,15 +34,19 @@ /** integration with draggable */ var dragUpdate = function(d) { var shift = d[pos]; - if (cur_a!=master) shift = + // constrain the shift to respect content and max sizes + // of non-master children and the size of the splitpane + /*if (cur_a!=master)*/ shift = max(cur_a[0][contentdim] - dim_a, min(cur_a[0][maxdim] - dim_a, shift)); - if (cur_b!=master) shift = + /*if (cur_b!=master)*/ shift = min(dim_b - cur_d[dim] - cur_b[0][contentdim], max(dim_b - cur_d[dim] - cur_b[0][maxdim], shift)); + // resize non-master children if (liveresize) { if (cur_a!=master) cur_a[dim] = dim_a + shift; if (cur_b!=master) cur_b[dim] = dim_b - shift; + // store sizes for later application } else { tmp_a = dim_a + shift; tmp_b = dim_b - shift; @@ -104,10 +112,15 @@ orient ++= function(v) { cascade = v; th_holding.orient = v; - for (var i=0; th_holding.numchildren > i; i++) { + var fls = flip(shr); + for (var i=0; th_holding.numchildren>i; i++) { if (i%2) { th_holding[i][shr] = true; - th_holding[i][flip(shr)] = false; + th_holding[i][fls] = false; + } else { + var shell = th_holding[i]; + if (shell[fls]) { shell[fls] = false; shell[0][fls] = true; } + if (shell[0][shr]) { shell[shr] = true; shell[0][shr] = false; } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn