[Drawkit] Fix for slight selection / movement glitch

Brad Larson larson at sonoplot.com
Fri Oct 31 14:40:59 PDT 2008


I was running into a problem with selecting and moving our custom  
point objects, as well as the DKArcPath objects.  When I clicked and  
dragged an individual drawing object, every now and then it would be  
offset from the mouse pointer by a large distance.  It appears that  
this is due to the m_mouseOffset private instance variable of  
DKDrawableObject not being reset after the selection and movement of a  
large number of objects.  By changing -mouseUpAtPoint:inPart:event:  
in  DKDrawableObject to the following, this appears to be fixed:

- (void)			mouseUpAtPoint:(NSPoint) mp inPart:(int) partcode event: 
(NSEvent*) evt
{
	#pragma unused(mp)
	#pragma unused(partcode)
	#pragma unused(evt)
	
	if ( m_mouseEverMoved )
	{
		[[self undoManager] setActionName:NSLocalizedString( @"Move", @"undo  
string for move object")];
		m_mouseEverMoved = NO;
	}
	
	m_mouseOffset.width = 0.0;
	m_mouseOffset.height = 0.0;
	m_inMouseOp = NO;
}

This resets the mouse offset to 0 after lifting the mouse button,  
which I think should be the correct behavior.

______________________
Brad Larson
SonoPlot, Inc.
3030 Laura Lane, Suite 120
Middleton, WI 53562





More information about the Drawkit mailing list