[Drawkit] Selection behavior with groups

Brad Larson larson at sonoplot.com
Tue Aug 12 14:17:11 PDT 2008


On Aug 9, 2008, at 1:43 AM, Graham Cox wrote:

> Unfortunately, the code you sent is buggy in a couple of ways. First  
> it ignores the state of the -dragsAllObjectsInSelection flag, which  
> isn't a big problem. However I also found that objects suddenly jump  
> around to random locations when dragged or more commonly have the  
> mouse offset set to zero so they suddenly jump into alignment with  
> the mouse co-ordinates. I couldn't immediately put my finger on the  
> problem, so I've backed out the change for now until I have more time.
>
> You might want to check that things are working properly for you -  
> for example try dragging an object from somewhere near its edge and  
> see if it doesn't jump on top of the mouse or shoot off to some  
> random position.
>


I was seeing some dragging problems, but only with my custom point  
objects.  In the -mouseDraggedAtPoint: inPart: event: method, I had to  
change

if (partcode == kDKDrawingEntireObjectPart )
{
	[super mouseDraggedAtPoint:mp inPart:partcode event:evt];
}

to

if (partcode == kDKDrawingEntireObjectPart )
{
	mp.x -= m_mouseOffset.width;
	mp.y -= m_mouseOffset.height;
	
	BOOL controlKey = (([evt modifierFlags] & NSControlKeyMask) != 0 );
	mp = [self snappedMousePoint:mp  
forSnappingPointsWithControlFlag:controlKey];
		
	[self setCenter:mp];
	m_mouseEverMoved = YES;
}

so that my custom path was updated properly.  However, that was only  
because of the custom code in my subclassed DKDrawablePath.  I've been  
using this with our draw program for a little while now and haven't  
seen the random jerkiness you're describing.  I'll keep looking to see  
if I can nail it down in my own application.

I did see some instances of the objects disappearing beyond the edge  
of the canvas, but I assumed that was due to the default behavior  
where objects can be dragged off of the canvas to other documents.

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





More information about the Drawkit mailing list