Re: [ROOT] Aspect Ratio of Graphics in TPad

From: Thomas Bretz (tbretz@uni-sw.gwdg.de)
Date: Tue Oct 23 2001 - 17:13:18 MEST


Hello Fons,

this is not the behaviour I want to have. Using Options/Auto Resize
Canvas doesn't resize anything if I resize the canvas, but I want the
canvas to be resized. My point is, that I want that width gets changed
in the same ratio than the height and vice versa.

Think about drawing a detector layout. If you change the size of the
canvas you don't want to distort the layout, but if you change width and
height you may want to zoom it.

This can be solved easily by a function in TCanvas which fixes the
width/height ratio at a given time (FixAspectRatio()) and resizes
width/height according to the resizement of the other one.

Or, this would be more convinient: The graphic elemts don't distort and
get resized only if the zoomed graphic would fit again in the resized
pad Pad.
(If you make only width or height longer the graphic elemenst would stay
the same, if you would make only width or height shorter the element
would become smaller)

Would be a really nice feature (and maybe it is not so difficult to
implement than it looks like)

Thanks a lot,
Thomas.

Fons Rademakers wrote:
> You can do that now if in the canvas menu you turn off the
> option: Options/Auto Resize Canvas. In that case the canvas
> stays fixed when changing the window size. The API to this
> feature is not yet easily accessable but I can expose it.
> >
> > I have a question and maybe a suggestion:
> > Is it possible to fix the aspect ratio of a graphic in a TPad or to fix
> > the aspect ratio of a canvas. So that if I change only the width the
> > graphic stays the same, but if I change the width and height, the
> > graphic is resized. If this is not yet implemented it would be a really
> > nice feature. (Easier to implement is fixing the aspect ratio of a
> > canvas, Iguess) This would help when displaing detector geometries.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:04 MET