[FIX] [BUG] MudPie / Connectors bug

Lic. Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Thu Dec 18 13:03:12 UTC 2003


Ned:

Perhaps I having a lucky day and found one possible fix to previous [BUG]
mail.
If you agree , add to Connectors.

Cheers.
Edgar

-------------- next part --------------
'From Squeak3.6 of ''6 October 2003'' [latest update: #5424] on 18 December 2003 at 9:56:07 am'!

!NCConnectorMorph methodsFor: 'submorphs-add/remove' stamp: 'edc 12/18/2003 09:54'!
fixDegenerateLine
	"If I have two vertices and they're in the same place, more or less, and  
	both are connected to the same object, then add a couple more vertices  
	and space them so I can be grabbed"
	| v p1 p2 p transform |
	(line vertices size = 2
			and: [self sourceMorph == self destinationMorph
					and: [self sourceMorph notNil]])
		ifFalse: [^ self].
	(self firstVertex dist: self lastVertex)
			< 4
		ifFalse: [^ self].
	v _ self firstVertex - self sourceMorph center.
	p _ self sourceMorph intersectionWithLineSegmentFromCenterTo: self sourceMorph center + (200 * v).
	p1 _ (Point r: 40 degrees: v degrees + 30)
				+ p.
	p2 _ (Point r: 40 degrees: v degrees - 30)
				+ p.
	"p1 and p2 are in SourceMorph coordinate system"
owner isNil ifTrue: [self privateOwner:  self sourceMorph owner].
	transform := owner transformFromWorld composedWithLocal:
		(self sourceMorph transformFromWorld inverseTransformation).
	p1 := transform globalPointToLocal: p1.
	p2 := transform globalPointToLocal: p2.
	line setVertices: {line firstVertex. p1. p2. line lastVertex}! !


More information about the Squeak-dev mailing list