I use the Auto Panel with the Rectangle shape as the main shape. Now I want to clip the panel using some shape. I’m currently trying to achieve that by nesting another AutoPanel with white background with the main shape set to RoundedRectangle. The problem is that it doesn’t fully cover the root panel area. How could I prevent that, or how could I clip the root panel using some shape? Ideally I’d like to be able to create a “hole” somewhere in the middle of a node so that I can see through what’s behind a node.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GoJS Single Node Example</title>
<script src="https://unpkg.com/gojs/release/go.js"></script>
<style>
#myDiagramDiv {
width: 400px;
height: 400px;
border: 1px solid black;
}
</style>
</head>
<body>
<div id="myDiagramDiv"></div>
<script>
function init() {
var $ = go.GraphObject.make;
var myDiagram = $(go.Diagram, "myDiagramDiv", {
"undoManager.isEnabled": true,
});
myDiagram.nodeTemplate = $(
go.Node,
"Auto",
{ width: 100 },
$(go.Shape, "Rectangle", { fill: "red", strokeWidth: 0 }),
$(
go.Panel,
"Auto",
{
alignment: go.Spot.Left,
width: 20,
background: "white",
},
$(go.Shape, "RoundedRectangle", {
fill: "red",
strokeWidth: 0,
parameter1: 20,
parameter2: 1 | 8,
})
)
);
myDiagram.model = new go.GraphLinksModel([{ key: 1 }]);
}
window.onload = init;
</script>
</body>
</html>