Hi All,

When using a wrapping layout, once you get a high row, every row that follows is also high. In the example below the 2nd item in 3rd row, "GI Problems" , wraps making a new height which gets used by the following rows.



I think it would be better to reset the max height for each row which would make the example look like this:



Here is a fix for the update method of wrappinglayout which does this:


   <method name="update">
        <![CDATA[
        if ( this.locked ) return;
        var l = this.subviews.length;
        var limit = this.immediateparent[this.sizeAxis];

        // position along this.axis
        var pos = this[this.axis + 'inset'];
        // position along this.otherAxis
        var otherpos = this[this.otherAxis + 'inset'];
        var maxdimension = 0;
        var space = this[this.axis + 'spacing'];    // spacing in axis dimension
        var otherspace = this[this.otherAxis + 'spacing'];    // spacing in other axis dimension

        for(var i=0; i < l; i++) {
            var s = this.subviews[i];
            s.animate(this.axis, pos, this.duration,false);
            s.animate(this.otherAxis, otherpos, this.duration,false);
            pos += s[this.sizeAxis];
            if ( i < (l - 1)) {
                pos += space;
                maxdimension = Math.max(maxdimension,s[this.otherSizeAxis]);
                if (( pos > limit) ||
                    (pos + this.subviews[i+1][this.sizeAxis] >  limit)) {
                    pos = this[this.axis + 'inset'];
                    otherpos += maxdimension + otherspace;
                    maxdimension = 0;   // Reset the height/width after every row/column
                }
            }


        }
        ]]>
    </method>




Here is a snippet of the code used for the example

                                <hbox  width="${parent.width - 10 }"  >
                                    <wrappinglayout axis="x" />
                                    <view width="${parent.width/3 - 10}" datapath="comorbidities/comorbidity">
                                        <text multiline="true" width="${parent.width}" datapath="@label" />
                                    </view>
                                 </hbox>
Regards,

Garth

_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to