discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scaling, rotating, flipping subview


From: H. Nikolaus Schaller
Subject: Re: scaling, rotating, flipping subview
Date: Mon, 9 Dec 2019 06:38:22 +0100

Hi Fred,

> Am 08.12.2019 um 23:04 schrieb Fred Kiefer <fredkiefer@gmx.de>:
> 
> Nikolaus,
> 
> I don’t understand  your question. From your description I would expect that 
> NSView already supports all you need

yes, you can setBounds, setBoundsRotation and scaleUnitSquareToSize
on the documentView of the NSClipView but if you do it, scroll+clip view
breaks. Only the unrotated and unflipped variant and scaling works as
expected.

Symptoms are that the scrollers move to the end or jump back and
forth if you rotate in 10 degrees steps. And drawing becomes
invisible.

> but the NSScrollView could not handle it. So what you are looking for would 
> be a better scroll view.

Not a better scroll view, but a recipe or idea how to make the existing
one work.

The ideal thing would be that I can just insert a custom scalerotateflip-view
in the view hierarchy. The superview being a NSClipView and the subview
being some arbitrary view (hierarchy).

> I remember the time we worked together to understand the concepts behind view 
> transformations. You decided that myStep could work with a simpler model than 
> the one required by Cocoa, but the Cocoa one, which I tried to implement in 
> GNUstep, should be sufficient to provide the drawing for your CAD view.

I have tested on Cocoa and it breaks as well. So this question is not related
to the framework implementations but code using them (and assuming that standard
behaviour is implemented correctly by the frameworks).

If someone knows an app or framework that implements scaling, rotating,
flipping subview it would be a good pointer to get a better understanding.

BR and thanks,
Nikolaus

> 
> Cheers,
> Fred
> 
>> Am 08.12.2019 um 20:17 schrieb H. Nikolaus Schaller <hns@goldelico.com>:
>> 
>> 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
>> 
>> 
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]