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.
12 observer: 'fadingInChanged'
18 inInitialFadeIn_: false,
21 this.mousemoveCallback = function(e) {
22 var rect = this.getBoundingClientRect();
23 if (e.clientX >= rect.left && e.clientX <= rect.right &&
24 e.clientY >= rect.top && e.clientY <= rect.bottom) {
26 // If we hover over the toolbar, cancel the initial fade in.
27 if (this.inInitialFadeIn_)
28 this.inInitialFadeIn_ = false;
30 // Initially we want to keep the toolbar up for a longer period.
31 if (!this.inInitialFadeIn_)
32 this.fadingIn = false;
37 attached: function() {
38 this.parentNode.addEventListener('mousemove', this.mousemoveCallback);
41 detached: function() {
42 this.parentNode.removeEventListener('mousemove', this.mousemoveCallback);
45 initialFadeIn: function() {
46 this.inInitialFadeIn_ = true;
48 this.fadeOutAfterDelay(6000);
51 fadingInChanged: function() {
55 if (this.timerId_ === undefined)
56 this.fadeOutAfterDelay(3000);
61 this.style.opacity = 1;
62 clearTimeout(this.timerId_);
63 this.timerId_ = undefined;
66 fadeOutAfterDelay: function(delay) {
67 this.timerId_ = setTimeout(
69 this.style.opacity = 0;
70 this.timerId_ = undefined;
71 this.inInitialFadeIn_ = false;