PDA

View Full Version : [CLOSED][3.0rc1] BoxLayout "stretch" does not take styles into account



KampfCaspar
19 Apr 2009, 3:26 AM
hbox and vbox do not correctly account for css paddings/margins. This results in panels "cut off" at the far end.

In the attached testcase (incl. screenshot), I create two windows with hbox-stretch layout and two panels each. Notice in the second window, an additional margin-left is inserted (whether by css rules or styles directly is not important). As shown by the text, the panel gets "too wide" and its display is cut off.

The result seems off by exactly the margin size...

Unfortunately, this prohibits my intentions of some "default" space between panels - with css rules. Furthermore - in css - it's not possible to distinguish vbox/hbox; but that's left for a feature request... ;)

KampfCaspar
19 Apr 2009, 4:11 AM
The same problem seems to affect 'fit' layout (at least) under some circumstances. I updated the testcase zip:

Viewport with padding on all sides, 'fit' layout, one panel. Notice the cut off at the bottom.

KampfCaspar
22 Apr 2009, 12:31 AM
Although I'm by no means an extjs or js expert, I tried to find "my" solution here.

The attached replacement/diff of BoxLayout solves this bug for me.

NB: Base is rc1, not svn.

jack.slocum
23 Apr 2009, 11:24 PM
hbox and vbox have configs to set margins which should be used. Padding should work fine, as long as the child component can handle setting of sizes with padding taken into account (most Ext components do).

Mixing css layout (specifically margins) and an Ext layout which uses absolute positioning will produce unknown results (as should be expected).

KampfCaspar
24 Apr 2009, 4:10 AM
Are you considering this a "NoBug"?

I very much like to define margings - together with font sizes et al - in css; as such, I'm trying to clean js source from as much layout constants as possible.

If you consider margins against extjs spec I will not protest and move to a vbox/hbox "extension".

tryanDLS
24 Apr 2009, 6:33 AM
Margins are not against any spec. What Jack is saying is that if an element is position absolute, you shouldn't be applying margins to that element, you should be padding inside the container.

Animal
24 Apr 2009, 6:45 AM
The layout system doesn't handle padding in a container well.

KampfCaspar
24 Apr 2009, 7:16 AM
the space "between" hbox/vbox items is not covered by container paddings... And embedding all those items in individual containers seems overkill.

The difference between the "margin" member (which is understood by the layout manager) and the "margin" css settings (which was not) does not seem that big to me. Semantically, that is.

mjlecomte
12 Jul 2009, 5:08 PM
This thread is a little old, does anyone still think this is OPEN as of 3.0.0+?

mjlecomte
16 Aug 2009, 11:51 AM
This thread has remained in INFOREQ status for some time now and I don't see any test case posted as requested per http://extjs.com/forum/showthread.php?p=341947#post341947 or any new information posted.

I'm going to update the status to CLOSED in absence of new information / test case. Please post again to have the issue reopened.