summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.js
blob: 48a518bb020ffc9294ee83b5f5cce2b832a096ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Polymer('viewer-zoom-button', {
  ready: function() {
    this.super();
    this.state_ = { opened: true };
  },

  show: function(delay) {
    if (!this.state_.opened)
      this.toggle_(delay);
  },

  hide: function(delay) {
    if (this.state_.opened)
      this.toggle_(delay);
  },

  toggle_: function(delay) {
    delay = delay || 0;
    this.state_.opened = !this.state_.opened;
  },

  activeChanged: function() {
    if (this.active)
      this.active = false;
  }
});