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", "name": "paper-tooltip",
"version": "1.1.2", "version": "1.1.3",
"description": "Material design tooltip popup for content", "description": "Material design tooltip popup for content",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
......
...@@ -17,7 +17,7 @@ Polymer({ ...@@ -17,7 +17,7 @@ Polymer({
*/ */
for: { for: {
type: String, type: String,
observer: '_forChanged' observer: '_findTarget'
}, },
/** /**
...@@ -26,7 +26,8 @@ Polymer({ ...@@ -26,7 +26,8 @@ Polymer({
*/ */
manualMode: { manualMode: {
type: Boolean, type: Boolean,
value: false value: false,
observer: '_manualModeChanged'
}, },
/** /**
...@@ -104,7 +105,6 @@ Polymer({ ...@@ -104,7 +105,6 @@ Polymer({
listeners: { listeners: {
'neon-animation-finish': '_onAnimationFinish', 'neon-animation-finish': '_onAnimationFinish',
'mouseenter': 'hide'
}, },
/** /**
...@@ -129,26 +129,12 @@ Polymer({ ...@@ -129,26 +129,12 @@ Polymer({
}, },
attached: function() { attached: function() {
this._target = this.target; this._findTarget();
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');
}, },
detached: function() { detached: function() {
if (this._target && !this.manualMode) { if (!this.manualMode)
this.unlisten(this._target, 'mouseenter', 'show'); this._removeListeners();
this.unlisten(this._target, 'focus', 'show');
this.unlisten(this._target, 'mouseleave', 'hide');
this.unlisten(this._target, 'blur', 'hide');
this.unlisten(this._target, 'tap', 'hide');
}
}, },
show: function() { show: function() {
...@@ -165,6 +151,7 @@ Polymer({ ...@@ -165,6 +151,7 @@ Polymer({
this.toggleClass('hidden', false, this.$.tooltip); this.toggleClass('hidden', false, this.$.tooltip);
this.updatePosition(); this.updatePosition();
this.animationConfig.entry[0].timing = this.animationConfig.entry[0].timing || {};
this.animationConfig.entry[0].timing.delay = this.animationDelay; this.animationConfig.entry[0].timing.delay = this.animationDelay;
this._animationPlaying = true; this._animationPlaying = true;
this.playAnimation('entry'); this.playAnimation('entry');
...@@ -190,10 +177,6 @@ Polymer({ ...@@ -190,10 +177,6 @@ Polymer({
this.playAnimation('exit'); this.playAnimation('exit');
}, },
_forChanged: function() {
this._target = this.target;
},
updatePosition: function() { updatePosition: function() {
if (!this._target || !this.offsetParent) if (!this._target || !this.offsetParent)
return; return;
...@@ -260,10 +243,49 @@ Polymer({ ...@@ -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() { _onAnimationFinish: function() {
this._animationPlaying = false; this._animationPlaying = false;
if (!this._showing) { if (!this._showing) {
this.toggleClass('hidden', true, this.$.tooltip); 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. 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 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 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 ...@@ -354,9 +354,9 @@ Tree link: https://github.com/PolymerElements/paper-toolbar/tree/v1.1.6
Name: paper-tooltip Name: paper-tooltip
Repository: git://github.com/PolymerElements/paper-tooltip.git Repository: git://github.com/PolymerElements/paper-tooltip.git
Tree: v1.1.2 Tree: v1.1.3
Revision: 6be894127678900f6e506b56fc9622ab768c03aa Revision: 05fe3cfcb0e7e6853fa337344227f74a2ec7e07e
Tree link: https://github.com/PolymerElements/paper-tooltip/tree/v1.1.2 Tree link: https://github.com/PolymerElements/paper-tooltip/tree/v1.1.3
Name: polymer Name: polymer
Repository: git://github.com/Polymer/polymer.git 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