[squeak-dev] Morphic Bug: Volatile TableLayout

christoph.thiede at student.hpi.uni-potsdam.de christoph.thiede at student.hpi.uni-potsdam.de
Wed Aug 24 18:12:30 UTC 2022

Hi all,

I've observed and reproduced a case of "volatile table layout" in Morphic:

    inner := Morph new color: Color red.
    f := inner addFlexShell
        scale: 0.4;
    outer := Morph new color: Color yellow.
    outer changeTableLayout.
    outer addMorph: f.
    outer addMorph: (Morph new extent: 30 @ 10).
    f layoutChanged. outer fullBounds. f scale. "0.38888888888888895"
    f layoutChanged. outer fullBounds. f scale. "0.37654320987654327"
    f layoutChanged. outer fullBounds. f scale. "0.36282578875171484"

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:

	  TransformationMorph >> extent: newExtent
	+ 	self extent = newExtent ifTrue: [^ self].
	  	self renderedMorph == self
	  		ifTrue: [super extent: newExtent]
	  		ifFalse: [
	  			self adjustAfter: [
	  				| scaleFactor |
	  				scaleFactor := (self scale * newExtent r / self fullBounds extent r) max: 0.1.
	  				self scale: (scaleFactor detentBy: 0.1 atMultiplesOf: 1.0 snap: false)]].

Looking forward to your feedback!


Sent from Squeak Inbox Talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220824/95de84c6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: volatileTableLayoutStack.png
Type: image/png
Size: 66582 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220824/95de84c6/attachment-0001.png>

More information about the Squeak-dev mailing list