Skip to content

Sizing Enhanced Elements

Henrik Vendelbo edited this page Nov 8, 2013 · 4 revisions

Before the layout is adjusted by role/layouter elements the laidout contents are measured for size.

All elements that are actively sized will be checked as the first step 6 times per second.

If the element has a sizing handler it is called. If the element is "laidout" the Laidout.calcSizing method is called. If it has an encapsulating "layouter" the Layouter.calcSizing method is called.

If sizing.forceLayout is set to true by one of these methods or the content sizes have changed the element will be queued for layout in the second phase.

Actively Sized elements

If you pass data-role="'sizingElement':true" the element will be flagged for sizing.

If an element has a sizing handler for its role the element is flagged for sizing.

Elements with a Layouter is flagged for sizing.

Elements with a Laidout is flagged for sizing.

Layouter.sizingElement(el,parent,child,role,conf) is a method you can override for a Layouter if you want to flag a descendant for sizing return true.

Tweaking Tracking of Sizing

By default the size and content size is tracked and uses offsetWidth/Height and scrollWidth/Height.

You can disable the content size tracking by,

el.stateful.set("sizing.track.contentWidth",false);
el.stateful.set("sizing.track.contentHeight",false);

You can disable the element size tracking by,

el.stateful.set("sizing.track.width",false);
el.stateful.set("sizing.track.height",false);

If you want to use clientWidth/Height instead call,

el.stateful.set("sizing.track.sizeBy","client");

By default the sizing.width & sizing.height will be used to determine if the element is displayed. If the element style is overflow:visible; the somewhat slower method of checking the display:none; style is used. More work needs to be done on this default to make it work in all cases.

Given Content

By default the content of a element is considered to be anything within it, so the scrolled size is used. A future release will allow the enhance handler to identify an element as the content.

Clone this wiki locally