-
Notifications
You must be signed in to change notification settings - Fork 263
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
0d0fe66
commit 9575d7b
Showing
2 changed files
with
23 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import GraphinContext from '../GraphinContext'; | ||
|
||
const FontPaint = () => { | ||
const { graph } = React.useContext(GraphinContext); | ||
React.useEffect(() => { | ||
// Hack 写法,解决第一次加载不绘制 ICON FONT 的 BUG | ||
const timer = setTimeout(() => { | ||
graph.getNodes().forEach((node) => { | ||
graph.setItemState(node, 'normal', true); | ||
}); | ||
graph.paint(); | ||
}, 1600); | ||
return () => { | ||
clearTimeout(timer); | ||
}; | ||
}, []); | ||
return null; | ||
}; | ||
|
||
export default FontPaint; |
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