Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

the position is not good when the tooltip is in an animatedpage #16

Closed
mjpaquet opened this issue Oct 16, 2014 · 2 comments
Closed

the position is not good when the tooltip is in an animatedpage #16

mjpaquet opened this issue Oct 16, 2014 · 2 comments

Comments

@mjpaquet
Copy link

in the first page page
controlWidth = 26
controlHeight = 40
toolTipWidth = 80
toolTipHeight = 46

in any others pages
controlWidth = 0
controlHeight = 0
toolTipWidth = 0
toolTipHeight = 0

@ebidel
Copy link
Contributor

ebidel commented Oct 16, 2014

The problem stems from how core-animated-pages hides its non-selected children with display: none:

::content > *:not(.core-selected):not([animate]) {
display: none !important;
}

which prevents the tooltip from calculating it's .clientWidth and positioning itself correctly. We saw a similar issue with google-map: googlearchive/core-animated-pages#26.

It's not ideal, but one work around is to manually call tooltip.setPosition() when core-animated-pages-transition-end fires:

http://jsbin.com/jeluv/2/edit

Note: core-animated-pages-transition-prepare would be a better time (both the current page and next page are visible then), but there's a bug that janks the page transitions

@mjpaquet
Copy link
Author

with a little modif for my custom element it is perfect

var custom = this.shadowRoot.querySelector('section[active]').querySelectorAll('custom-element');
Array.prototype.forEach.call(custom, function(element) {
var tooltips = element.shadowRoot.querySelectorAll('core-tooltip');
Array.prototype.forEach.call(tooltips, function(tip) {
tip.setPosition();
});
});

thx a lot

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants