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
3 // found in the LICENSE file.
6 is
: 'viewer-pdf-toolbar',
9 Polymer
.NeonAnimationRunnerBehavior
14 * The current loading progress of the PDF document (0 - 100).
18 observer
: 'loadProgressChanged'
22 * The title of the PDF document.
27 * The number of the page being viewed (1-based).
32 * Tree of PDF bookmarks (or null if the document has no bookmarks).
40 * The number of pages in the PDF document.
45 * Whether the toolbar is opened and visible.
56 name
: 'slide-down-animation',
59 easing
: 'cubic-bezier(0, 0, 0.2, 1)',
64 name
: 'slide-up-animation',
67 easing
: 'cubic-bezier(0.4, 0, 1, 1)',
77 hidden
: true // Toolbars are explicitly shown once the plugin is ready.
81 'neon-animation-finish': '_onAnimationFinished'
84 _onAnimationFinished: function() {
85 this.style
.transform
= this.opened
? 'none' : 'translateY(-100%)';
88 loadProgressChanged: function() {
89 if (this.loadProgress
>= 100) {
90 this.$.title
.classList
.toggle('invisible', false);
91 this.$.pageselector
.classList
.toggle('invisible', false);
92 this.$.buttons
.classList
.toggle('invisible', false);
98 this.toggleVisibility();
103 this.toggleVisibility();
107 toggleVisibility: function() {
108 this.opened
= !this.opened
;
109 this.cancelAnimation();
110 this.playAnimation(this.opened
? 'entry' : 'exit');
113 selectPageNumber: function() {
114 this.$.pageselector
.select();
117 shouldKeepOpen: function() {
118 return this.$.bookmarks
.dropdownOpen
|| this.loadProgress
< 100 ||
119 this.$.pageselector
.isActive();
122 hideDropdowns: function() {
123 if (this.$.bookmarks
.dropdownOpen
) {
124 this.$.bookmarks
.toggleDropdown();
130 setDropdownLowerBound: function(lowerBound
) {
131 this.$.bookmarks
.lowerBound
= lowerBound
;
134 rotateLeft: function() {
135 this.fire('rotate-left');
138 rotateRight: function() {
139 this.fire('rotate-right');