| OLD | NEW |
| (Empty) |
| 1 | |
| 2 | |
| 3 (function() { | |
| 4 | |
| 5 Polymer({ | |
| 6 | |
| 7 is: 'paper-dialog-scrollable', | |
| 8 | |
| 9 properties: { | |
| 10 | |
| 11 /** | |
| 12 * The dialog element that implements `Polymer.PaperDialogBehavior` contai
ning this element. | |
| 13 */ | |
| 14 dialogElement: { | |
| 15 type: Object, | |
| 16 value: function() { | |
| 17 return this.parentNode; | |
| 18 } | |
| 19 } | |
| 20 | |
| 21 }, | |
| 22 | |
| 23 listeners: { | |
| 24 'scrollable.scroll': '_onScroll', | |
| 25 'iron-resize': '_onIronResize' | |
| 26 }, | |
| 27 | |
| 28 /** | |
| 29 * Returns the scrolling element. | |
| 30 */ | |
| 31 get scrollTarget() { | |
| 32 return this.$.scrollable; | |
| 33 }, | |
| 34 | |
| 35 attached: function() { | |
| 36 this.classList.add('no-padding'); | |
| 37 // Set itself to the overlay sizing target | |
| 38 this.dialogElement.sizingTarget = this.scrollTarget; | |
| 39 // If the host is sized, fit the scrollable area to the container. Otherwi
se let it be | |
| 40 // its natural size. | |
| 41 requestAnimationFrame(function() { | |
| 42 if (this.offsetHeight > 0) { | |
| 43 this.$.scrollable.classList.add('fit'); | |
| 44 } | |
| 45 this._scroll(); | |
| 46 }.bind(this)); | |
| 47 }, | |
| 48 | |
| 49 _scroll: function() { | |
| 50 this.toggleClass('is-scrolled', this.scrollTarget.scrollTop > 0); | |
| 51 this.toggleClass('can-scroll', this.scrollTarget.offsetHeight < this.scrol
lTarget.scrollHeight); | |
| 52 this.toggleClass('scrolled-to-bottom', | |
| 53 this.scrollTarget.scrollTop + this.scrollTarget.offsetHeight >= this.scr
ollTarget.scrollHeight); | |
| 54 }, | |
| 55 | |
| 56 _onScroll: function() { | |
| 57 this._scroll(); | |
| 58 } | |
| 59 | |
| 60 }) | |
| 61 | |
| 62 })(); | |
| 63 | |
| OLD | NEW |