|
Hi, there!
As this does not work because the quasi-global coordinate system interferes:
self bounds: self submorphBounds.
How about adding a new method #shrinkWrap to morphs:
shrinkWrap
"Change bounds to match submorphBounds."
self submorphBounds in: [:newBounds |
| deltaPosition |
deltaPosition := newBounds topLeft - self topLeft.
self submorphsDo: [:morph |
morph topLeft: morph topLeft - deltaPosition].
self
topLeft: self topLeft + deltaPosition;
extent: newBounds extent].
Best,
Marcel
|