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;
yourself.
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!
Best,
Christoph
---
Sent from Squeak Inbox Talk
["volatileTableLayoutStack.png"]