<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi Marcel,</p>
<p><br>
</p>
<p>thanks for the reply! Yes, it's a design issue. But would such a preciseExtent really work? After a short look, I think that the rounding is already applied in the layouting stage, i.e., not under the control of the TMorph.</p>
<p><br>
</p>
<p>Instead of deviating from this design decision for a particular class, would you consider a <span>self extent = newExtent check as proposed below legitimate? It might also be as a reasonable optimization.</span></p>
<p><span><br>
</span></p>
<p><span>Best,</span></p>
<p><span>Christoph</span></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel<br>
<b>Gesendet:</b> Donnerstag, 25. August 2022 08:59:11<br>
<b>An:</b> squeak-dev<br>
<b>Betreff:</b> Re: [squeak-dev] Morphic Bug: Volatile TableLayout</font>
<div> </div>
</div>
<div>
<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
Hi Christoph --
<div><br>
</div>
<div>It might help if you remember a preciseExtent in TransformationMorph to then be used during its updates.</div>
<div><br>
</div>
<div>This is not a bug in TableLayout.</div>
<div>This is not a specific bug in Morphic.</div>
<div>It is a design issue; a<span style="font-size: 10pt">ll coordinates (or bounds) in Morphic are integer at the moment.</span></div>
<div><br>
</div>
<div>You can observe similar issues when changing the scale factor back and forth.</div>
<div><br>
</div>
<div>Best,</div>
<div>Marcel</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;min-width: 500px">
<p style="color: #AAAAAA; margin-top: 10px;">Am 24.08.2022 20:12:46 schrieb christoph.thiede@student.hpi.uni-potsdam.de <christoph.thiede@student.hpi.uni-potsdam.de>:</p>
<div style="font-family:Arial,Helvetica,sans-serif">Hi all,<br>
<br>
I've observed and reproduced a case of "volatile table layout" in Morphic:<br>
<br>
    <span style="color: #000000">inner </span><b>:=</b><span style="color: #000000"> Morph
</span><span style="color: #000080">new</span><span style="color: #000000"> </span>
<span style="color: #000080">color:</span><span style="color: #000000"> Color </span>
<span style="color: #000080">red</span><span style="color: #000000">.<br>
    f </span><b>:=</b><span style="color: #000000"> inner </span><span style="color: #000080">addFlexShell</span><span style="color: #000000"><br>
        </span><span style="color: #000080">scale:</span><span style="color: #000000">
</span><span style="color: #800000">0.4</span><span style="color: #000000">;<br>
        </span><span style="color: #000080">yourself</span><span style="color: #000000">.<br>
    <br>
    outer </span><b>:=</b><span style="color: #000000"> Morph </span><span style="color: #000080">new</span><span style="color: #000000">
</span><span style="color: #000080">color:</span><span style="color: #000000"> Color
</span><span style="color: #000080">yellow</span><span style="color: #000000">.<br>
    outer </span><span style="color: #000080">changeTableLayout</span><span style="color: #000000">.<br>
    outer </span><span style="color: #000080">addMorph:</span><span style="color: #000000"> f.<br>
    outer </span><span style="color: #000080">addMorph:</span><span style="color: #000000"> (Morph
</span><span style="color: #000080">new</span><span style="color: #000000"> </span>
<span style="color: #000080">extent:</span><span style="color: #000000"> </span><span style="color: #800000">30</span><span style="color: #000000">
</span><span style="color: #000080">@</span><span style="color: #000000"> </span>
<span style="color: #800000">10</span><span style="color: #000000">).<br>
    <br>
    f </span><span style="color: #000080">layoutChanged</span><span style="color: #000000">. outer
</span><span style="color: #000080">fullBounds</span><span style="color: #000000">. f
</span><span style="color: #000080">scale</span><span style="color: #000000">. </span>
<span style="color: #008080"><i>"0.38888888888888895"</i></span><span style="color: #000000"><br>
    f </span><span style="color: #000080">layoutChanged</span><span style="color: #000000">. outer
</span><span style="color: #000080">fullBounds</span><span style="color: #000000">. f
</span><span style="color: #000080">scale</span><span style="color: #000000">. </span>
<span style="color: #008080"><i>"0.37654320987654327"</i></span><span style="color: #000000"><br>
    f </span><span style="color: #000080">layoutChanged</span><span style="color: #000000">. outer
</span><span style="color: #000080">fullBounds</span><span style="color: #000000">. f
</span><span style="color: #000080">scale</span><span style="color: #000000">. </span>
<span style="color: #008080"><i>"0.36282578875171484"<br>
    "..."</i></span><br>
<br>
The incremental shrinkage of #scale takes place in TransformationMorph>>extent: (see screenshot). I suppose this is the cause of a rounding error (scale is exact, but bounds/fullBounds are rounded), but I'm not sure. The following stabilizes my concrete case,
 but I'm not sure whether this is the actual solution or just a workaround:<br>
<br>
     TransformationMorph >> <b>extent:</b><span style="color: #000000"> </span><span style="color: #000080">newExtent</span><span style="color: #000000"><br>
     <br>
</span><span style="color: #000000"><u>    +     </u></span><span style="color: #800000"><u>self</u></span><span style="color: #000000"><u>
</u></span><span style="color: #000080"><u>extent</u></span><span style="color: #000000"><u>
</u></span><span style="color: #000080"><u>=</u></span><span style="color: #000000"><u>
</u></span><span style="color: #000080"><u>newExtent</u></span><span style="color: #000000"><u>
</u></span><span style="color: #000080"><u>ifTrue:</u></span><span style="color: #000000"><u> [</u></span><span style="color: #800000"><u>^</u></span><span style="color: #000000"><u>
</u></span><span style="color: #800000"><u>self</u></span><span style="color: #000000"><u>].<br>
</u></span>     <span style="color: #000000">    </span><span style="color: #800000">self</span><span style="color: #000000">
</span><span style="color: #000080">renderedMorph</span><span style="color: #000000">
</span><span style="color: #000080">==</span><span style="color: #000000"> </span>
<span style="color: #800000">self</span><span style="color: #000000"><br>
</span>     <span style="color: #000000">        </span><span style="color: #000080">ifTrue:</span><span style="color: #000000">
</span><span style="color: #000000">[</span><span style="color: #800000">super</span><span style="color: #000000">
</span><span style="color: #000080">extent:</span><span style="color: #000000"> </span>
<span style="color: #000080">newExtent</span><span style="color: #000000">]</span><span style="color: #000000"><br>
</span>     <span style="color: #000000">        </span><span style="color: #000080">ifFalse:</span><span style="color: #000000">
</span><span style="color: #000000">[</span><span style="color: #000000"><br>
</span>     <span style="color: #000000">            </span><span style="color: #800000">self</span><span style="color: #000000">
</span><span style="color: #000080">adjustAfter:</span><span style="color: #000000">
</span><span style="color: #008000">[</span><span style="color: #000000"><br>
</span>     <span style="color: #000000">                </span><span style="color: #808080">|</span><span style="color: #000000">
</span><span style="color: #808080">scaleFactor</span><span style="color: #000000">
</span><span style="color: #808080">|</span><span style="color: #000000"><br>
</span>     <span style="color: #000000">                </span><span style="color: #808080">scaleFactor</span><span style="color: #000000">
</span><b>:=</b><span style="color: #000000"> </span><span style="color: #800080">(</span><span style="color: #800000">self</span><span style="color: #000000">
</span><span style="color: #000080">scale</span><span style="color: #000000"> </span>
<span style="color: #000080">*</span><span style="color: #000000"> </span><span style="color: #000080">newExtent</span><span style="color: #000000">
</span><span style="color: #000080">r</span><span style="color: #000000"> </span>
<span style="color: #000080">/</span><span style="color: #000000"> </span><span style="color: #800000">self</span><span style="color: #000000">
</span><span style="color: #000080">fullBounds</span><span style="color: #000000">
</span><span style="color: #000080">extent</span><span style="color: #000000"> </span>
<span style="color: #000080">r</span><span style="color: #800080">)</span><span style="color: #000000">
</span><span style="color: #000080">max:</span><span style="color: #000000"> </span>
<span style="color: #800000">0.1</span><span style="color: #000000">.</span><span style="color: #000000"><br>
</span>     <span style="color: #000000">                </span><span style="color: #800000">self</span><span style="color: #000000">
</span><span style="color: #000080">scale:</span><span style="color: #000000"> </span>
<span style="color: #800080">(</span><span style="color: #808080">scaleFactor</span><span style="color: #000000">
</span><span style="color: #000080">detentBy:</span><span style="color: #000000">
</span><span style="color: #800000">0.1</span><span style="color: #000000"> </span>
<span style="color: #000080">atMultiplesOf:</span><span style="color: #000000"> </span>
<span style="color: #800000">1.0</span><span style="color: #000000"> </span><span style="color: #000080">snap:</span><span style="color: #000000">
</span><span style="color: #800000">false</span><span style="color: #800080">)</span><span style="color: #008000">]</span><span style="color: #000000">]</span><span style="color: #000000">.</span><br>
<br>
Looking forward to your feedback!<br>
<br>
Best,<br>
Christoph<br>
<br>
<span style="color: #808080">---<br>
</span><span style="color: #808080"><i>Sent from </i></span><span style="color: #808080"><i><a href="https://github.com/hpi-swa-lab/squeak-inbox-talk"><u><span style="color: #808080">Squeak Inbox Talk</span></u></a></i></span><br>
["volatileTableLayoutStack.png"]</div>
</blockquote>
</div>
</div>
</body>
</html>