[Drawkit] Changing margins does not shift drawing objects
Dick Applebaum
dicklacara at mac.com
Tue Jul 8 14:32:41 PDT 2008
Brad,
I assume by document, you mean the grid layer.
I agree with you-- everything should scale/reposition on a relative
basis to the original size/position (just like in a photograph).
I don't know if this will help (or even if it is possible) but, from a
logical standpoint couldn't you programatically:
1) group all the objects together including the document layer as just
another object
2) convert this to a shape
3) resize the shape as desired
4) convert back to a group object
5) ungroup
Again, I don't know if DrawKit permits manipulation of the document
layer in this way... if not, you could create a background object that
serves as a document layer & manipulate is as above.
HTH
Dick
On Jul 8, 2008, at 9: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
More information about the Drawkit
mailing list