OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
6 Code distributed by Google as part of the polymer project is also | 6 Code distributed by Google as part of the polymer project is also |
7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
8 --> | 8 --> |
9 | 9 |
10 <!-- | 10 <!-- |
(...skipping 24 matching lines...) Expand all Loading... |
35 <core-splitter direction="up"></core-splitter> | 35 <core-splitter direction="up"></core-splitter> |
36 <div flex>bottom</div> | 36 <div flex>bottom</div> |
37 </div> | 37 </div> |
38 | 38 |
39 @group Polymer Core Elements | 39 @group Polymer Core Elements |
40 @element core-splitter | 40 @element core-splitter |
41 @homepage github.io | 41 @homepage github.io |
42 --> | 42 --> |
43 | 43 |
44 <link rel="import" href="../polymer/polymer.html"> | 44 <link rel="import" href="../polymer/polymer.html"> |
| 45 <link rel="import" href="../core-resizable/core-resizable.html"> |
45 | 46 |
46 <polymer-element name="core-splitter" attributes="direction locked minSize allow
Overflow" | 47 <polymer-element name="core-splitter" attributes="direction locked minSize allow
Overflow" |
47 on-trackstart="{{trackStart}}" on-track="{{track}}" on-down="{{preventSelect
ion}}"> | 48 on-trackstart="{{trackStart}}" on-track="{{track}}" on-down="{{preventSelect
ion}}"> |
48 | 49 |
49 <template> | 50 <template> |
50 | 51 |
51 <link rel="stylesheet" href="core-splitter.css"> | 52 <link rel="stylesheet" href="core-splitter.css"> |
52 | 53 |
53 </template> | 54 </template> |
54 <script> | 55 <script> |
55 | 56 |
56 Polymer('core-splitter', { | 57 Polymer(Polymer.mixin({ |
57 | 58 |
58 /** | 59 /** |
59 * Possible values are `left`, `right`, `up` and `down`. | 60 * Possible values are `left`, `right`, `up` and `down`. |
60 * | 61 * |
61 * @attribute direction | 62 * @attribute direction |
62 * @type string | 63 * @type string |
63 * @default 'left' | 64 * @default 'left' |
64 */ | 65 */ |
65 direction: 'left', | 66 direction: 'left', |
66 | 67 |
(...skipping 20 matching lines...) Expand all Loading... |
87 * By default the parent and siblings of the splitter are set to overflow hi
dden. This helps | 88 * By default the parent and siblings of the splitter are set to overflow hi
dden. This helps |
88 * avoid elements bleeding outside the splitter regions. Set this property t
o true to allow | 89 * avoid elements bleeding outside the splitter regions. Set this property t
o true to allow |
89 * these elements to overflow. | 90 * these elements to overflow. |
90 * | 91 * |
91 * @attribute allowOverflow | 92 * @attribute allowOverflow |
92 * @type boolean | 93 * @type boolean |
93 * @default false | 94 * @default false |
94 */ | 95 */ |
95 allowOverflow: false, | 96 allowOverflow: false, |
96 | 97 |
| 98 // Listen for resize requests on parent, since splitter is peer to resizable
s |
| 99 resizerIsPeer: true, |
| 100 |
97 ready: function() { | 101 ready: function() { |
98 this.directionChanged(); | 102 this.directionChanged(); |
99 }, | 103 }, |
100 | 104 |
| 105 attached: function() { |
| 106 this.resizerAttachedHandler(); |
| 107 }, |
| 108 |
| 109 detached: function() { |
| 110 this.resizerDetachedHandler(); |
| 111 }, |
| 112 |
101 domReady: function() { | 113 domReady: function() { |
102 if (!this.allowOverflow) { | 114 if (!this.allowOverflow) { |
103 this.parentNode.style.overflow = this.nextElementSibling.style.overflow
= | 115 this.parentNode.style.overflow = this.nextElementSibling.style.overflow
= |
104 this.previousElementSibling.style.overflow = 'hidden'; | 116 this.previousElementSibling.style.overflow = 'hidden'; |
105 } | 117 } |
106 }, | 118 }, |
107 | 119 |
108 directionChanged: function() { | 120 directionChanged: function() { |
109 this.isNext = this.direction === 'right' || this.direction === 'down'; | 121 this.isNext = this.direction === 'right' || this.direction === 'down'; |
110 this.horizontal = this.direction === 'up' || this.direction === 'down'; | 122 this.horizontal = this.direction === 'up' || this.direction === 'down'; |
(...skipping 19 matching lines...) Expand all Loading... |
130 this.size = parseInt(getComputedStyle(this.target)[this.dimension]); | 142 this.size = parseInt(getComputedStyle(this.target)[this.dimension]); |
131 }, | 143 }, |
132 | 144 |
133 track: function(e) { | 145 track: function(e) { |
134 if (this.locked) { | 146 if (this.locked) { |
135 return; | 147 return; |
136 } | 148 } |
137 var d = e[this.horizontal ? 'dy' : 'dx']; | 149 var d = e[this.horizontal ? 'dy' : 'dx']; |
138 this.target.style[this.dimension] = | 150 this.target.style[this.dimension] = |
139 this.size + (this.isNext ? -d : d) + 'px'; | 151 this.size + (this.isNext ? -d : d) + 'px'; |
| 152 this.notifyResize(); |
140 }, | 153 }, |
141 | 154 |
142 preventSelection: function(e) { | 155 preventSelection: function(e) { |
143 e.preventDefault(); | 156 e.preventDefault(); |
144 } | 157 } |
145 }); | 158 |
| 159 }, Polymer.CoreResizer)); |
146 | 160 |
147 </script> | 161 </script> |
148 </polymer-element> | 162 </polymer-element> |
OLD | NEW |