ares-ide
Version:
A browser-based code editor and UI designer for Enyo 2 projects
34 lines (30 loc) • 1.1 kB
JavaScript
/**
_enyo.FittableHeaderLayout_ extends
[enyo.FittableColumnsLayout](#enyo.FittableColumnsLayout), providing a
container in which items are laid out in a set of vertical columns, with most
items having natural size, but one expanding to fill the remaining space. The
one that expands is labeled with the attribute _fit: true_.
For more information, see the documentation on
[Fittables](building-apps/layout/fittables.html) in the Enyo Developer Guide.
*/
enyo.kind({
name: "enyo.FittableHeaderLayout",
kind: "FittableColumnsLayout",
applyFitSize: enyo.inherit(function (sup) {
return function(measure, total, before, after) {
var padding = before - after;
var f = this.getFitControl();
if (padding < 0) {
f.applyStyle("padding-left", Math.abs(padding) + "px");
f.applyStyle("padding-right", null);
} else if (padding > 0) {
f.applyStyle("padding-left", null);
f.applyStyle("padding-right", Math.abs(padding) + "px");
} else {
f.applyStyle("padding-left", null);
f.applyStyle("padding-right", null);
}
sup.apply(this, arguments);
};
})
});