[Drawkit] DKZoomTool with DKDrawingDocment setFlipped: NO
Allan
allandaly at me.com
Sun Jan 25 08:53:11 PST 2009
Graham,
I'm implementing the zoom tools and seeing an unexpected result when I
use the DKZoomTool in my drawing.
The convention in architectural CAD applications is to locate the 0,0
origin in the lower left corner. To get this behavior I set the
DKDrawing property setFlipped to NO. This works out fine, and the 0,0
origin is down in the lower left corner where it should be in my
drawing and view.
When I use the DKZoomTool and drag a rectangle, the resulting view is
not centered correctly. The scale factor looks correct, but the center
point is incorrect.
If I change the setFlipped property to yes, so the origin is in the
upper left corner, the ZoomTool works correctly. A dragged zoom window
ends up being zoomed and centered correctly.
From looking into the GCZoomView code and the DKZoomTool code, I
don't see anything there that translates the NSRect and resulting
center point based on whether the origin is in the upper left or the
lower left. I'm guessing that since the NSView and NSRect assume that
the origin is at the upper left, and the setFlipped to NO puts the
origin in the lower left that there's a missing piece in here that is
needed to correctly calculate the center point in my case.
Is there a different approach that I should take to using the ZoomTool
with a not-flipped view? Should I implement a translation in my code?
Or is this something that should be handled inside the DKZoomTool?
Thanks for any help you can send along.
-Allan
More information about the Drawkit
mailing list