[squeak-dev] Manual shrink-wrapping to submorphs

Marcel Taeumel marcel.taeumel at student.hpi.uni-potsdam.de
Fri Jan 23 09:28:32 UTC 2015


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



--
View this message in context: http://forum.world.st/Manual-shrink-wrapping-to-submorphs-tp4801162.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.


More information about the Squeak-dev mailing list