Articles in this section

How to Stretch Node Width to Viewport Width in Angular Diagram?

In this article, you can learn about how to stretch a node’s width to the viewport width in an Angular diagram. To stretch a node’s width to fit the viewport width, you can adjust the node size based on the diagram’s viewport settings. The viewportWidth and currentZoom properties within the diagram’s scrollSettings help you calculate the appropriate node width, ensuring it aligns with the visible area of our Angular Diagram feature tour page.

Below Code Snippet explains how to stretch node width to viewport width

public updateImageNode() {
   let node = (this.diagram as any).getObject('headerNode');
   (node as any).width =
     this.diagram.scrollSettings.viewPortWidth +
     this.diagram.scrollSettings.viewPortWidth *
       this.diagram.scrollSettings.currentZoom;

   //to preview zoom in and zoom out
   this.diagram.scrollSettings.maxZoom =
     this.diagram.scrollSettings.currentZoom;
   this.diagram.scrollSettings.minZoom =
     this.diagram.scrollSettings.currentZoom;
 } 

The updateImageNode function sets the headerNode width to account for the viewport width and current zoom. It then locks the zoom level by setting maxZoom and minZoom to the current zoom, maintaining a consistent view.

Sample : Click here for sample

Conclusion

I hope you enjoyed learning how to stretch the node width to the viewport width in Angular Diagram.

You can refer to our Angular Diagram feature tour page to learn about its other groundbreaking feature representations and documentation to quickly get started with configuration specifications. You can also explore our Angular Diagram example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to explore our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, BoldDesk Support or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied