Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: third_party/polymer/v1_0/components-chromium/paper-drawer-panel/paper-drawer-panel-extracted.js

Issue 1187823002: Update Polymer components and re-run reproduce.sh (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 1
2 2
3 (function() { 3 (function() {
4 4
5 'use strict'; 5 'use strict';
6 6
7 // this would be the only `paper-drawer-panel` in 7 // this would be the only `paper-drawer-panel` in
8 // the whole app that can be in `dragging` state 8 // the whole app that can be in `dragging` state
9 var sharedPanel = null; 9 var sharedPanel = null;
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 disableSwipe: { 67 disableSwipe: {
68 type: Boolean, 68 type: Boolean,
69 value: false 69 value: false
70 }, 70 },
71 71
72 /** 72 /**
73 * Whether the user is dragging the drawer interactively. 73 * Whether the user is dragging the drawer interactively.
74 */ 74 */
75 dragging: { 75 dragging: {
76 type: Boolean, 76 type: Boolean,
77 value: false 77 value: false,
78 readOnly: true,
79 notify: true
78 }, 80 },
79 81
80 /** 82 /**
81 * Width of the drawer panel. 83 * Width of the drawer panel.
82 */ 84 */
83 drawerWidth: { 85 drawerWidth: {
84 type: String, 86 type: String,
85 value: '256px' 87 value: '256px'
86 }, 88 },
87 89
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 }, 125 },
124 126
125 /** 127 /**
126 * Returns true if the panel is in narrow layout. This is useful if you 128 * Returns true if the panel is in narrow layout. This is useful if you
127 * need to show/hide elements based on the layout. 129 * need to show/hide elements based on the layout.
128 */ 130 */
129 narrow: { 131 narrow: {
130 reflectToAttribute: true, 132 reflectToAttribute: true,
131 type: Boolean, 133 type: Boolean,
132 value: false, 134 value: false,
135 readOnly: true,
133 notify: true 136 notify: true
134 }, 137 },
135 138
136 /** 139 /**
137 * Whether the drawer is peeking out from the edge. 140 * Whether the drawer is peeking out from the edge.
138 */ 141 */
139 peeking: { 142 peeking: {
140 type: Boolean, 143 type: Boolean,
141 value: false 144 value: false,
145 readOnly: true,
146 notify: true
142 }, 147 },
143 148
144 /** 149 /**
145 * Max-width when the panel changes to narrow layout. 150 * Max-width when the panel changes to narrow layout.
146 */ 151 */
147 responsiveWidth: { 152 responsiveWidth: {
148 type: String, 153 type: String,
149 value: '640px' 154 value: '640px'
150 }, 155 },
151 156
152 /** 157 /**
153 * If true, position the drawer to the right. 158 * If true, position the drawer to the right.
154 */ 159 */
155 rightDrawer: { 160 rightDrawer: {
156 type: Boolean, 161 type: Boolean,
157 value: false 162 value: false
158 }, 163 },
159 164
160 /** 165 /**
161 * The panel that is being selected. `drawer` for the drawer panel and 166 * The panel that is being selected. `drawer` for the drawer panel and
162 * `main` for the main panel. 167 * `main` for the main panel.
163 */ 168 */
164 selected: { 169 selected: {
165 reflectToAttribute: true, 170 reflectToAttribute: true,
171 notify: true,
166 type: String, 172 type: String,
167 value: null 173 value: null
168 }, 174 },
169 175
170 /** 176 /**
171 * The attribute on elements that should toggle the drawer on tap, also elements will 177 * The attribute on elements that should toggle the drawer on tap, also elements will
172 * automatically be hidden in wide layout. 178 * automatically be hidden in wide layout.
173 */ 179 */
174 drawerToggleAttribute: { 180 drawerToggleAttribute: {
175 type: String, 181 type: String,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 this._trackX(e); 288 this._trackX(e);
283 break; 289 break;
284 case 'end': 290 case 'end':
285 this._trackEnd(e); 291 this._trackEnd(e);
286 break; 292 break;
287 } 293 }
288 294
289 }, 295 },
290 296
291 _responsiveChange: function(narrow) { 297 _responsiveChange: function(narrow) {
292 this.narrow = narrow; 298 this._setNarrow(narrow);
293 299
294 if (this.narrow) { 300 if (this.narrow) {
295 this.selected = this.defaultSelected; 301 this.selected = this.defaultSelected;
296 } 302 }
297 303
298 this.setScrollDirection(this._swipeAllowed() ? 'y' : 'all'); 304 this.setScrollDirection(this._swipeAllowed() ? 'y' : 'all');
299 this.fire('paper-responsive-change', {narrow: this.narrow}); 305 this.fire('paper-responsive-change', {narrow: this.narrow});
300 }, 306 },
301 307
302 _onQueryMatchesChanged: function(e) { 308 _onQueryMatchesChanged: function(e) {
(...skipping 10 matching lines...) Expand all
313 }, 319 },
314 320
315 _isMainSelected: function() { 321 _isMainSelected: function() {
316 return this.selected === 'main'; 322 return this.selected === 'main';
317 }, 323 },
318 324
319 _startEdgePeek: function() { 325 _startEdgePeek: function() {
320 this.width = this.$.drawer.offsetWidth; 326 this.width = this.$.drawer.offsetWidth;
321 this._moveDrawer(this._translateXForDeltaX(this.rightDrawer ? 327 this._moveDrawer(this._translateXForDeltaX(this.rightDrawer ?
322 -this.edgeSwipeSensitivity : this.edgeSwipeSensitivity)); 328 -this.edgeSwipeSensitivity : this.edgeSwipeSensitivity));
323 this.peeking = true; 329 this._setPeeking(true);
324 }, 330 },
325 331
326 _stopEdgePeek: function() { 332 _stopEdgePeek: function() {
327 if (this.peeking) { 333 if (this.peeking) {
328 this.peeking = false; 334 this._setPeeking(false);
329 this._moveDrawer(null); 335 this._moveDrawer(null);
330 } 336 }
331 }, 337 },
332 338
333 _downHandler: function(e) { 339 _downHandler: function(e) {
334 if (!this.dragging && this._isMainSelected() && this._isEdgeTouch(e) && !sharedPanel) { 340 if (!this.dragging && this._isMainSelected() && this._isEdgeTouch(e) && !sharedPanel) {
335 this._startEdgePeek(); 341 this._startEdgePeek();
336 // grab this panel 342 // grab this panel
337 sharedPanel = this; 343 sharedPanel = this;
338 } 344 }
(...skipping 18 matching lines...) Expand all
357 363
358 _isEdgeTouch: function(e) { 364 _isEdgeTouch: function(e) {
359 var x = e.detail.x; 365 var x = e.detail.x;
360 366
361 return !this.disableEdgeSwipe && this._swipeAllowed() && 367 return !this.disableEdgeSwipe && this._swipeAllowed() &&
362 (this.rightDrawer ? 368 (this.rightDrawer ?
363 x >= this.offsetWidth - this.edgeSwipeSensitivity : 369 x >= this.offsetWidth - this.edgeSwipeSensitivity :
364 x <= this.edgeSwipeSensitivity); 370 x <= this.edgeSwipeSensitivity);
365 }, 371 },
366 372
367 _trackStart: function() { 373 _trackStart: function(event) {
368 if (this._swipeAllowed()) { 374 if (this._swipeAllowed()) {
369 sharedPanel = this; 375 sharedPanel = this;
370 this.dragging = true; 376 this._setDragging(true);
371 377
372 if (this._isMainSelected()) { 378 if (this._isMainSelected()) {
373 this.dragging = this.peeking || this._isEdgeTouch(event); 379 this._setDragging(this.peeking || this._isEdgeTouch(event));
374 } 380 }
375 381
376 if (this.dragging) { 382 if (this.dragging) {
377 this.width = this.$.drawer.offsetWidth; 383 this.width = this.$.drawer.offsetWidth;
378 this.transition = false; 384 this.transition = false;
379 } 385 }
380 } 386 }
381 }, 387 },
382 388
383 _translateXForDeltaX: function(deltaX) { 389 _translateXForDeltaX: function(deltaX) {
384 var isMain = this._isMainSelected(); 390 var isMain = this._isMainSelected();
385 391
386 if (this.rightDrawer) { 392 if (this.rightDrawer) {
387 return Math.max(0, isMain ? this.width + deltaX : deltaX); 393 return Math.max(0, isMain ? this.width + deltaX : deltaX);
388 } else { 394 } else {
389 return Math.min(0, isMain ? deltaX - this.width : deltaX); 395 return Math.min(0, isMain ? deltaX - this.width : deltaX);
390 } 396 }
391 }, 397 },
392 398
393 _trackX: function(e) { 399 _trackX: function(e) {
394 if (this.dragging) { 400 if (this.dragging) {
395 var dx = e.detail.dx; 401 var dx = e.detail.dx;
396 402
397 if (this.peeking) { 403 if (this.peeking) {
398 if (Math.abs(dx) <= this.edgeSwipeSensitivity) { 404 if (Math.abs(dx) <= this.edgeSwipeSensitivity) {
399 // Ignore trackx until we move past the edge peek. 405 // Ignore trackx until we move past the edge peek.
400 return; 406 return;
401 } 407 }
402 this.peeking = false; 408 this._setPeeking(false);
403 } 409 }
404 410
405 this._moveDrawer(this._translateXForDeltaX(dx)); 411 this._moveDrawer(this._translateXForDeltaX(dx));
406 } 412 }
407 }, 413 },
408 414
409 _trackEnd: function(e) { 415 _trackEnd: function(e) {
410 if (this.dragging) { 416 if (this.dragging) {
411 var xDirection = e.detail.dx > 0; 417 var xDirection = e.detail.dx > 0;
412 418
413 this.dragging = false; 419 this._setDragging(false);
414 this.transition = true; 420 this.transition = true;
415 sharedPanel = null; 421 sharedPanel = null;
416 this._moveDrawer(null); 422 this._moveDrawer(null);
417 423
418 if (this.rightDrawer) { 424 if (this.rightDrawer) {
419 this[xDirection ? 'closeDrawer' : 'openDrawer'](); 425 this[xDirection ? 'closeDrawer' : 'openDrawer']();
420 } else { 426 } else {
421 this[xDirection ? 'openDrawer' : 'closeDrawer'](); 427 this[xDirection ? 'openDrawer' : 'closeDrawer']();
422 } 428 }
423 } 429 }
(...skipping 15 matching lines...) Expand all
439 s.transform = this._transformForTranslateX(translateX); 445 s.transform = this._transformForTranslateX(translateX);
440 } else { 446 } else {
441 s.webkitTransform = this._transformForTranslateX(translateX); 447 s.webkitTransform = this._transformForTranslateX(translateX);
442 } 448 }
443 } 449 }
444 450
445 }); 451 });
446 452
447 }()); 453 }());
448 454
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698