File tree Expand file tree Collapse file tree 2 files changed +50
-2
lines changed Expand file tree Collapse file tree 2 files changed +50
-2
lines changed Original file line number Diff line number Diff line change 1- import CytoscapeComponent from "react-cytoscapejs " ;
1+ import CytoscapeComponent from "./CytoscapeComponentWebGl " ;
22import Cytoscape from "cytoscape" ;
33import { useEffect , useRef , MutableRefObject } from "react" ;
44import { triggerDownload } from "../services/utils" ;
@@ -42,7 +42,8 @@ const GRAPH_STYLE = [
4242 style : {
4343 label : "data(id)" ,
4444 "text-valign" : "top" ,
45- "border-style" : "dashed" ,
45+ "border-style" : "solid" ,
46+ "background-opacity" : 0.5 ,
4647 "text-margin-y" : - 8 ,
4748 "text-opacity" : 0.75 ,
4849 "font-style" : "italic" ,
Original file line number Diff line number Diff line change 1+ import CytoscapeComponent from "react-cytoscapejs" ;
2+ import Cytoscape from "cytoscape" ;
3+
4+ class CytoscapeComponentWebGl extends CytoscapeComponent {
5+ componentDidMount ( ) {
6+ const container = this . containerRef . current ;
7+
8+ const {
9+ global,
10+ headless,
11+ styleEnabled,
12+ hideEdgesOnViewport,
13+ textureOnViewport,
14+ motionBlur,
15+ motionBlurOpacity,
16+ wheelSensitivity,
17+ pixelRatio,
18+ } = this . props ;
19+
20+ const cy = ( this . _cy = new Cytoscape ( {
21+ container,
22+ headless,
23+ styleEnabled,
24+ hideEdgesOnViewport,
25+ textureOnViewport,
26+ motionBlur,
27+ motionBlurOpacity,
28+ wheelSensitivity,
29+ pixelRatio,
30+ renderer : {
31+ // Add WebGL renderer options
32+ name : "canvas" ,
33+ webgl : true , // turns on WebGL mode
34+ showFps : true , // (optional) shows the current FPS at the top-left
35+ webglDebug : true , // (optional) prints debug info to the browser console
36+ } ,
37+ } ) ) ;
38+
39+ if ( global ) {
40+ window [ global ] = cy ;
41+ }
42+
43+ this . updateCytoscape ( null , this . props ) ;
44+ }
45+ }
46+
47+ export default CytoscapeComponentWebGl ;
You can’t perform that action at this time.
0 commit comments