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.
5 var DIGIT_LENGTH = 0.6;
8 is: 'viewer-page-selector',
12 * The number of pages the document contains.
17 observer: 'docLengthChanged'
21 * The current page being viewed (1-based).
29 pageNoCommitted: function() {
30 var page = parseInt(this.pageNo);
32 this.fire('change-page', {page: page - 1});
37 docLengthChanged: function() {
38 var numDigits = this.docLength.toString().length;
39 this.$.pageselector.style.width = (numDigits * DIGIT_LENGTH) + 'em';
43 this.$.input.select();
47 * @return {boolean} True if the selector input field is currently focused.
49 isActive: function() {
50 return this.shadowRoot.activeElement == this.$.input;