Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/common/CyWorkflow.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CytoscapeComponent from "react-cytoscapejs";
import CytoscapeComponent from "./CytoscapeComponentWebGl";
import Cytoscape from "cytoscape";
import { useEffect, useRef, MutableRefObject } from "react";
import { triggerDownload } from "../services/utils";
Expand Down Expand Up @@ -42,7 +42,8 @@ const GRAPH_STYLE = [
style: {
label: "data(id)",
"text-valign": "top",
"border-style": "dashed",
"border-style": "solid",
"background-opacity": 0.5,
"text-margin-y": -8,
"text-opacity": 0.75,
"font-style": "italic",
Expand Down
47 changes: 47 additions & 0 deletions src/common/CytoscapeComponentWebGl.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import CytoscapeComponent from "react-cytoscapejs";
import Cytoscape from "cytoscape";

class CytoscapeComponentWebGl extends CytoscapeComponent {
componentDidMount() {
const container = this.containerRef.current;

const {
global,
headless,
styleEnabled,
hideEdgesOnViewport,
textureOnViewport,
motionBlur,
motionBlurOpacity,
wheelSensitivity,
pixelRatio,
} = this.props;

const cy = (this._cy = new Cytoscape({
container,
headless,
styleEnabled,
hideEdgesOnViewport,
textureOnViewport,
motionBlur,
motionBlurOpacity,
wheelSensitivity,
pixelRatio,
renderer: {
// Add WebGL renderer options
name: "canvas",
webgl: true, // turns on WebGL mode
showFps: true, // (optional) shows the current FPS at the top-left
webglDebug: true, // (optional) prints debug info to the browser console
},
}));

if (global) {
window[global] = cy;
}

this.updateCytoscape(null, this.props);
}
}

export default CytoscapeComponentWebGl;