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.
7 * core-meta object used to determine type of transition used.
9 var meta
= document
.createElement('core-meta');
10 meta
.type
= 'transition';
14 * Sets up, starts and destroys the transition used.
15 * This has no state and therefore is OK to make global.
19 Polymer('viewer-pdf-toolbar', {
22 * The title of the PDF document.
28 * The current index of the page being viewed (0-based).
34 * The current loading progress of the PDF document (0 - 100).
40 * Whether the document has bookmarks.
46 * The number of pages in the PDF document.
51 // We cannot initialise transition before ensuring that core-meta has been
53 if (transition
=== undefined)
54 transition
= meta
.byId('core-transition-top');
55 transition
.setup(this.$.animatable
);
59 * Used in core-transition to determine whether the animatable is open.
61 this.state_
= { opened
: false };
65 loadProgressChanged: function() {
66 if (this.loadProgress
>= 100) {
67 this.$.title
.classList
.toggle('invisible', false);
68 this.$.pageselector
.classList
.toggle('invisible', false);
69 this.$.buttons
.classList
.toggle('invisible', false);
74 if (this.state_
.opened
)
75 this.toggleVisibility();
79 if (!this.state_
.opened
)
80 this.toggleVisibility();
83 toggleVisibility: function() {
84 this.state_
.opened
= !this.state_
.opened
;
85 transition
.go(this.$.animatable
, this.state_
);
88 selectPageNumber: function() {
89 this.$.pageselector
.select();
92 rotateRight: function() {
93 this.fire('rotate-right');
96 toggleBookmarks: function() {
97 this.fire('toggle-bookmarks');