Commit b03f8786 authored by dbeam's avatar dbeam Committed by Commit bot

Roll paper-tooltip to pick up some changes I made to it

Potentially used in: https://codereview.chromium.org/2280513002/

R=tsergeant@chromium.org
BUG=598017

Review-Url: https://codereview.chromium.org/2321883004
Cr-Commit-Position: refs/heads/master@{#417503}
parent 7875b88e
{
"name": "paper-tooltip",
"version": "1.1.2",
"version": "1.1.3",
"description": "Material design tooltip popup for content",
"authors": [
"The Polymer Authors"
......
......@@ -17,7 +17,7 @@ Polymer({
*/
for: {
type: String,
observer: '_forChanged'
observer: '_findTarget'
},
/**
......@@ -26,7 +26,8 @@ Polymer({
*/
manualMode: {
type: Boolean,
value: false
value: false,
observer: '_manualModeChanged'
},
/**
......@@ -104,7 +105,6 @@ Polymer({
listeners: {
'neon-animation-finish': '_onAnimationFinish',
'mouseenter': 'hide'
},
/**
......@@ -129,26 +129,12 @@ Polymer({
},
attached: function() {
this._target = this.target;
if (this.manualMode)
return;
this.listen(this._target, 'mouseenter', 'show');
this.listen(this._target, 'focus', 'show');
this.listen(this._target, 'mouseleave', 'hide');
this.listen(this._target, 'blur', 'hide');
this.listen(this._target, 'tap', 'hide');
this._findTarget();
},
detached: function() {
if (this._target && !this.manualMode) {
this.unlisten(this._target, 'mouseenter', 'show');
this.unlisten(this._target, 'focus', 'show');
this.unlisten(this._target, 'mouseleave', 'hide');
this.unlisten(this._target, 'blur', 'hide');
this.unlisten(this._target, 'tap', 'hide');
}
if (!this.manualMode)
this._removeListeners();
},
show: function() {
......@@ -165,6 +151,7 @@ Polymer({
this.toggleClass('hidden', false, this.$.tooltip);
this.updatePosition();
this.animationConfig.entry[0].timing = this.animationConfig.entry[0].timing || {};
this.animationConfig.entry[0].timing.delay = this.animationDelay;
this._animationPlaying = true;
this.playAnimation('entry');
......@@ -190,10 +177,6 @@ Polymer({
this.playAnimation('exit');
},
_forChanged: function() {
this._target = this.target;
},
updatePosition: function() {
if (!this._target || !this.offsetParent)
return;
......@@ -260,10 +243,49 @@ Polymer({
},
_addListeners: function() {
if (this._target) {
this.listen(this._target, 'mouseenter', 'show');
this.listen(this._target, 'focus', 'show');
this.listen(this._target, 'mouseleave', 'hide');
this.listen(this._target, 'blur', 'hide');
this.listen(this._target, 'tap', 'hide');
}
this.listen(this, 'mouseenter', 'hide');
},
_findTarget: function() {
if (!this.manualMode)
this._removeListeners();
this._target = this.target;
if (!this.manualMode)
this._addListeners();
},
_manualModeChanged: function() {
if (this.manualMode)
this._removeListeners();
else
this._addListeners();
},
_onAnimationFinish: function() {
this._animationPlaying = false;
if (!this._showing) {
this.toggleClass('hidden', true, this.$.tooltip);
}
},
_removeListeners: function() {
if (this._target) {
this.unlisten(this._target, 'mouseenter', 'show');
this.unlisten(this._target, 'focus', 'show');
this.unlisten(this._target, 'mouseleave', 'hide');
this.unlisten(this._target, 'blur', 'hide');
this.unlisten(this._target, 'tap', 'hide');
}
this.unlisten(this, 'mouseenter', 'hide');
}
});
\ No newline at end of file
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
......
......@@ -354,9 +354,9 @@ Tree link: https://github.com/PolymerElements/paper-toolbar/tree/v1.1.6
Name: paper-tooltip
Repository: git://github.com/PolymerElements/paper-tooltip.git
Tree: v1.1.2
Revision: 6be894127678900f6e506b56fc9622ab768c03aa
Tree link: https://github.com/PolymerElements/paper-tooltip/tree/v1.1.2
Tree: v1.1.3
Revision: 05fe3cfcb0e7e6853fa337344227f74a2ec7e07e
Tree link: https://github.com/PolymerElements/paper-tooltip/tree/v1.1.3
Name: polymer
Repository: git://github.com/Polymer/polymer.git
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment