[Drawkit] tool to create object of pre-set size then click to place?

Allan Daly allandaly at me.com
Sat Jan 2 09:10:30 PST 2010


Good idea on the drag phase -- that's a nice improvement. While  
dragging I change the cursor back to the arrow during the drag so it's  
clear what's happening. -Allan


On Jan 1, 2010, at 2:22 AM, Graham Cox wrote:

> Hi Allan,
>
> I think what you've done is fine - I've subclassed  
> DKObjectCreationTool for much the same purpose.
>
> One thing you could do to finesse it, if it makes sense in your app,  
> is to allow the mouse down to add the object as a 'pending' object,  
> then allow it to be dragged and only added to the layer on mouse up.  
> This would allow you to click-drag-release the object to position it  
> exactly where you want it. While an object is 'pending' it can still  
> have its position set as normal to allow dragging into place. A  
> single click still achieves the same result as adding on mouse down.
>
> --Graham
>
> P.S. A Happy New Year to you and all DK-ers!
>
>
>
> On 01/01/2010, at 5:26 AM, Allan Daly wrote:
>
>> I figured something out -- here's my approach in case it's useful  
>> to anyone. I'd be glad to hear any other/better ideas on this.
>>
>> I created a new "stamp tool" that is a subclass of  
>> DKObjectCreationTool. It sets the cursor with an image based on the  
>> prototype object so that when the tool is clicked the cursor  
>> changes to an image of the object that will be "stamped." On a  
>> mouse down event the prototype object is added to the target layer.  
>> If "sticky tools" are set ( [DKToolController  
>> setAutomaticallyRevertsToSelectionTool:NO]) then you can stamp/ 
>> insert many of the same object over and over again.
>> []
>
>> Have fun with it, and happy 2010 everyone.
>>
>> -Allan
>
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net



More information about the Drawkit mailing list