@or.madipor wrote:
Hey,
My diagram is listening to “InitialLayoutCompleted” event.
What I’m trying to do is position the diagram at the center of div horizontally and vertically.
Another thing, the diagram can’t be in the top 50 pixels of the div. please see the following example:The problem starts when the size of the diagram (documentBounds) is larger than the size of the div.
In this case, I would like to change the height of the diagram. smaller than the height of the div.How do I change the diagram size (documentBounds) and fit the zoom to the new size?
this.diagram.addDiagramListener(‘InitialLayoutCompleted’, this.centralizOnLoad);
centralizOnLoad(): void {
let divHeight = this.diagram.div.clientHeight;
let documentHeigth = this.diagram.documentBounds.height;
if (divHeight < documentHeigth) {
this.diagram.documentBounds.height = divHeight - 50;
this.diagram.zoomToFit();
this.diagram.position = new go.Point(paddingFromLeft, -50);
this.diagram.requestUpdate();
}
}Thank you
Posts: 2
Participants: 2
