Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

fix: tooltip closed on scroll + measure label #76

Closed
wants to merge 3 commits into from

Conversation

eliseeborn
Copy link
Collaborator

No description provided.

src/tree/box.js Outdated Show resolved Hide resolved
src/tree/box.js Outdated Show resolved Hide resolved
src/tree/box.js Outdated Show resolved Hide resolved
import { select } from 'd3';
import constants from './size-constants';

let tooltipOpen = -1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

global variables :( I think can get weird with multiple orgcharts in sense

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, that is definitely not working right now :/

Copy link
Collaborator

Choose a reason for hiding this comment

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

It can be fine, as long as you never need multiple tooltips at the same time. But you also need to use the same element then, else you'll run into issues not having closed a tooltip.

So I think either scope the tooltip timeouts to the box function again, or move the tooltip element onto the html body. That causes some other issues, so best keep it inside the org chart div.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the problem isn't even the opening and closing, when I have two org charts, the tooltip is over the card in the other orgchart than the one I'm hovering over.
but I guess that would be solveable by going back to passing around the reference to the tooltip

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

as well as scoping the timeouts to box I guess

Copy link
Collaborator

Choose a reason for hiding this comment

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

you could just build it as a class/object of sorts:

  • in index you initialize it with the element and save the tooltip reference to the selectionsAndTransform object:
    selectionsAndTransform.tooltip = tooltip.init(element) -> that can save timouts on itself etc
  • Pass that to box.js
  • Profit

@eliseeborn eliseeborn closed this Feb 20, 2020
@eliseeborn eliseeborn deleted the fdq/tooltip-fixes branch February 20, 2020 09:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants