Skip to content

Commit

Permalink
Component | Graph: Config option to disable link highlight on hover
Browse files Browse the repository at this point in the history
- Adds a new `linkHighlightOnHover` config option to the Graph component to enable/disable link hover highlight
- Updates the `_onLinkMouseOver` method to only set the `hovered` state if `linkHighlightOnHover` is true
  • Loading branch information
rokotyan authored and lee00678 committed Jan 29, 2025
1 parent 4dda952 commit 0844bf0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/ts/src/components/graph/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ export interface GraphConfigInterface<N extends GraphInputNode, L extends GraphI
* `1.5` - very curve.
* Default: `0` */
linkCurvature?: NumericAccessor<L>;
/** Highlight links on hover. Default: `true` */
linkHighlightOnHover?: boolean;
/** Set selected link by its unique id. Default: `undefined` */
selectedLinkId?: number | string;

Expand Down Expand Up @@ -327,6 +329,7 @@ export const GraphDefaultConfig: GraphConfigInterface<GraphInputNode, GraphInput
linkNeighborSpacing: 8,
linkDisabled: false,
linkCurvature: 0,
linkHighlightOnHover: true,
selectedLinkId: undefined,
nodeGaugeAnimDuration: 1500,

Expand Down
2 changes: 1 addition & 1 deletion packages/ts/src/components/graph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ export class Graph<
private _onLinkMouseOver (d: GraphLink<N, L>): void {
if (this._isDragging) return

d._state.hovered = true
if (this.config.linkHighlightOnHover) d._state.hovered = true
this._updateNodesLinksPartial()
}

Expand Down

0 comments on commit 0844bf0

Please sign in to comment.