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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 <link rel="stylesheet" href="core-drawer-panel.css"> | 84 <link rel="stylesheet" href="core-drawer-panel.css"> |
85 | 85 |
86 <core-media-query query="max-width: {{forceNarrow ? '' : responsiveWidth}}" qu
eryMatches="{{queryMatches}}"></core-media-query> | 86 <core-media-query query="max-width: {{forceNarrow ? '' : responsiveWidth}}" qu
eryMatches="{{queryMatches}}"></core-media-query> |
87 | 87 |
88 <core-selector class="{{ {'narrow-layout' : narrow, transition : transition, d
ragging : dragging, 'right-drawer': rightDrawer} | tokenList }}" valueattr="id"
selected="{{selected}}"> | 88 <core-selector class="{{ {'narrow-layout' : narrow, transition : transition, d
ragging : dragging, 'right-drawer': rightDrawer} | tokenList }}" valueattr="id"
selected="{{selected}}"> |
89 | 89 |
90 <div id="main" _style="left: {{ narrow || rightDrawer ? '0' : drawerWidth }}
; right: {{ rightDrawer ? (narrow ? '' : drawerWidth) : '' }};"> | 90 <div id="main" _style="left: {{ narrow || rightDrawer ? '0' : drawerWidth }}
; right: {{ rightDrawer ? (narrow ? '' : drawerWidth) : '' }};"> |
91 <content select="[main]"></content> | 91 <content select="[main]"></content> |
92 <div id="scrim" on-tap="{{togglePanel}}"></div> | 92 <div id="scrim" on-tap="{{togglePanel}}"></div> |
| 93 <div id="edgeSwipeOverlay" hidden?="{{!narrow || disableEdgeSwipe}}"></div
> |
93 </div> | 94 </div> |
94 | 95 |
95 <div id="drawer" _style="width: {{ drawerWidth }}"> | 96 <div id="drawer" _style="width: {{ drawerWidth }}"> |
96 <content select="[drawer]"></content> | 97 <content select="[drawer]"></content> |
97 </div> | 98 </div> |
98 | 99 |
99 </core-selector> | 100 </core-selector> |
100 | 101 |
101 </template> | 102 </template> |
102 <script> | 103 <script> |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 */ | 193 */ |
193 disableSwipe: false, | 194 disableSwipe: false, |
194 | 195 |
195 /** | 196 /** |
196 * If true, ignore `responsiveWidth` setting and force the narrow layout. | 197 * If true, ignore `responsiveWidth` setting and force the narrow layout. |
197 * | 198 * |
198 * @attribute forceNarrow | 199 * @attribute forceNarrow |
199 * @type boolean | 200 * @type boolean |
200 * @default false | 201 * @default false |
201 */ | 202 */ |
202 forceNarrow: false | 203 forceNarrow: false, |
| 204 |
| 205 /** |
| 206 * If true, swipe from the edge is disable. |
| 207 * |
| 208 * @attribute disableEdgeSwipe |
| 209 * @type boolean |
| 210 * @default false |
| 211 */ |
| 212 disableEdgeSwipe: false |
203 }, | 213 }, |
204 | 214 |
205 eventDelegates: { | 215 eventDelegates: { |
206 trackstart: 'trackStart', | 216 trackstart: 'trackStart', |
207 trackx: 'trackx', | 217 trackx: 'trackx', |
208 trackend: 'trackEnd', | 218 trackend: 'trackEnd', |
209 down: 'downHandler', | 219 down: 'downHandler', |
210 up: 'upHandler', | 220 up: 'upHandler', |
211 tap: 'tapHandler' | 221 tap: 'tapHandler' |
212 }, | 222 }, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 }, | 330 }, |
321 | 331 |
322 tapHandler: function(e) { | 332 tapHandler: function(e) { |
323 if (e.target && this.toggleAttribute && | 333 if (e.target && this.toggleAttribute && |
324 e.target.hasAttribute(this.toggleAttribute)) { | 334 e.target.hasAttribute(this.toggleAttribute)) { |
325 this.togglePanel(); | 335 this.togglePanel(); |
326 } | 336 } |
327 }, | 337 }, |
328 | 338 |
329 isEdgeTouch: function(e) { | 339 isEdgeTouch: function(e) { |
330 return this.swipeAllowed() && (this.rightDrawer ? | 340 return !this.disableEdgeSwipe && this.swipeAllowed() && |
331 e.pageX >= this.offsetWidth - this.edgeSwipeSensitivity : | 341 (this.rightDrawer ? |
332 e.pageX <= this.edgeSwipeSensitivity); | 342 e.pageX >= this.offsetWidth - this.edgeSwipeSensitivity : |
| 343 e.pageX <= this.edgeSwipeSensitivity); |
333 }, | 344 }, |
334 | 345 |
335 trackStart : function(e) { | 346 trackStart : function(e) { |
336 if (this.swipeAllowed()) { | 347 if (this.swipeAllowed()) { |
337 this.dragging = true; | 348 this.dragging = true; |
338 | 349 |
339 if (this.isMainSelected()) { | 350 if (this.isMainSelected()) { |
340 this.dragging = this.peeking || this.isEdgeTouch(e); | 351 this.dragging = this.peeking || this.isEdgeTouch(e); |
341 } | 352 } |
342 | 353 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 s.transform = this.transformForTranslateX(translateX); | 409 s.transform = this.transformForTranslateX(translateX); |
399 } else { | 410 } else { |
400 s.webkitTransform = this.transformForTranslateX(translateX); | 411 s.webkitTransform = this.transformForTranslateX(translateX); |
401 } | 412 } |
402 } | 413 } |
403 | 414 |
404 }); | 415 }); |
405 | 416 |
406 </script> | 417 </script> |
407 </polymer-element> | 418 </polymer-element> |
OLD | NEW |