[Drawkit] Changing margins does not shift drawing objects

Brad Larson larson at sonoplot.com
Tue Jul 8 18:19:04 PDT 2008


Sounds great.  I agree that scaling is probably not the way to go, as  
I was thinking more of the kind of behavior you get if you change the  
margins on something like an iWork application.  The content shifts,  
but is either clipped or wrapped by the far edges.

I was going to ask about the new beta, as we're finally getting close  
to releasing our draw program and I didn't want to make people  
download a really hacked up version of the last DrawKit beta to be  
able to compile the source.  There might be a couple of things to  
patch in, because I don't know if you'll want to use the  
implementation of the category-based file import I described earlier  
(relevant modified DKDrawing files attached, along with filetype  
example from our files).  If you don't think that fits, or is a clean  
enough implementation (I still haven't worked out a good UTI- 
compatible scheme yet), then I can keep working on it.  Anyway, a new  
beta would be awesome, renaming and all.

On Jul 8, 2008, at 7:41 PM, Graham Cox wrote:

> Hi Brad,
>
> I agree with you that the position should be relative to the origin  
> of the grid, which is generally the top, left point inside the  
> margin (this is where the ruler shows 0,0).
>
> I'll need to look into the most efficient way to do this, which I  
> think is probably to manipulate the container transform supplied by  
> the layer to include this origin. This would avoid the need to  
> iterate over the objects and change their position property.
>
> I'm less sure about scaling the objects - not that you mentioned it  
> but Dick did in his message. It could be handled in the same way,  
> but it's less clear if it's desirable. The original thinking was  
> that you set up your scale/grid initially and then draw at that  
> scale. Changing the grid doesn't keep objects at that original scale  
> - effectively they are "rescaled" to the new grid by remaining  
> exactly the same size. I can see that some apps might want to do  
> something different though, so it may be a case of providing a  
> method that will do the job, and leave it up to the app to use it.
>
> I want to try and get a new beta out asap - I was hoping today but I  
> noticed a last-minute bug that I'd prefer to fix, so maybe, maybe  
> not. I'll also try and get this in too. However do be prepared for  
> some renaming work (for the last time I hope!).
>
> cheers, Graham
>
>
> On 9 Jul 2008, at 2:14 am, Brad Larson wrote:
>
>> I just added the ability to resize the document workspace to our  
>> drawing client, and in our application I wanted the margins to  
>> scale as a percentage of the drawing working area.  I noticed that  
>> when the margins changed, the objects within the drawing did not  
>> shift to match, causing items that were drawn at the left edge of  
>> the working area to fall off the drawing and into the margins.
>>
>> It seems like you'd want the objects to stay at their same relative  
>> positions in the drawing, and be shifted appropriately by the  
>> changing margins, but I'm not quite sure where in DrawKit you would  
>> handle this.  DKDrawableObjects are drawn by specifying their  
>> absolute Quartz position (using DKGrid's pointForGridLocation:),  
>> which includes the margin origin in the initial placement  
>> calculation.  You'd need to recalculate the Quartz positions of all  
>> objects using the difference between the old and new margins to  
>> move them properly.  DKObjectOwnerLayers might handle this, by  
>> responding to the kDKDrawingWillChangeMargins and   
>> kDKDrawingDidChangeMargins notifications and adjusting all their  
>> internal objects to match.
>>
>> For now, I can do this manually, but it would be nice for this to  
>> be handled internally.
>>
>> ______________________
>> Brad Larson
>> SonoPlot, Inc.
>> 3030 Laura Lane, Suite 120
>> Middleton, WI 53562
>>
>>
>>
>> _______________________________________________
>> Drawkit mailing list
>> Drawkit at lists.apptree.net
>> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net
>
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net

______________________
Brad Larson
SonoPlot, Inc.
3030 Laura Lane, Suite 120
Middleton, WI 53562
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DKDrawing+FiletypeDrawing.h
Type: application/octet-stream
Size: 389 bytes
Desc: not available
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20080708/090160db/attachment-0008.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DKDrawing+FiletypeDrawing.m
Type: application/octet-stream
Size: 2254 bytes
Desc: not available
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20080708/090160db/attachment-0009.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DKDrawing.h
Type: application/octet-stream
Size: 9165 bytes
Desc: not available
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20080708/090160db/attachment-0010.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DKDrawing.m
Type: application/octet-stream
Size: 88262 bytes
Desc: not available
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20080708/090160db/attachment-0011.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DKDrawingDocument.h
Type: application/octet-stream
Size: 3034 bytes
Desc: not available
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20080708/090160db/attachment-0012.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DKDrawingDocument.m
Type: application/octet-stream
Size: 28359 bytes
Desc: not available
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20080708/090160db/attachment-0013.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DKDrawing+FiletypePattern.h
Type: application/octet-stream
Size: 1207 bytes
Desc: not available
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20080708/090160db/attachment-0014.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DKDrawing+FiletypePattern.m
Type: application/octet-stream
Size: 31505 bytes
Desc: not available
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20080708/090160db/attachment-0015.obj>
-------------- next part --------------




More information about the Drawkit mailing list