[squeak-dev] Morphic Bug: Volatile TableLayout
marcel.taeumel at hpi.de
Thu Aug 25 06:59:11 UTC 2022
Hi Christoph --
It might help if you remember a preciseExtent in TransformationMorph to then be used during its updates.
This is not a bug in TableLayout.
This is not a specific bug in Morphic.
It is a design issue; all coordinates (or bounds) in Morphic are integer at the moment.
You can observe similar issues when changing the scale factor back and forth.
Am 24.08.2022 20:12:46 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>:
I've observed and reproduced a case of "volatile table layout" in Morphic:
inner := Morph new color: Color red.
f := inner addFlexShell
outer := Morph new color: Color yellow.
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]
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 [https://github.com/hpi-swa-lab/squeak-inbox-talk]
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev