|
|
|
[
Permlink
| « Hide
]
Max Carlson - 23/May/07 01:32 PM
Compare with trunk, pleeze...
Can you provide an example? The following works as expected (three views, the middle one turns invisible, but after it does, the layout shifts to account for that):
<canvas height="100" debug="true"> <view id="parentview" width="200" bgcolor="silver"> <wrappinglayout axis="x" spacing="10"/> <view bgcolor="blue" height="30" width="50"/> <view bgcolor="blue" height="30" width="50" onclick="this.setAttribute('visible', false), changeme.setAttribute('bgcolor', red)"/> <view id="changeme" bgcolor="blue" height="30" width="50"/> </view> </canvas> The problem is seen with the following example: the second view's width is taken into account for the line feed, even when not visible. When the second view is hidden, the first and third views should be on the same line.
<canvas height="100" debug="true"> <view id="parentview" width="110" bgcolor="silver"> <wrappinglayout axis="x" spacing="10"/> <view bgcolor="blue" height="30" width="40"/> <view bgcolor="blue" height="30" width="90" onclick="this.setAttribute('visible', false), changeme.setAttribute('bgcolor', red)"/> <view id="changeme" bgcolor="blue" height="30" width="40"/> </view> </canvas> I compiled your script, and I still think it's working as expected/desired. I attached two screenshots: beforeclick, and afterclick -- are these not what you're getting/expecting?
You should try with parentview's width set to 110 pixels. With this size, and when the second view is hidden, the first and third views should be aligned (40px + 40px + 10px spacing < 110px) while they are not (because wrappinglayout uses the 90px of the second view to calculate the line feed: 40px + 90px + 10px > 110px, goes to the next line, then ignore the 90px and prints the third view).
I attach a screenshot to better describe what I get. The 'expected' part is the result after applying the patch I proposed.
Author: max
Date: 2007-06-07 08:42:47 -0700 (Thu, 07 Jun 2007) New Revision: 5348 Modified: openlaszlo/branches/legals/lps/components/utils/layouts/wrappinglayout.lzx Log: Change 20070606-maxcarlson-1 by maxcarlson@plastik on 2007-06-06 22:15:43 PDT in /Users/maxcarlson/openlaszlo/legals-clean for http://svn.openlaszlo.org/openlaszlo/branches/legals Summary: Fix wrappinglayout New Features: Bugs Fixed: Technical Reviewer: promanik QA Reviewer: jcrowley Doc Reviewer: (pending) Documentation: Release Notes: Details: wrappinglayout.lzx skips invisible views when evaluating offset Tests: see Modified: openlaszlo/branches/legals/lps/components/utils/layouts/wrappinglayout.lzx =================================================================== --- openlaszlo/branches/legals/lps/components/utils/layouts/wrappinglayout.lzx 2007-06-07 06:44:57 UTC (rev 5347) +++ openlaszlo/branches/legals/lps/components/utils/layouts/wrappinglayout.lzx 2007-06-07 15:42:47 UTC (rev 5348) @@ -86,8 +86,9 @@ if ( j < (inuse - 1)) { pos += space; maxdimension = Math.max(maxdimension,s[this.otherSizeAxis]); - if (( pos > limit) || - (pos + this.subviews[i+1][this.sizeAxis] > limit)) { + var next = i + 1; + while (this.subviews[next] && !this.subviews[next].visible) next++; + if ((pos + this.subviews[next][this.sizeAxis] > limit)) { pos = this[this.axis + 'inset']; otherpos += maxdimension + otherspace; maxdimension = 0; // Reset the height/width after every row/column _______________________________________________ Laszlo-checkins mailing list Laszlo-checkins@openlaszlo.org http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins (4.0 branch (4.0.3) build r5641)
Testfiles run. (trunk 4 local build r7937)
Verified code has been added to wrappinglayout.lzx and test file runs successfully in swf and dhtml. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||