OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Card slider implementation. Allows you to create interactions | 6 * @fileoverview Card slider implementation. Allows you to create interactions |
7 * that have items that can slide left to right to reveal additional items. | 7 * that have items that can slide left to right to reveal additional items. |
8 * Works by adding the necessary event handlers to a specific DOM structure | 8 * Works by adding the necessary event handlers to a specific DOM structure |
9 * including a frame, container and cards. | 9 * including a frame, container and cards. |
10 * - The frame defines the boundary of one item. Each card will be expanded to | 10 * - The frame defines the boundary of one item. Each card will be expanded to |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 214 |
215 /** | 215 /** |
216 * Returns the current card itself. | 216 * Returns the current card itself. |
217 * @return {!Element} the currently shown card. | 217 * @return {!Element} the currently shown card. |
218 */ | 218 */ |
219 get currentCardValue() { | 219 get currentCardValue() { |
220 return this.cards_[this.currentCard_]; | 220 return this.cards_[this.currentCard_]; |
221 }, | 221 }, |
222 | 222 |
223 /** | 223 /** |
| 224 * Returns the frame holding the cards. |
| 225 * @return {Element} The frame used to position the cards. |
| 226 */ |
| 227 get frame() { |
| 228 return this.frame_; |
| 229 }, |
| 230 |
| 231 /** |
224 * Handle horizontal scrolls to flip between pages. | 232 * Handle horizontal scrolls to flip between pages. |
225 * @private | 233 * @private |
226 */ | 234 */ |
227 onMouseWheel_: function(e) { | 235 onMouseWheel_: function(e) { |
228 if (e.wheelDeltaX == 0) | 236 if (e.wheelDeltaX == 0) |
229 return; | 237 return; |
230 | 238 |
231 // Prevent OS X 10.7+ history swiping on the NTP. | 239 // Prevent OS X 10.7+ history swiping on the NTP. |
232 e.preventDefault(); | 240 e.preventDefault(); |
233 | 241 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 | 606 |
599 // Ensure we're at a card bounary | 607 // Ensure we're at a card bounary |
600 this.transformToCurrentCard_(true); | 608 this.transformToCurrentCard_(true); |
601 }, | 609 }, |
602 }; | 610 }; |
603 | 611 |
604 return { | 612 return { |
605 CardSlider: CardSlider | 613 CardSlider: CardSlider |
606 }; | 614 }; |
607 }); | 615 }); |
OLD | NEW |