[FIX] [BUG] PolygonDropHandleFix (sm)

Peace Jerome peace_the_dreamer at yahoo.com
Sun Mar 21 01:19:33 UTC 2004


Problem: If you delete handles on a polygon til your
down to one, when you try to move that one it deletes
itself. And an error notification pops up. This can
happen with open curves or polygons only.
 
This is a resubmission of some small fixes that I
originally tried to get looked at in Oct 2003.
In resubmitting them I've made each a fix separate and
atomic to ease the decision making process for the
harvesters. And removed extraneous changes not
directly concerned with the fix.
I've also added preamble comments to indicate the
purpose of each fix.

I don't have a direct connection to allow me to post
from within squeak. So I'm still finding what will
work. Any assistance appreciated.
 
Yours in service,  Jerome Peace


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
--0-2125879456-1079831973=:38365
Content-Type: text/plain; name="PolygonDropHandleFix.1.cs"
Content-Description: PolygonDropHandleFix.1.cs
Content-Disposition: inline; filename="PolygonDropHandleFix.1.cs"

'From Squeak3.7alpha of 11 September 2003 [latest update: #5816] on 13 March 2004 at 3:31:21 pm'!
"Change Set:		PolygonDropHandleFix
Date:			13 March 2004
Author:			wiz (Jerome Peace)

Prevent moving a drop handle from deleting the last vertex."!


!PolygonMorph methodsFor: 'editing' stamp: 'wiz 3/13/2004 15:23'!
dropVertex: ix event: evt fromHandle: handle
	| p |
	p _ vertices at: ix.
	"Check for too few vertices before deleting. The alternative is not pretty -wiz"
	((vertices size >= 2) and:
	[(((vertices atWrap: ix-1) dist: p) < 3 or:
		[((vertices atWrap: ix+1) dist: p) < 3])])
		ifTrue: ["Drag a vertex onto its neighbor means delete"
				self setVertices: (vertices copyReplaceFrom: ix to: ix with: Array new)].
	evt shiftPressed
		ifTrue: [self removeHandles]
		ifFalse: [self addHandles "remove then add to recreate"]! !


More information about the Squeak-dev mailing list