[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scaling, rotating, flipping subview
From: |
H. Nikolaus Schaller |
Subject: |
scaling, rotating, flipping subview |
Date: |
Sun, 8 Dec 2019 20:17:48 +0100 |
Hi,
I am currently working on some CAD tool for GNUstep/mySTEP
and for that I would need a NSView class that can become
the documentView of a NSClipView, embedded in some
NSScrollView. And the view class I am looking for should
allow to rotate, flip and scale a subview (where I do the
drawing).
There is no standard class which can do that in Cocoa or OpenSTEP.
I have experimented a little on Cocoa and got scaling work
(by setting the bounds of the drawing view scaled relative to
its frame) but flipping and rotation is difficult to achieve.
It partially works with setBoundsRotation or scaleUnitSquareToSize,
but as a side-effect that breaks operation of the scrollers of
the NSScrollView.
Scroller size and position seems to assume that the frame and
bounds are not rotated so that changing the bounds origin can
simply move around the view under the NSClipView.
The standard recommendation is to set a transform matrix in
drawRect: and by that I could make drawing work, but coordinate
transforms for mouse clicks do not take this into account.
And scrollers do not adjust for different scaling.
Finally, this is not a general approach which can rotate,
flip and scale an arbitrary subview.
Before I invest more time in this topic, I'd like to ask
if someone knows an open source implementation of such a
general NSView subclass.
Thanks,
Nikolaus
- scaling, rotating, flipping subview,
H. Nikolaus Schaller <=