[Drawkit] zoom to bounding box
Michael Caron
michael.r.caron at gmail.com
Thu Apr 2 18:16:44 PDT 2009
Hi Graham,
I've been looking through the DrawKit code to figure out how to zoom
to a bounding box, or perhaps crop the drawing to the bounding box of
the drawable objects.
There's the DKDrawableObject class method,
+ (NSRect) unionOfBoundsOfDrawablesInArray:(NSArray*) array;
and the scrollToRect:(NSRect)r method on DKDrawing, but I haven't
found anything that would zoom to a box. Glad to add it, but being new
to the framework I don't want to do something that's already done in a
different way.
For a use case, consider a bounding box on a group of objects with top
left corner at (110, 130) and bottom right corner at (300, 390). so
everything to the left of 110 on the x-axis and everything above 130
on the y axis (in a flipped coordinate system), is blank. I'd like to
zoom to the bounding box so that the drawing itself is not resized,
but the scale is set appropriately so the object collection is nicely
centered in the view.
Any tips?
Michael
------------------------------------------------
michael.r.caron at gmail.com
http://techrad.wordpress.com
http://mrcaron.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20090402/24bad11e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20090402/24bad11e/attachment.pgp>
More information about the Drawkit
mailing list