-
Notifications
You must be signed in to change notification settings - Fork 1
fix: tooltip closed on scroll + measure label #76
Conversation
import { select } from 'd3'; | ||
import constants from './size-constants'; | ||
|
||
let tooltipOpen = -1; |
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.
global variables :( I think can get weird with multiple orgcharts in sense
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.
yeah, that is definitely not working right now :/
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.
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.
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.
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
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.
as well as scoping the timeouts to box I guess
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.
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
No description provided.