-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix layout of centered hover info #2154 #2440
Conversation
- Bug: when a tooltip displays a sufficiently long text (also depends on overall plot dimensions), the tooltip isn't rendered right or left but centered. In this case the tooltip text was partly rendered outside the tooltip box and the secondary label (the trace name) was hidden underneath the primary label.
// diff of exactly 1 would fail the test | ||
var tolerance = 1.1; | ||
expect(elem1BB.top - elem2BB.top).toBeWithin(0, tolerance, msg); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love these assert functions! They'd be good candidates for assets/custom_assertions
but we can leave them here until someone else finds a use for them elsewhere.
assertElemInside(nodes.primaryText, nodes.primaryBox, 'Primary text inside box'); | ||
assertElemInside(nodes.secondaryText, nodes.secondaryBox, 'Secondary text inside box'); | ||
|
||
done(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do these test cases need to be async? Can't we just take out done
from the function args and here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. They don't need to be async. I'll go and change that.
@rmoestl looks great, beautiful tests. Just the one quick question #2440 (comment) and then I think we're ready to 💃 |
- No reason to run them asynchronously.
Great PR @rmoestl ! Thanks very much 🎉 |
Can we close #865 now too? |
@alexcjohnson unfortunately no, https://codepen.io/eagor/pen/dXLNzX is still buggy. On the latest master, we get: |
Interesting - looks like the text gets pushed up to avoid overlap with the orange bar, but the rect doesn't. @rmoestl since you've got your head wrapped around this part of the code, can you hunt this last bit down as well? |
@alexcjohnson yes, of course. In fact, I even thought about proposing this to be the next bug to fix. When I diagnosed #2154 and #865, I felt these were two different problems. But definitely in the same area of code, yes. |
This fixes #2154: when hover info (aka tooltip) is rendered in the center due to a lack of space left or right, the text overflowed the box and the secondary hove info (trace name) was hidden underneath the primary one.
Final solution:
![2154_layout_centered-hover-info-final](https://user-images.githubusercontent.com/4652260/36980410-7b55c67e-208a-11e8-8740-196d8f4aac7c.png)
Hint: part of the discussion took place in rmoestl#1.