Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initialContentAlignment: go.Spot.LeftCenter,
layout: $(
go.TreeLayout,
{
angle: 0,
arrangement: go.TreeLayout.ArrangementVertical,
treeStyle: go.TreeLayout.StyleLayered
}),
isReadOnly: true
});
this.myDiagram.allowHorizontalScroll = true;
this.myDiagram.allowVerticalScroll = true;
this.myDiagram.allowZoom = false;
this.myDiagram.allowSelect = true;
this.myDiagram.autoScale = Diagram.Uniform;
this.myDiagram.contentAlignment = go.Spot.LeftCenter;
this.myDiagram.toolManager.panningTool.isEnabled = false;
this.myDiagram.toolManager.mouseWheelBehavior = ToolManager.WheelScroll;
// define a simple Node template
this.myDiagram.nodeTemplate =
$(
go.Node,
'Auto', // the Shape will go around the TextBlock
{ selectionChanged: (node: Node) => this.props.onNodeSelection(node.key as string, node.isSelected) },
$(
go.Shape,
'RoundedRectangle',
{ strokeWidth: 0 },
// Shape.fill is bound to Node.data.color
new go.Binding('fill', 'color')),
private createDiagram(diagramId: string): Diagram {
const $ = go.GraphObject.make;
const myDiagram: Diagram = $(go.Diagram, diagramId, {
initialContentAlignment: go.Spot.LeftCenter,
layout: $(go.TreeLayout, {
angle: 0,
arrangement: go.TreeLayout.ArrangementVertical,
treeStyle: go.TreeLayout.StyleLayered
}),
isReadOnly: false,
allowHorizontalScroll: true,
allowVerticalScroll: true,
allowZoom: false,
allowSelect: true,
autoScale: Diagram.Uniform,
contentAlignment: go.Spot.LeftCenter,
TextEdited: this.onTextEdited
});
myDiagram.toolManager.panningTool.isEnabled = false;
myDiagram.toolManager.mouseWheelBehavior = ToolManager.WheelScroll;
myDiagram.nodeTemplate = $(
go.Node,
'Auto',
{
selectionChanged: node => this.props.onNodeSelection(node.key as string, node.isSelected)
},
$(go.Shape, 'RoundedRectangle', { strokeWidth: 0 }, new go.Binding('fill', 'color')),
$(go.TextBlock, { margin: 8, editable: true }, new go.Binding('text', 'label'))
);