History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-4003
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: -- --
Assignee: Unassigned
Reporter: Jerome Lambourg
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

Wrapping layout incorrect behavior with non visible subviews

Created: 19/May/07 06:30 AM   Updated: 01/Feb/08 12:30 PM
Component/s: Components - LZ
Affects Version/s: 3.4, 4.0.0
Fix Version/s: RingDing (4.1)

Time Tracking:
Not Specified

File Attachments: None
Image Attachments:

1. afterclick.png
(21 kb)

2. beforeclick.png
(20 kb)

3. wrappinglayout_bug.jpg
(17 kb)

Severity: Minor
Fixed in Change#: 5,348
Runtime: N/A
Flags: External
Fix in hand: True


 Description  « Hide
When there are three views, and the middle one is not visible, then this views' size is taken into account for the layout while it should not.

The culprit is in wrappinlayout.lzx, method "update"

                if ((pos > limit) ||
                    (pos + this.subviews[i+1][this.sizeAxis] > limit)) {

this test is incorrect when subviews[i+1] is not visible. This should be changed to

                var next = i + 1;
                while (!this.subviews[next].visible) next++;
                if ((pos + this.subviews[next][this.sizeAxis] > limit)) {


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Max Carlson - 23/May/07 01:32 PM
Compare with trunk, pleeze...

Frisco Del Rosario - 23/May/07 03:07 PM
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>

Jerome Lambourg - 24/May/07 12:33 AM
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>

Frisco Del Rosario - 25/May/07 02:17 PM
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?

Jerome Lambourg - 28/May/07 01:32 AM
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).

Jerome Lambourg - 28/May/07 01:44 AM
I attach a screenshot to better describe what I get. The 'expected' part is the result after applying the patch I proposed.

Max Carlson - 07/Jun/07 08:43 AM
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: LPP-4003 - Wrapping layout incorrect behavior with non visible subviews

Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: wrappinglayout.lzx skips invisible views when evaluating offset
    

Tests: see LPP-4003



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

Mamye Kratt - 11/Jul/07 04:34 PM
(4.0 branch (4.0.3) build r5641)
Testfiles run.

Mamye Kratt - 17/Jul/07 12:03 PM
Need to test in legals.

Mamye Kratt - 01/Feb/08 12:30 PM
(trunk 4 local build r7937)

Verified code has been added to wrappinglayout.lzx and test file runs successfully in swf and dhtml.