-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat: hold traces tooltip on hover #2387
Changes from 1 commit
1fe1886
558d127
e6c2820
58df141
d96209d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import { PopoverPositionType, PopoverRef } from '@hypertrace/components'; | ||
import { Observer } from 'rxjs'; | ||
import { Observable, Observer } from 'rxjs'; | ||
import { MouseLocationData } from '../mouse-tracking/mouse-tracking'; | ||
|
||
export class ChartTooltipPopover<TData, TContext> implements ChartTooltipRef<TData, TContext> { | ||
private boundElement?: Element; | ||
public readonly hovered$: Observable<boolean>; | ||
|
||
public constructor( | ||
private readonly popoverRef: PopoverRef, | ||
private readonly dataObserver: Observer<MouseLocationData<TData, TContext>[]> | ||
) {} | ||
) { | ||
this.hovered$ = popoverRef.hovered$; | ||
} | ||
|
||
public showWithData(element: Element, data: MouseLocationData<TData, TContext>[]): void { | ||
this.updatePositionStrategyIfNeeded(element); | ||
|
@@ -30,8 +33,8 @@ export class ChartTooltipPopover<TData, TContext> implements ChartTooltipRef<TDa | |
this.popoverRef.updatePositionStrategy({ | ||
type: PopoverPositionType.FollowMouse, | ||
boundingElement: element, | ||
offsetX: 20, | ||
offsetY: 30 | ||
offsetX: 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would be the impact of this change at other places? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will be changing the way that we display the tooltip keeping it visible when the user has the cursor on the tooltip but will not break the functionality. |
||
offsetY: 0 | ||
}); | ||
this.boundElement = element; | ||
} | ||
|
@@ -42,4 +45,5 @@ export interface ChartTooltipRef<TData, TContext = unknown> { | |
showWithData(relativeTo: Element, data: MouseLocationData<TData, TContext>[]): void; | ||
hide(): void; | ||
destroy(): void; | ||
hovered$: Observable<boolean>; | ||
} |
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.
Why do we need the debounceTime?
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.
Added to provide a better user experience when hover over the graph with the cursor