|
11 | 11 | * `<polymer-layout>` arranges nodes horizontally via absolution positioning. |
12 | 12 | * Set the `vertical` attribute (boolean) to arrange vertically instead. |
13 | 13 | * |
| 14 | + * `<polymer-layout>` arranges it's <b>sibling elements</b>, not |
| 15 | + * it's children. |
| 16 | + * |
14 | 17 | * One arranged node may be marked as elastic by giving it a `flex` |
15 | 18 | * attribute (boolean). |
16 | | - |
17 | | - * `<polymer-layout>` arranges it's sibling elements, not |
18 | | - * it's children. |
19 | 19 | * |
20 | | - * Padding on the parent node is ignored. |
21 | | - * Margin on arranged nodes is ignored. |
| 20 | + * You may remove a node from layout by giving it a `nolayout` |
| 21 | + * attribute (boolean). |
| 22 | + * |
| 23 | + * CSS Notes: |
22 | 24 | * |
23 | | - * Example: |
| 25 | + * * `padding` is ignored on the parent node. |
| 26 | + * * `margin` is ignored on arranged nodes. |
| 27 | + * * `min-width` is ignored on arranged nodes, use `min-width` on the parent node |
| 28 | + * instead. |
24 | 29 | * |
25 | | - * // arrange divs into columns |
26 | | - * // `flex` attribute on Column Two |
27 | | - * // makes that column elastic |
| 30 | + * Example: |
28 | 31 | * |
29 | | - * <polymer-layout><polymer-layout> |
30 | | - * <div>Column One</div> |
31 | | - * <div flex>Column Two</div> |
32 | | - * <div>Column Three</div> |
| 32 | + * Arrange three `div` into columns. `flex` attribute on Column Two makes that |
| 33 | + * column elastic. |
33 | 34 | * |
34 | | - * ---------------------------------------------------- |
35 | | - * |--------------------------------------------------| |
36 | | - * ||Column One|-------Column Two-------|Column Three|| |
37 | | - * |--------------------------------------------------| |
38 | | - * ---------------------------------------------------- |
| 35 | + * <polymer-layout></polymer-layout> |
| 36 | + * <div>Column One</div> |
| 37 | + * <div flex>Column Two</div> |
| 38 | + * <div>Column Three</div> |
| 39 | + * |
| 40 | + * Remember that `<polymer-layout>` arranges it's sibling elements, not it's children. |
39 | 41 | * |
40 | 42 | * If body has width 52 device pixels (in this case, ascii characters), call that 52px. |
41 | 43 | * Column One has it's natural width of 12px (including border), Column Three has it's |
42 | 44 | * natural width of 14px, body border uses 2px, and Column Two automatically uses the |
43 | 45 | * remaining space: 24px. |
44 | 46 | * |
| 47 | + * |- 52px -| |
| 48 | + * ---------------------------------------------------- |
| 49 | + * ||Column One|| Column Two ||Column Three|| |
| 50 | + * ---------------------------------------------------- |
| 51 | + * |- 12px -||- (24px) -|| 14px -| |
| 52 | + * |
45 | 53 | * As the parent node resizes, the elastic column reacts via CSS to adjust it's size. |
46 | | - * No javascript is used so the performance is generally ideal. |
| 54 | + * No javascript is used during parent resizing, for best performance. |
| 55 | + * |
| 56 | + * Changes in content or sibling size is not handled automatically. |
47 | 57 | * |
48 | 58 | * -------------------------------------------------------------------------- |
49 | | - * |------------------------------------------------------------------------| |
50 | | - * ||Column One|------------------Column Two------------------|Column Three|| |
51 | | - * |------------------------------------------------------------------------| |
| 59 | + * ||Column One| Column Two |Column Three|| |
52 | 60 | * -------------------------------------------------------------------------- |
53 | 61 | * |
54 | | - * ----------------------------------- ---- |
55 | | - * |--------------------------------------| |
56 | | - * ||Column One|-Column Two-|Column Three|| |
57 | | - * |--------------------------------------| |
58 | | - * ---------------------------------------- |
| 62 | + * -------------------------------------- |
| 63 | + * ||Column One|Column Two|Column Three|| |
| 64 | + * -------------------------------------- |
59 | 65 | * |
60 | 66 | * Arrange in rows by adding the `vertical` attribute. |
61 | 67 | * |
62 | 68 | * Example: |
63 | 69 | * |
64 | | - * // arrange divs into rows |
65 | | - * |
66 | | - * <polymer-layout vertical><polymer-layout> |
67 | | - * <div>Row One</div> |
68 | | - * <div flex>Row Two</div> |
69 | | - * <div>Row Three</div> |
70 | | - * |
71 | | - * ------------- ------------- |
72 | | - * ||---------|| ||---------|| |
73 | | - * ||Row One || ||Row One || |
74 | | - * ||---------|| ||---------|| |
75 | | - * ||Row Two || ||Row Two || |
76 | | - * ||---------|| || || |
77 | | - * ||Row Three|| || || |
78 | | - * ||---------|| || || |
79 | | - * ------------- || || |
80 | | - * || || |
81 | | - * || || |
82 | | - * ||---------|| |
83 | | - * ||Row Three|| |
84 | | - * ||---------|| |
85 | | - * ------------- |
| 70 | + * <polymer-layout vertical></polymer-layout> |
| 71 | + * <div>Row One</div> |
| 72 | + * <div flex>Row Two</div> |
| 73 | + * <div>Row Three</div> |
| 74 | + * |
| 75 | + * This setup will cause Row Two to stretch to fill the container. |
| 76 | + * |
| 77 | + * ----------- ----------- |
| 78 | + * |---------| |---------| |
| 79 | + * | | | | |
| 80 | + * |Row One | |Row One | |
| 81 | + * | | | | |
| 82 | + * |---------| |---------| |
| 83 | + * | | | | |
| 84 | + * |Row Two | |Row Two | |
| 85 | + * | | | | |
| 86 | + * |---------| | | |
| 87 | + * | | | | |
| 88 | + * |Row Three| | | |
| 89 | + * | | |---------| |
| 90 | + * |---------| | | |
| 91 | + * ----------- |Row Three| |
| 92 | + * | | |
| 93 | + * |---------| |
| 94 | + * |---------| |
86 | 95 | * |
87 | 96 | * Layouts can be nested arbitrarily. |
88 | 97 | * |
89 | | - * <polymer-layout><polymer-layout> |
90 | | - * <div>Menu</div> |
91 | | - * <div flex> |
92 | | - * <polymer-layout vertical><polymer-layout> |
93 | | - * <div>Title</div> |
94 | | - * <div>Toolbar</div> |
95 | | - * <div>Main</div> |
96 | | - * <div>Footer</div> |
97 | | - * </div> |
98 | | - * |
99 | | - * -------------------------------- |
100 | | - * |-----------------------------|| |
101 | | - * ||Menu ||Title || |
102 | | - * || ||-----------------|| |
103 | | - * || ||Toolbar || |
104 | | - * || ||-----------------|| |
105 | | - * || ||Main || |
106 | | - * || || || |
107 | | - * || || || |
108 | | - * || ||-----------------|| |
109 | | - * || ||Footer || |
110 | | - * || ||-----------------|| |
111 | | - * -------------------------------- |
| 98 | + * <polymer-layout></polymer-layout> |
| 99 | + * <div>Menu</div> |
| 100 | + * <div flex> |
| 101 | + * <polymer-layout vertical></polymer-layout> |
| 102 | + * <div>Title</div> |
| 103 | + * <div>Toolbar</div> |
| 104 | + * <div flex>Main</div> |
| 105 | + * <div>Footer</div> |
| 106 | + * </div> |
| 107 | + * |
| 108 | + * Renders something like this |
| 109 | + * |
| 110 | + * -------------------------------- |
| 111 | + * ||Menu ||Title || |
| 112 | + * || ||-----------------|| |
| 113 | + * || ||Toolbar || |
| 114 | + * || ||-----------------|| |
| 115 | + * || ||Main || |
| 116 | + * || || || |
| 117 | + * || ||-----------------|| |
| 118 | + * || ||Footer || |
| 119 | + * -------------------------------- |
112 | 120 | * |
113 | 121 | * @class polymer-layout |
114 | 122 | * |
|
143 | 151 | if (cs.position === 'static') { |
144 | 152 | parent.style.position = 'relative'; |
145 | 153 | } |
146 | | - parent.style.overflow = 'hidden'; |
| 154 | + //parent.style.overflow = 'hidden'; |
147 | 155 | // changes will cause another recalc at next validation step |
148 | 156 | var vertical; |
149 | 157 | this.parentNode.childNodes.forEach(function(c, i) { |
|
0 commit comments