[Drawkit] Selection behavior with groups

Graham Cox graham.cox at bigpond.com
Fri Aug 8 17:35:10 PDT 2008


On 7 Aug 2008, at 5:09 am, Brad Larson wrote:

> I added an instance variable to the DKSelectAndEditTool,  
> mAllowMultiObjectKnobDrag, as a boolean which is set via  
> setDragsAllObjectsInSelectionWhenDraggingKnob: .  By default, it is  
> NO, but if it is YES,  
> mouseDownAtPoint:targetObject:layer:event:event delegate: will now  
> take that into account and move the selection rather than edit the  
> control point.
>
> I then call
>
> DKSelectAndEditTool *selectTool = [[DKSelectAndEditTool alloc] init];
> [selectTool setDragsAllObjectsInSelectionWhenDraggingKnob:YES];
> [DKDrawingTool registerDrawingTool:selectTool  
> withName:kDKStandardSelectionToolName];
> [selectTool setKeyboardEquivalent:@" " modifierFlags:0];
>
>
> I apologize if the naming isn't the best, but this approach would  
> seem to add the option of selecting in this fashion for others who  
> wish to have it while preserving the current method as the default.

This seems like a good solution, I'll add it to the main code.  
Subclassing just to get slightly modified behaviour is a bit tedious,  
so this is good for me ;-)

You might yet win the prize for the longest method name!


> at the start of my application to override the default selection  
> behavior.  I also had to modify DKToolController, because  
> setDrawing: was not grabbing the selection tool by its name, it was  
> just creating a new one.  This caused different selection behavior  
> on first load of a document.

Yep, that's probably not what it should be doing. Not sure why I did  
this - might have been some early "get it working" code that never got  
revisited.


cheers, Graham


More information about the Drawkit mailing list