-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathFittableHeaderLayout.js
59 lines (51 loc) · 1.67 KB
/
FittableHeaderLayout.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* Contains the declaration for the {@link module:layout/FittableHeaderLayout~FittableHeaderLayout} kind.
* @module layout/FittableHeaderLayout
*/
var
kind = require('enyo/kind');
var
FittableLayout = require('./FittableLayout'),
FittableColumnsLayout = FittableLayout.Columns;
/**
* {@link module:layout/FittableHeaderLayout~FittableHeaderLayout} extends {@link module:layout/FittableLayout~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]{@linkplain $dev-guide/building-apps/layout/fittables.html} in the
* Enyo Developer Guide.
*
* @class FittableHeaderLayout
* @extends module:layout/FittableColumnsLayout~FittableColumnsLayout
* @public
*/
module.exports = kind(/** @lends module:layout/FittableHeaderLayout~FittableHeaderLayout.prototype */{
/**
* @private
*/
name: 'enyo.FittableHeaderLayout',
/**
* @private
*/
kind: FittableColumnsLayout,
/**
* @private
*/
applyFitSize: 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);
}
FittableColumnsLayout.prototype.applyFitSize.apply(this, arguments);
}
});