-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b196ff1
commit f887216
Showing
21 changed files
with
932 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from "react"; | ||
import type { | ||
NodeCell, | ||
NodeConnectPoint, | ||
SmartConnectLineState, | ||
} from "./interfaces"; | ||
import type { NodePosition } from "../diagram/interfaces"; | ||
|
||
export interface HoverState { | ||
// Currently only support node cell | ||
cell: NodeCell; | ||
relativePoints: ReadonlyArray<NodeConnectPoint>; | ||
points: ReadonlyArray<NodePosition>; | ||
activePointIndex?: number; | ||
} | ||
|
||
export const HoverStateContext = React.createContext<{ | ||
rootRef: React.RefObject<SVGSVGElement>; | ||
smartConnectLineState: SmartConnectLineState | null; | ||
unsetHoverStateTimeoutRef: React.MutableRefObject<number | null>; | ||
hoverState: HoverState | null; | ||
setHoverState: React.Dispatch<React.SetStateAction<HoverState | null>>; | ||
setSmartConnectLineState: React.Dispatch< | ||
React.SetStateAction<SmartConnectLineState | null> | ||
>; | ||
onConnect?: ( | ||
source: NodeCell, | ||
target: NodeCell, | ||
exitPosition: NodePosition, | ||
entryPosition: NodePosition | ||
) => void; | ||
}>({ | ||
rootRef: { current: null }, | ||
smartConnectLineState: null, | ||
unsetHoverStateTimeoutRef: { current: null }, | ||
hoverState: null, | ||
setHoverState: () => {}, | ||
setSmartConnectLineState: () => {}, | ||
}); | ||
|
||
export function useHoverStateContext() { | ||
return React.useContext(HoverStateContext); | ||
} |
Oops, something went wrong.