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="shadow.sky" as="shadow" /> |
6 <import src="sky-element.sky" /> | 7 <import src="sky-element.sky" /> |
7 <import src="sky-scrollable.sky" /> | 8 <import src="sky-scrollable.sky" /> |
8 | 9 |
9 <sky-element> | 10 <sky-element attributes="level:number"> |
10 <template> | 11 <template> |
11 <style> | 12 <style> |
12 #mask { | 13 #mask { |
13 background-color: black; | 14 background-color: black; |
14 will-change: opacity; | 15 will-change: opacity; |
15 position: absolute; | 16 position: absolute; |
16 top: 0; | 17 top: 0; |
17 left: 0; | 18 left: 0; |
18 bottom: 0; | 19 bottom: 0; |
19 right: 0; | 20 right: 0; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 SkyDrawer() { | 57 SkyDrawer() { |
57 _animation = new AnimationController(this); | 58 _animation = new AnimationController(this); |
58 | 59 |
59 addEventListener('pointerdown', _handlePointerDown); | 60 addEventListener('pointerdown', _handlePointerDown); |
60 addEventListener('pointermove', _handlePointerMove); | 61 addEventListener('pointermove', _handlePointerMove); |
61 addEventListener('pointerup', _handlePointerUp); | 62 addEventListener('pointerup', _handlePointerUp); |
62 addEventListener('pointercancel', _handlePointerCancel); | 63 addEventListener('pointercancel', _handlePointerCancel); |
63 } | 64 } |
64 | 65 |
65 void shadowRootReady() { | 66 void shadowRootReady() { |
| 67 shadow.applyTo(shadowRoot); |
66 _mask = shadowRoot.getElementById('mask'); | 68 _mask = shadowRoot.getElementById('mask'); |
67 _mask.addEventListener('gesturetap', _handleMaskTap); | 69 _mask.addEventListener('gesturetap', _handleMaskTap); |
68 _content = shadowRoot.getElementById('content'); | 70 _content = shadowRoot.getElementById('content'); |
69 _content.addEventListener('gestureflingstart', _handleFlingStart); | 71 _content.addEventListener('gestureflingstart', _handleFlingStart); |
70 position = -_kWidth; | 72 position = -_kWidth; |
71 } | 73 } |
72 | 74 |
73 void toggle() { | 75 void toggle() { |
74 if (isMostlyClosed) | 76 if (isMostlyClosed) |
75 open(); | 77 open(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 begin: currentPosition, | 156 begin: currentPosition, |
155 end: targetPosition, | 157 end: targetPosition, |
156 duration: duration, | 158 duration: duration, |
157 curve: linear); | 159 curve: linear); |
158 } | 160 } |
159 } | 161 } |
160 | 162 |
161 _init(script) => register(script, SkyDrawer); | 163 _init(script) => register(script, SkyDrawer); |
162 </script> | 164 </script> |
163 </sky-element> | 165 </sky-element> |
OLD | NEW |