jQuery addClass example
Change class name on click in jQuery
by batobolg
HTML
<script src="https://gojs.net/latest/release/go.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta charset="utf-8">
<title>Test</title>
</head>
<body>
<div id="d1" style="width: 350px; height: 250px"></div>
</body>
</html>
JavaScript
//▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
function showContent() {
////////////////////////////////////////////////////////////////////////////
// Diagram //
////////////////////////////////////////////////////////////////////////////
var $go = go.GraphObject.make; // for conciseness in defining templates
//go.licenseKey = ...; // not shiiiii
let diagramA = $go(go.Diagram, "d1", // must name or refer to the DIV HTML element
{
"toolManager.mouseWheelBehavior": go.ToolManager.WheelZoom,
"linkingTool.portGravity": 10, "relinkingTool.portGravity": 10,
"undoManager.isEnabled": true,
"animationManager.isEnabled": false,
"draggingTool.dragsLink": true,
"linkingTool.isUnconnectedLinkValid": true,
"relinkingTool.isUnconnectedLinkValid": true,
"linkReshapingTool.makeAdornment": function(path) {
var ad = go.LinkReshapingTool.prototype.makeAdornment.call(this, path);
var link = path.part;
if (link.computeCurve() !== go.Link.Bezier) return ad;
if (!link.computeSpot(true).equals(go.Spot.None)) {
var h = this.makeHandle(path, 1);
h.segmentIndex = 1;
this.setReshapingBehavior(h, go.LinkReshapingTool.All);
h.cursor = 'move';
ad.add(h);
}
if (!link.computeSpot(false).equals(go.Spot.None)) {
var h = this.makeHandle(path, link.pointsCount-1);
h.segmentIndex = link.pointsCount-2;
this.setReshapingBehavior(h, go.LinkReshapingTool.All);
h.cursor = 'move';
ad.add(h);
}
return ad;
},
});
// define the Node template
diagramA.nodeTemplate =
$go(go.Node, "Auto", {
resizable: true,
},
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
$go(go.Shape, "RoundedRectangle",
{
parameter1: 10, // the corner...