Appearance
Cursor style
This example shows how to change the cursor style in Ogma. It uses setOptions to set a custom cursor on node hover, edge hover and on background hover.
ts
import Ogma from '@linkurious/ogma';
const ogma = new Ogma({
container: 'graph-container',
options: {
cursor: {
default: 'move',
node: 'sw-resize',
edge: 'pointer'
}
}
});
const graph = await ogma.generate.random({ nodes: 10, edges: 20 });
await ogma.setGraph(graph);
await ogma.view.locateGraph();
html
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<link type="text/css" rel="stylesheet" href="styles.css" />
</head>
<body>
<div id="graph-container"></div>
<script type="module" src="index.ts"></script>
</body>
</html>
css
#graph-container {
cursor: move;
top: 0;
bottom: 0;
left: 0;
right: 0;
position: absolute;
}