Articles in this section

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

This article explains how to stretch node width to viewport width in Vue 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 the Vue Diagram.

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

 updateImageNode() {
     const diagramInstance = this.$refs.diagram.ej2Instances;
     let node = diagramInstance.getObject('headerNode');
     node.width =
       diagramInstance.scrollSettings.viewPortWidth +
       diagramInstance.scrollSettings.viewPortWidth *
         diagramInstance.scrollSettings.currentZoom;
   
            //to preview zoom in and zoom out
       diagramInstance.scrollSettings.maxZoom = diagramInstance.scrollSettings.currentZoom;
       diagramInstance.scrollSettings.minZoom = diagramInstance.scrollSettings.currentZoom; 
 }

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

Refer to the working sample for additional details and implementation: Click here for sample

Conclusion

We hope you enjoyed learning how to stretch node width to viewport width in Vue Diagram

You can refer to our Vue Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Vue 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 check out 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