[Drawkit] Changing margins does not shift drawing objects
Brad Larson
larson at sonoplot.com
Tue Jul 8 09:14:06 PDT 2008
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
More information about the Drawkit
mailing list