This may not be the complete answer you are looking for, but sharing what I did, might help you to make some progress with your interesting problem.
- I'm not a Squeak (or Pharo) user, so I downloaded Squeak from the web.
- Pasted your code in a Workspace and executed it.
- Reproduced the behavior you observed: resizing the rectangle has no effect on its polygon sub-morph.
- Popped up the rectangle menu and saw the 'add halo' item.
- Wrote
'add halo'
somewhere and right-clicked to bring all methods with that literal.
- Found
#addHalo:
as the associated message to the menu item.
- Inserted a
halt
to debug #addHalo:
.
- Cmd+clicked to bring the halo and debugged until I found that the resize handle would send
addGrow:with:
to the morph.
- Then I saw that
addGrow:with:
sends setExtentFromHalo:
and that this sends extent:
.
My conclusion is that you would need a new subclass of RectangleMorph
that resizes all its sub-morphs, proportionally, when it receives setExtentFromHalo:
. Something on the lines of
ScalableRectangleMorph >> #setExtentFromHalo: aPoint
current := self extent.
super setExtentFromHalo: aPoint.
scale := self extent - current / current.
self submorphsDo: [:m | m extent: (m extent * scale) rounded]
Give this a try (I haven't), and let us know how it went.