[squeak-dev] Morphic Bug: Volatile TableLayout
Christoph.Thiede at student.hpi.uni-potsdam.de
Thu Aug 25 08:42:30 UTC 2022
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.
Instead of deviating from this design decision for a particular class, would you consider a self extent = newExtent check as proposed below legitimate? It might also be as a reasonable optimization.
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Donnerstag, 25. August 2022 08:59:11
Betreff: Re: [squeak-dev] Morphic Bug: Volatile TableLayout
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