Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: chrome/browser/resources/pdf/elements/viewer-toolbar/viewer-toolbar.js

Issue 853603002: Merge html-office-public repo into src (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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.
4
5 Polymer('viewer-toolbar', {
6 fadingIn: false,
7 timerId_: undefined,
8 inInitialFadeIn_: false,
9 ready: function() {
10 this.mousemoveCallback = function(e) {
11 var rect = this.getBoundingClientRect();
12 if (e.clientX >= rect.left && e.clientX <= rect.right &&
13 e.clientY >= rect.top && e.clientY <= rect.bottom) {
14 this.fadingIn = true;
15 // If we hover over the toolbar, cancel the initial fade in.
16 if (this.inInitialFadeIn_)
17 this.inInitialFadeIn_ = false;
18 } else {
19 // Initially we want to keep the toolbar up for a longer period.
20 if (!this.inInitialFadeIn_)
21 this.fadingIn = false;
22 }
23 }.bind(this);
24 },
25 attached: function() {
26 this.parentNode.addEventListener('mousemove', this.mousemoveCallback);
27 },
28 detached: function() {
29 this.parentNode.removeEventListener('mousemove', this.mousemoveCallback);
30 },
31 initialFadeIn: function() {
32 this.inInitialFadeIn_ = true;
33 this.fadeIn();
34 this.fadeOutAfterDelay(6000);
35 },
36 fadingInChanged: function() {
37 if (this.fadingIn) {
38 this.fadeIn();
39 } else {
40 if (this.timerId_ === undefined)
41 this.fadeOutAfterDelay(3000);
42 }
43 },
44 fadeIn: function() {
45 this.style.opacity = 1;
46 clearTimeout(this.timerId_);
47 this.timerId_ = undefined;
48 },
49 fadeOutAfterDelay: function(delay) {
50 this.timerId_ = setTimeout(
51 function() {
52 this.style.opacity = 0;
53 this.timerId_ = undefined;
54 this.inInitialFadeIn_ = false;
55 }.bind(this), delay);
56 }
57 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/elements/viewer-toolbar/viewer-toolbar.html ('k') | chrome/browser/resources/pdf/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698