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

Side by Side Diff: third_party/polymer/v1_0/components-chromium/app-layout/app-scrollpos-control/app-scrollpos-control-extracted.js

Issue 2633633002: Polymer: Remove unused app-layout element (Closed)
Patch Set: Fix closure Created 3 years, 11 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
(Empty)
1 Polymer({
2 is: 'app-scrollpos-control',
3
4 properties: {
5 /**
6 * The selected page.
7 */
8 selected: {
9 type: String,
10 observer: '_selectedChanged'
11 },
12
13 /**
14 * Reset the scroll position to 0.
15 */
16 reset: {
17 type: Boolean,
18 value: false
19 }
20 },
21
22 observers: [
23 '_updateScrollPos(selected, reset)'
24 ],
25
26 created: function() {
27 this._scrollposMap = {};
28 },
29
30 _selectedChanged: function(selected, old) {
31 if (old != null) {
32 this._scrollposMap[old] = {x: window.pageXOffset, y: window.pageYOffse t};
33 }
34 },
35
36 _updateScrollPos: function(selected, reset) {
37 this.debounce('_updateScrollPos', function() {
38 var pos = this._scrollposMap[this.selected];
39 if (pos != null && !this.reset) {
40 this._scrollTo(pos.x, pos.y);
41 } else {
42 this._scrollTo(0, 0);
43 }
44 });
45 },
46
47 _scrollTo: function(x, y) {
48 Polymer.AppLayout.scroll({
49 left: x,
50 top: y,
51 behavior: 'silent'
52 });
53 }
54 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698