| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 (function() { | 4 (function() { |
| 5 Polymer({ | 5 Polymer({ |
| 6 is: 'viewer-pdf-toolbar', | 6 is: 'viewer-pdf-toolbar', |
| 7 | 7 |
| 8 behaviors: [ | 8 behaviors: [Polymer.NeonAnimationRunnerBehavior], |
| 9 Polymer.NeonAnimationRunnerBehavior | |
| 10 ], | |
| 11 | 9 |
| 12 properties: { | 10 properties: { |
| 13 /** | 11 /** |
| 14 * The current loading progress of the PDF document (0 - 100). | 12 * The current loading progress of the PDF document (0 - 100). |
| 15 */ | 13 */ |
| 16 loadProgress: { | 14 loadProgress: {type: Number, observer: 'loadProgressChanged'}, |
| 17 type: Number, | |
| 18 observer: 'loadProgressChanged' | |
| 19 }, | |
| 20 | 15 |
| 21 /** | 16 /** |
| 22 * The title of the PDF document. | 17 * The title of the PDF document. |
| 23 */ | 18 */ |
| 24 docTitle: String, | 19 docTitle: String, |
| 25 | 20 |
| 26 /** | 21 /** |
| 27 * The number of the page being viewed (1-based). | 22 * The number of the page being viewed (1-based). |
| 28 */ | 23 */ |
| 29 pageNo: Number, | 24 pageNo: Number, |
| 30 | 25 |
| 31 /** | 26 /** |
| 32 * Tree of PDF bookmarks (or null if the document has no bookmarks). | 27 * Tree of PDF bookmarks (or null if the document has no bookmarks). |
| 33 */ | 28 */ |
| 34 bookmarks: { | 29 bookmarks: {type: Object, value: null}, |
| 35 type: Object, | |
| 36 value: null | |
| 37 }, | |
| 38 | 30 |
| 39 /** | 31 /** |
| 40 * The number of pages in the PDF document. | 32 * The number of pages in the PDF document. |
| 41 */ | 33 */ |
| 42 docLength: Number, | 34 docLength: Number, |
| 43 | 35 |
| 44 /** | 36 /** |
| 45 * Whether the toolbar is opened and visible. | 37 * Whether the toolbar is opened and visible. |
| 46 */ | 38 */ |
| 47 opened: { | 39 opened: {type: Boolean, value: true}, |
| 48 type: Boolean, | |
| 49 value: true | |
| 50 }, | |
| 51 | 40 |
| 52 strings: Object, | 41 strings: Object, |
| 53 | 42 |
| 54 animationConfig: { | 43 animationConfig: { |
| 55 value: function() { | 44 value: function() { |
| 56 return { | 45 return { |
| 57 'entry': { | 46 'entry': { |
| 58 name: 'transform-animation', | 47 name: 'transform-animation', |
| 59 node: this, | 48 node: this, |
| 60 transformFrom: 'translateY(-100%)', | 49 transformFrom: 'translateY(-100%)', |
| 61 transformTo: 'translateY(0%)', | 50 transformTo: 'translateY(0%)', |
| 62 timing: { | 51 timing: {easing: 'cubic-bezier(0, 0, 0.2, 1)', duration: 250} |
| 63 easing: 'cubic-bezier(0, 0, 0.2, 1)', | |
| 64 duration: 250 | |
| 65 } | |
| 66 }, | 52 }, |
| 67 'exit': { | 53 'exit': { |
| 68 name: 'slide-up-animation', | 54 name: 'slide-up-animation', |
| 69 node: this, | 55 node: this, |
| 70 timing: { | 56 timing: {easing: 'cubic-bezier(0.4, 0, 1, 1)', duration: 250} |
| 71 easing: 'cubic-bezier(0.4, 0, 1, 1)', | |
| 72 duration: 250 | |
| 73 } | |
| 74 } | 57 } |
| 75 }; | 58 }; |
| 76 } | 59 } |
| 77 } | 60 } |
| 78 }, | 61 }, |
| 79 | 62 |
| 80 listeners: { | 63 listeners: {'neon-animation-finish': '_onAnimationFinished'}, |
| 81 'neon-animation-finish': '_onAnimationFinished' | |
| 82 }, | |
| 83 | 64 |
| 84 _onAnimationFinished: function() { | 65 _onAnimationFinished: function() { |
| 85 this.style.transform = this.opened ? 'none' : 'translateY(-100%)'; | 66 this.style.transform = this.opened ? 'none' : 'translateY(-100%)'; |
| 86 }, | 67 }, |
| 87 | 68 |
| 88 loadProgressChanged: function() { | 69 loadProgressChanged: function() { |
| 89 if (this.loadProgress >= 100) { | 70 if (this.loadProgress >= 100) { |
| 90 this.$.pageselector.classList.toggle('invisible', false); | 71 this.$.pageselector.classList.toggle('invisible', false); |
| 91 this.$.buttons.classList.toggle('invisible', false); | 72 this.$.buttons.classList.toggle('invisible', false); |
| 92 this.$.progress.style.opacity = 0; | 73 this.$.progress.style.opacity = 0; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 118 |
| 138 download: function() { | 119 download: function() { |
| 139 this.fire('save'); | 120 this.fire('save'); |
| 140 }, | 121 }, |
| 141 | 122 |
| 142 print: function() { | 123 print: function() { |
| 143 this.fire('print'); | 124 this.fire('print'); |
| 144 } | 125 } |
| 145 }); | 126 }); |
| 146 })(); | 127 })(); |
| OLD | NEW |