| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 // Copyright 2015 The Chromium Authors. All rights reserved. | 2 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 --> | 5 --> |
| 6 <import src="sky-element.sky" /> | 6 <import src="sky-element.sky" /> |
| 7 <import src="sky-scrollable.sky" /> | 7 <import src="sky-scrollable.sky" /> |
| 8 | 8 |
| 9 <sky-element> | 9 <sky-element> |
| 10 <template> | 10 <template> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 _animation = new AnimationController(this); | 57 _animation = new AnimationController(this); |
| 58 | 58 |
| 59 addEventListener('pointerdown', _handlePointerDown); | 59 addEventListener('pointerdown', _handlePointerDown); |
| 60 addEventListener('pointermove', _handlePointerMove); | 60 addEventListener('pointermove', _handlePointerMove); |
| 61 addEventListener('pointerup', _handlePointerUp); | 61 addEventListener('pointerup', _handlePointerUp); |
| 62 addEventListener('pointercancel', _handlePointerCancel); | 62 addEventListener('pointercancel', _handlePointerCancel); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void shadowRootReady() { | 65 void shadowRootReady() { |
| 66 _mask = shadowRoot.getElementById('mask'); | 66 _mask = shadowRoot.getElementById('mask'); |
| 67 _mask.addEventListener('click', _handleMaskClick); | 67 _mask.addEventListener('gesturetap', _handleMaskTap); |
| 68 _content = shadowRoot.getElementById('content'); | 68 _content = shadowRoot.getElementById('content'); |
| 69 _content.addEventListener('gestureflingstart', _handleFlingStart); | 69 _content.addEventListener('gestureflingstart', _handleFlingStart); |
| 70 position = -_kWidth; | 70 position = -_kWidth; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void toggle() { | 73 void toggle() { |
| 74 if (isMostlyClosed) | 74 if (isMostlyClosed) |
| 75 open(); | 75 open(); |
| 76 else | 76 else |
| 77 close(); | 77 close(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 begin: currentPosition, | 112 begin: currentPosition, |
| 113 end: targetPosition, | 113 end: targetPosition, |
| 114 duration: math.max(_kMinAnimationDurationMS, duration), | 114 duration: math.max(_kMinAnimationDurationMS, duration), |
| 115 curve: _kAnimationCurve); | 115 curve: _kAnimationCurve); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void updateAnimation(double p) { | 118 void updateAnimation(double p) { |
| 119 position = p; | 119 position = p; |
| 120 } | 120 } |
| 121 | 121 |
| 122 void _handleMaskClick(_) { | 122 void _handleMaskTap(_) { |
| 123 close(); | 123 close(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void _handlePointerDown(_) { | 126 void _handlePointerDown(_) { |
| 127 _animation.stop(); | 127 _animation.stop(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void _handlePointerMove(PointerEvent event) { | 130 void _handlePointerMove(PointerEvent event) { |
| 131 position += event.dx; | 131 position += event.dx; |
| 132 } | 132 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 154 begin: currentPosition, | 154 begin: currentPosition, |
| 155 end: targetPosition, | 155 end: targetPosition, |
| 156 duration: duration, | 156 duration: duration, |
| 157 curve: linear); | 157 curve: linear); |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 _init(script) => register(script, SkyDrawer); | 161 _init(script) => register(script, SkyDrawer); |
| 162 </script> | 162 </script> |
| 163 </sky-element> | 163 </sky-element> |
| OLD | NEW |