Fix tooltip not being correctly positioned for certain centered graphs #118

Merged
snedadah merged 7 commits from fix-tooltip-center into main 2022-12-28 01:54:33 -05:00
Owner

Applied the fix used by the WordCloud to all graphs so that tooltips will be properly positioned, even if the graph is centered on the page. Did so by refactoring some tooltip logic in to a common getTooltipPosition used by all graphs.

One thing is that this simplifies all the tooltips to simply follow the mouse, instead of locking onto certain "blocks"/bars like in the grouped bar graph, which is more consitant with all the other tooltips, since we only had this in some cases.

Do we think that having the tooltip be sticky to a certain bar/group is important?

Closes #89

https://fix-tooltip-center-csc-class-profile-staging-snedadah.k8s.csclub.cloud/samplePage/

Applied the fix used by the WordCloud to all graphs so that tooltips will be properly positioned, even if the graph is centered on the page. Did so by refactoring some tooltip logic in to a common getTooltipPosition used by all graphs. One thing is that this simplifies all the tooltips to simply follow the mouse, instead of locking onto certain "blocks"/bars like in the grouped bar graph, which is more consitant with all the other tooltips, since we only had this in some cases. Do we think that having the tooltip be sticky to a certain bar/group is important? Closes #89 https://fix-tooltip-center-csc-class-profile-staging-snedadah.k8s.csclub.cloud/samplePage/
snedadah added 3 commits 2022-12-27 03:11:02 -05:00
continuous-integration/drone/push Build is failing Details
0f19008405
Updated other graphs
continuous-integration/drone/push Build is failing Details
4ad86c67d8
Removed comments
snedadah added 1 commit 2022-12-27 03:12:45 -05:00
continuous-integration/drone/push Build is passing Details
d95ad182d1
Updated playground removal
snedadah reviewed 2022-12-27 03:14:31 -05:00
@ -33,3 +52,3 @@
};
export { TooltipWrapper };
function getTooltipPosition(
Author
Owner

this is the main important function that all graphs now use

this is the main important function that all graphs now use
snedadah reviewed 2022-12-27 03:15:07 -05:00
@ -47,2 +61,4 @@
<div className={styles.page}>
<Header />
<SectionWrapper title="Transfer" />
<ComponentWrapper align="right" heading={""}>
Author
Owner

ill remove these before merging. Just here to replicate the bug and show its fixed for all graphs

ill remove these before merging. Just here to replicate the bug and show its fixed for all graphs
snedadah requested review from e26chiu 2022-12-27 03:51:51 -05:00
e26chiu approved these changes 2022-12-27 23:45:43 -05:00
e26chiu left a comment
Contributor

Great work! @snedadah Thanks for refactoring the tooltip part! It looks really clean and you handled all the edge cases pretty well. To respond to your question, I think we should keep the tooltip close to the mouse. I think this can make the appearance of the tooltip more expected when you hover over an icon: people can expect the tooltip to appear close to their mouse rather than seeing the tooltip appear somewhere else. It's also better to standardize across graphs as you mentioned.

Great work! @snedadah Thanks for refactoring the tooltip part! It looks really clean and you handled all the edge cases pretty well. To respond to your question, I think we should keep the tooltip close to the mouse. I think this can make the appearance of the tooltip more expected when you hover over an icon: people can expect the tooltip to appear close to their mouse rather than seeing the tooltip appear somewhere else. It's also better to standardize across graphs as you mentioned.
@ -14,0 +17,4 @@
function getOutmostSVG(element: Element): SVGElement | undefined {
let rootSVG: HTMLElement | Element | null = element ?? null;
let current: HTMLElement | Element | null = element;
Contributor

Not a blocker here, more of a question: What is the difference between HTMLElement and Element? Do we need both of them in the types?

Not a blocker here, more of a question: What is the difference between `HTMLElement` and `Element`? Do we need both of them in the types?
Author
Owner

Not sure what the exact difference is, but element.parentElement returns an HTMLElement, while element is an Element, so we need both here for that reason (since that variable could be either one of those)

Not sure what the exact difference is, but element.parentElement returns an HTMLElement, while element is an Element, so we need both here for that reason (since that variable could be either one of those)
snedadah added 1 commit 2022-12-28 01:29:26 -05:00
continuous-integration/drone/push Build is passing Details
0662159145
Edited types
snedadah added 2 commits 2022-12-28 01:34:48 -05:00
snedadah merged commit 743f050ec8 into main 2022-12-28 01:54:33 -05:00
snedadah deleted branch fix-tooltip-center 2022-12-28 01:54:33 -05:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: www/cs-2022-class-profile#118
No description provided.