<body><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        > <span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Whoa that method is long...</span><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">That layout code reads quite nicely. I got in touch with it last fall. It's heavy on the "math side", so it is a pleasure to have all intermediate results named as temps. This is one of the gifts Andreas has left us. And a perfect example of how temps can make life easier. I wouldn't change it just for sake of its length. :-)</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Best,</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Marcel</span></div><div class="mb_sig"></div><blockquote class="history_container" type="cite" style="border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 04.04.2020 16:38:05 schrieb Jakob Reschke <forums.jakob@resfarm.de>:</p><div style="font-family:Arial,Helvetica,sans-serif">Whoa that method is long...<br><br>Am Sa., 4. Apr. 2020 um 11:06 Uhr schrieb <commits@source.squeak.org>:<br>><br>> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:<br>> http://source.squeak.org/trunk/Morphic-mt.1643.mcz<br>><br>> ==================== Summary ====================<br>><br>> Name: Morphic-mt.1643<br>> Author: mt<br>> Time: 4 April 2020, 11:06:42.760864 am<br>> UUID: 81efe0e9-ec69-1b45-ba8e-b81bbb649355<br>> Ancestors: Morphic-mt.1642<br>><br>> Fixes the recently discovered layout bug. Thanks to Christoph (ct)!<br>><br>> =============== Diff against Morphic-mt.1642 ===============<br>><br>> Item was changed:<br>>   ----- Method: TableLayout>>computeExtraSpacing:in:horizontal:target: (in category 'layout') -----<br>>   computeExtraSpacing: arrangement in: newBounds horizontal: aBool target: aMorph<br>>         "Compute the required extra spacing for laying out the cells"<br>><br>>         "match newBounds extent with arrangement's orientation"<br>><br>>         | extent extra centering n extraPerCell cell last hFill vFill max amount allow |<br>>         extent := newBounds extent.<br>>         aBool ifFalse: [extent := extent transposed].<br>><br>>         "figure out if we have any horizontal or vertical space fillers"<br>>         hFill := vFill := false.<br>>         max := 0 @ 0.<br>>         arrangement do:<br>>                         [:c |<br>>                         max := (max x max: c cellSize x) @ (max y + c cellSize y).<br>>                         max := max max: c cellSize.<br>>                         hFill := hFill or: [c hSpaceFill].<br>>                         vFill := vFill or: [c vSpaceFill]].<br>><br>>         "Take client's shrink wrap constraints into account.<br>>         Note: these are only honored when there are no #spaceFill children,<br>>         or when #rubberBandCells is set."<br>>         allow := properties rubberBandCells not.<br>>         aMorph hResizing == #shrinkWrap<br>>                 ifTrue:<br>>                         [aBool<br>>                                 ifTrue: [allow & hFill ifFalse: [extent := max x @ (max y max: extent y)]]<br>>                                 ifFalse: [allow & vFill ifFalse: [extent := (max x max: extent x) @ max y]]].<br>>         aMorph vResizing == #shrinkWrap<br>>                 ifTrue:<br>>                         [aBool<br>>                                 ifFalse: [allow & hFill ifFalse: [extent := max x @ (max y max: extent y)]]<br>>                                 ifTrue: [allow & vFill ifFalse: [extent := (max x max: extent x) @ max y]]].<br>><br>>         "Now compute the extra v space"<br>>         extra := extent y<br>>                                 - (arrangement inject: 0 into: [:sum :c | sum + c cellSize y]).<br>>         extra > 0<br>>                 ifTrue:<br>>                         ["Check if we have any #spaceFillers"<br>><br>>                         vFill<br>>                                 ifTrue:<br>>                                         ["use only #spaceFillers"<br>><br>>                                         n := arrangement inject: 0<br>>                                                                 into: [:sum :c | c vSpaceFill ifTrue: [sum + 1] ifFalse: [sum]].<br>>                                         n isZero ifFalse: [extraPerCell := extra asFloat / n asFloat].<br>>                                         extra := last := 0.<br>>                                         arrangement do:<br>>                                                         [:c |<br>>                                                         c vSpaceFill<br>>                                                                 ifTrue:<br>>                                                                         [extra := (last := extra) + extraPerCell.<br>>                                                                         amount := 0 @ (extra truncated - last truncated).<br>>                                                                         c do: [:cc | cc cellSize: cc cellSize + amount]]]]<br>>                                 ifFalse:<br>>                                         ["no #spaceFillers; distribute regularly"<br>><br>>                                         centering := properties wrapCentering.<br>>                                         "centering == #topLeft ifTrue:[]."      "add all extra space to the last cell; e.g., do nothing"<br>>                                         centering == #bottomRight<br>>                                                 ifTrue:<br>>                                                         ["add all extra space to the first cell"<br>><br>> +                                                       arrangement ifNotEmpty: [:cells | cells first addExtraSpace: 0 @ extra]].<br>> -                                                       arrangement first addExtraSpace: 0 @ extra].<br>>                                         centering == #center<br>>                                                 ifTrue:<br>>                                                         ["add 1/2 extra space to the first and last cell"<br>><br>> +                                                       arrangement ifNotEmpty: [:cells | cells first addExtraSpace: 0 @ (extra // 2)]].<br>> -                                                       arrangement first addExtraSpace: 0 @ (extra // 2)].<br>>                                         centering == #justified<br>>                                                 ifTrue:<br>>                                                         ["add extra space equally distributed to each cell"<br>><br>>                                                         n := arrangement size - 1 max: 1.<br>>                                                         extraPerCell := extra asFloat / n asFloat.<br>>                                                         extra := last := 0.<br>>                                                         arrangement do:<br>>                                                                         [:c |<br>>                                                                         c addExtraSpace: 0 @ (extra truncated - last truncated).<br>>                                                                         extra := (last := extra) + extraPerCell]]]].<br>><br>>         "Now compute the extra space for the primary direction"<br>>         centering := properties listCentering.<br>>         1 to: arrangement size<br>>                 do:<br>>                         [:i |<br>>                         cell := arrangement at: i.<br>>                         extra := extent x - cell cellSize x.<br>>                         extra > 0<br>>                                 ifTrue:<br>>                                         ["Check if we have any #spaceFillers"<br>>                                         cell := cell nextCell.<br>>                                         cell hSpaceFill<br>>                                                 ifTrue:<br>>                                                         ["use only #spaceFillers"<br>><br>><br>>                                                         n := cell inject: 0<br>>                                                                                 into: [:sum :c | c hSpaceFill ifTrue: [sum + c target spaceFillWeight] ifFalse: [sum]].<br>>                                                         n isZero ifFalse: [extraPerCell := extra asFloat / n asFloat].<br>>                                                         extra := last := 0.<br>>                                                         cell do:<br>>                                                                         [:c |<br>>                                                                         c hSpaceFill<br>>                                                                                 ifTrue:<br>>                                                                                         [extra := (last := extra) + (extraPerCell * c target spaceFillWeight).<br>>                                                                                         amount := extra truncated - last truncated.<br>>                                                                                         c cellSize: c cellSize + (amount @ 0)]]]<br>>                                                 ifFalse:<br>>                                                         ["no #spaceFiller; distribute regularly"<br>><br>><br>>                                                         "centering == #topLeft ifTrue:[]"       "add all extra space to the last cell; e.g., do nothing"<br>>                                                         centering == #bottomRight<br>>                                                                 ifTrue:<br>>                                                                         ["add all extra space to the first cell"<br>><br>>                                                                         cell addExtraSpace: extra @ 0].<br>>                                                         centering == #center<br>>                                                                 ifTrue:<br>>                                                                         ["add 1/2 extra space to the first and last cell"<br>><br>>                                                                         cell addExtraSpace: (extra // 2) @ 0].<br>>                                                         centering == #justified<br>>                                                                 ifTrue:<br>>                                                                         ["add extra space equally distributed to each cell"<br>><br>>                                                                         n := cell size - 1 max: 1.<br>>                                                                         extraPerCell := extra asFloat / n asFloat.<br>>                                                                         extra := last := 0.<br>>                                                                         cell do:<br>>                                                                                         [:c |<br>>                                                                                         c addExtraSpace: (extra truncated - last truncated) @ 0.<br>>                                                                                         extra := (last := extra) + extraPerCell]]]]]!<br>><br>><br><br><br></commits@source.squeak.org></div></blockquote>
                                        </div></body>