@vietthang wrote:
Hi,
I have created a diagram and define a groupTemplate and have a function to update the graph Direction and the fromSpot toSpot of upcoming/incoming link:
changeLayoutDirection(event) { this.goDiagram.startTransaction('change Layout'); const orientation = this.selectedDirection.orientation; this.goDiagram.layout.direction = this.selectedDirection.layoutDirection; if (orientation === GraphDataConstants.SOURCE_ON_LEFT) { this.goDiagram.groupTemplate.fromSpot = go.Spot.Right; this.goDiagram.groupTemplate.toSpot = go.Spot.Left; } else if (orientation === GraphDataConstants.SOURCE_ON_RIGHT) { this.goDiagram.groupTemplate.fromSpot = go.Spot.Left; this.goDiagram.groupTemplate.toSpot = go.Spot.Right; } else if (orientation === GraphDataConstants.SOURCE_ON_TOP) { this.goDiagram.groupTemplate.fromSpot = go.Spot.Bottom; this.goDiagram.groupTemplate.toSpot = go.Spot.Top; } else { this.goDiagram.groupTemplate.fromSpot = go.Spot.Top; this.goDiagram.groupTemplate.toSpot = go.Spot.Bottom; } this.goDiagram.groupTemplate = this.graphDataGoService.groupTemplate; this.goDiagram.commitTransaction('change Layout'); }
The problem here is that: the direction is updated, but fromSpot/toSpot still keeps the predefined value: From right side to left side of each node:
Before:
After calling changeLayout function:
Is there anything wrong with my function?
Posts: 2
Participants: 2