| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Holds a number of child views. As you switch between views, the old | 6 * Holds a number of child views. As you switch between views, the old |
| 7 * view is pushed off to the side and the new view slides in from the other | 7 * view is pushed off to the side and the new view slides in from the other |
| 8 * side. | 8 * side. |
| 9 */ | 9 */ |
| 10 class ConveyorView extends CompositeView { | 10 class ConveyorView extends CompositeView { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 void adjustOffset(bool animate) { | 51 void adjustOffset(bool animate) { |
| 52 int index = getIndexOfSelectedView(); | 52 int index = getIndexOfSelectedView(); |
| 53 final durationSeconds = animate ? ANIMATE_SECONDS : 0.0; | 53 final durationSeconds = animate ? ANIMATE_SECONDS : 0.0; |
| 54 | 54 |
| 55 final style = container.style; | 55 final style = container.style; |
| 56 // TODO(jacobr): modify setTransitionDuration so the input is always | 56 // TODO(jacobr): modify setTransitionDuration so the input is always |
| 57 // specified in miliseconds rather than accepting a string. | 57 // specified in miliseconds rather than accepting a string. |
| 58 Css.setTransitionDuration(style, '${durationSeconds}s'); | 58 style.transitionDuration = '${durationSeconds}s'; |
| 59 final xTranslationPercent = -index * 100; | 59 final xTranslationPercent = -index * 100; |
| 60 Css.setTransform(style, 'translate3d(${xTranslationPercent}%, 0px, 0px)'); | 60 style.transform = 'translate3d(${xTranslationPercent}%, 0px, 0px)'; |
| 61 | 61 |
| 62 if (animationTimeoutId != null) { | 62 if (animationTimeoutId != null) { |
| 63 window.clearTimeout(animationTimeoutId); | 63 window.clearTimeout(animationTimeoutId); |
| 64 } | 64 } |
| 65 | 65 |
| 66 if (animate) { | 66 if (animate) { |
| 67 animationTimeoutId = window.setTimeout( | 67 animationTimeoutId = window.setTimeout( |
| 68 () { _onAnimationEnd(); }, (durationSeconds * 1000).toInt()); | 68 () { _onAnimationEnd(); }, (durationSeconds * 1000).toInt()); |
| 69 } | 69 } |
| 70 // TODO(mattsh), we should set the visibility to hide everything but the | 70 // TODO(mattsh), we should set the visibility to hide everything but the |
| (...skipping 18 matching lines...) Expand all Loading... |
| 89 view.transform = 'translate3d(' + (childViews.length * 100) + '%, 0, 0)'; | 89 view.transform = 'translate3d(' + (childViews.length * 100) + '%, 0, 0)'; |
| 90 return super.addChild(view); | 90 return super.addChild(view); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void _onAnimationEnd() { | 93 void _onAnimationEnd() { |
| 94 if (viewSelected != null) { | 94 if (viewSelected != null) { |
| 95 viewSelected(selectedView); | 95 viewSelected(selectedView); |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 } | 98 } |
| OLD | NEW |