[BUG] submorphBounds is incorrect for TransformMorphs.

Ned Konz ned at bike-nomad.com
Thu Mar 7 04:38:41 UTC 2002


submorphBounds is defined in Morph as:

submorphBounds
	"Private. Compute the actual full bounds of the receiver"
	| box subBox |
	submorphs do: [:m | 
		(m visible) ifTrue: [
			subBox _ m fullBounds.
			box 
				ifNil:[box _ subBox copy]
				ifNotNil:[box _ box quickMerge: subBox]]].
	box ifNil:[^self bounds]. "e.g., having submorphs but not visible"
	^ box origin asIntegerPoint corner: box corner asIntegerPoint

However, for a TransformMorph, the submorphs aren't in the same coordinate 
system. So submorphBounds answers a Rectangle in the wrong coordinate system.

TransformMorph>>contentBounds has it right:

contentBounds
	self hasSubmorphs ifTrue:
		[^ (transform localBoundsToGlobal: self submorphBounds) truncated].
	^ self fullBounds

Where this discrepancy is giving me a problem is with removeDropShadow, which 
eventually calls privateFullBounds, which calls submorphBounds and does a 
quickMerge with the outerBounds. And then results in fullBounds being set to 
a Rectangle in the wrong coordinate system.

It seems to me that submorphBounds should always answer a Rectangle in the 
same coordinate system as layoutBounds, outerBounds and clippingBounds.

I'm running into problems with my Connectors because of this and don't know 
quite how to proceed.

What's happening is that I have situations where (because of fullBounds 
getting set wrong) I can't select Connectors that have end adornments using a 
SelectionMorph. My Connector end adornments use TransformationMorphs for 
rotation.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com



More information about the Squeak-dev mailing list