The diagram can be scrolled by using the vertical and horizontal scrollbars. In addition to the scrollbars,mousewheel can be used to scroll the diagram.
scrollSettings enable you to read the current scroll status, view port size, current zoom, and zoom factor. It also allows you to scroll the diagram programmatically.
Diagram allows you to pan the diagram before loading, so that any desired region of a large diagram is made to view. You can programmatically pan the diagram with the
verticalOffset properties of scroll settings. The following code illustrates how to set pan the diagram programmatically.
In the following example, the vertical scroll bar is scrolled down by 50px and horizontal scroll bar is scrolled to right by 100px.
You can programmatically change the scroll offsets at runtime by using the client-side method update. The following code illustrates how to change the scroll offsets and zoom factor at runtime.
var diagram = document.getElementById("container").ej2_instances; //Updates scroll settings diagram.scrollSettings.horizontalOffset=200; diagram.scrollSettings.verticalOffset=30 diagram.dataBind();
Autoscroll feature automatically scrolls the diagram, whenever the node or connector is moved beyond the boundary of the diagram. So that, it is always visible during dragging, resizing, and multiple selection operations. Autoscroll is automatically triggered when any one of the following is done towards the edges of the diagram.
The diagram client-side event
ScrollChange gets triggered when the autoscroll (scrollbars) is changed and you can do your own customization in this event.
The autoscroll behavior in your diagram can be enabled/disabled by using the
canAutoScroll property of the diagram.
The autoscroll border is used to specify the maximum distance between the object and diagram edge to trigger autoscroll. The default value is set as 15 for all sides (left, right, top, and bottom) and it can be changed by using the
autoScrollBorder property of page settings. The following code example illustrates how to set autoscroll border.
The scroll limit allows you to define the scrollable region of the diagram. It includes the following options:
scrollLimitproperty of scroll settings helps to limit the scrolling.
scrollableArea allow to extend the scrollable region that is based on the scroll limit.
The following code example illustrates how to specify the scroll limit.
The scroll padding allows you to extend the scrollable region that is based on the scroll limit.
The following code example illustrates how to set scroll padding to diagram region.
Scrolling beyond any particular rectangular area can be restricted by using the
scrollableArea property of scroll settings. To restrict scrolling beyond any custom region, set the
scrollLimit as “limited”. The following code example illustrates how to customize scrollable area.
updateViewPort method is used to update the diagram page and view size at runtime.