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 'neon-animation-finish': '_onAnimationFinished'
80 _onAnimationFinished: function() {
81 this.style
.transform
= this.opened
? 'none' : 'translateY(-100%)';
84 loadProgressChanged: function() {
85 if (this.loadProgress
>= 100) {
86 this.$.title
.classList
.toggle('invisible', false);
87 this.$.pageselector
.classList
.toggle('invisible', false);
88 this.$.buttons
.classList
.toggle('invisible', false);
94 this.toggleVisibility();
99 this.toggleVisibility();
103 toggleVisibility: function() {
104 this.opened
= !this.opened
;
105 this.cancelAnimation();
106 this.playAnimation(this.opened
? 'entry' : 'exit');
109 selectPageNumber: function() {
110 this.$.pageselector
.select();
113 shouldKeepOpen: function() {
114 return this.$.bookmarks
.dropdownOpen
|| this.loadProgress
< 100 ||
115 this.$.pageselector
.isActive();
118 hideDropdowns: function() {
119 if (this.$.bookmarks
.dropdownOpen
) {
120 this.$.bookmarks
.toggleDropdown();
126 setDropdownLowerBound: function(lowerBound
) {
127 this.$.bookmarks
.lowerBound
= lowerBound
;
130 rotateLeft: function() {
131 this.fire('rotate-left');
134 rotateRight: function() {
135 this.fire('rotate-right');