Skip to content
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

Add delay in tooltip #61

Merged
merged 9 commits into from
Aug 23, 2016
Merged

Add delay in tooltip #61

merged 9 commits into from
Aug 23, 2016

Conversation

light-and-salt
Copy link
Contributor

@light-and-salt light-and-salt commented Aug 22, 2016

  • Add delay in tooltip
    • setTimeout on mousemove
    • cancelTimeout on mouseout
    • cancel tooltip promise on tooltip destroy
    • Positioning tooltip: get rendered tooltip height and width instead of height and width style
    • Use visibility:hidden instead of display:none because we need to know the rendered tooltip height and width to place it in the right position
    • Place tooltip far far away from screen on clear()
    • Add test onAppear, onDisappear, onMove callbacks in examples to make sure that these callbacks are executed in the right moments given time delay. For example, onAppear callback should be called when tooltip actually becomes visible.
    • Update doc
    • Tested with vlui (Integrate vega-tooltip vega-lite-ui#239) and voyager2

@light-and-salt light-and-salt changed the title [WIP] Add delay in tooltip - weird positioning of tooltip on init() Add delay in tooltip Aug 23, 2016

tooltipPromise = window.setTimeout(function() {
init(event, item, options);
tooltipActive = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why isn't this line a part of init?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn’t put tooltipActive in init() or clear() because it’s only referenced by onmouseover, onmousemove, and onmouseout listeners, so putting it closer to the event listeners might be easier to read?

@@ -2,7 +2,7 @@

(function() {
// by default, delay showing tooltip for 100 ms
const DELAY = 100;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you shouldn't use const in ES5.

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

Successfully merging this pull request may close these issues.

2 participants