AutoScroll always "true" in the Diagram

Hi Syncfusion Team,

I use Diagram Component in my project. 

I set the property scrollSettings of the diagram: { canAutoScroll: false }. But I don't know: if I implement some logics and log the diagram's scrollSettings canAutoScroll (diagram.scrollSettings.canAutoScroll), it always shows "true" on the console Tab.

I don't know the reason why this happened. Is there any other property can affect the "canAutoScroll" property, so that it always show "true"?


Thanks,

Nguyen


10 Replies 1 reply marked as answer

NH nguyen hoang phuong January 9, 2024 02:58 AM UTC

Hi,

I've just found out that I cannot set any property of the scrollSettings. It always get this value: 

maxZoom: 30, minZoom: 0.2, scrollLimit: 'Infinity', canAutoScroll: true}.

What can I do now?


Thanks,

Nguyen



MG Moulidharan Gopalakrishnan Syncfusion Team January 9, 2024 10:01 AM UTC

Hi,


We have set the canAutoScroll property to true and false and it is working properly at our end. Could you please check the below video for your reference. Still if you face issues, could you please modify the below sample. Please refer the below sample and documentation. 


Documentation

https://ej2.syncfusion.com/angular/documentation/diagram/scroll-settings#updateviewport

Sample

https://stackblitz.com/edit/angular-tfg8rh-8dpqqd?file=src%2Fapp.component.ts,src%2Fapp.component.html


Regards, 

Moulidharan


Attachment: DiagramAutoScroll_fde4e623.zip


NH nguyen hoang phuong replied to Moulidharan Gopalakrishnan January 18, 2024 06:54 AM UTC

Hi,

I found the issue in my code. And now I can set the canAutoScroll property to true or false.

But I have another problem. I use the bringToCenter method of the diagram to bring a node to the center of the diagram's viewport. But sometimes, after triggering that method, a node is in the center, and the diagram has the scroll bar; and then the diagram starts scrolling automatically until all the nodes are in the viewport, even if I set the canAutoScroll property to false. I don't know why this happened. Maybe the diagram tends to put all the nodes in the viewport ??

Regards,

Nguyen



MG Moulidharan Gopalakrishnan Syncfusion Team January 22, 2024 01:07 PM UTC

Hi,


While Performing bringToCenter operation it does not bring a node in the center of viewport by changing the offset of the node, the actual behavior of the “bringToCenter” will update the whole diagram canvas region to move in to center of viewport respective to the selected node’s bounds. By this phenomenon the scroll bar will move based on initial diagram bounds(height and width).

The Autoscroll feature automatically scrolls the diagram, whenever the node or connector is moved beyond the boundary of the diagram.

Refer the below sample which includes attached rulers to observe changes in the diagram viewport measurements/bounds and documentation for your reference.

Documentation

https://ej2.syncfusion.com/angular/documentation/diagram/scroll-settings#autoscroll


Sample

https://stackblitz.com/edit/angular-jgx8kl-ratmoo?file=src%2Fapp.component.ts,src%2Fapp.component.html


Regards,

Moulidharan



NH nguyen hoang phuong replied to Moulidharan Gopalakrishnan January 23, 2024 11:09 AM UTC

Hi,

Thanks for your information.

Is there any way to bring a Node to the center of diagram's viewport ? If yes, please give me a sample of it. Thanks.


Regards,

Nguyen



MG Moulidharan Gopalakrishnan Syncfusion Team January 24, 2024 09:37 AM UTC

Hi,

We created a sample to achieve your requirement. To bring a Node to the center of diagram's viewport set the “scrollLimit” to 'Infinity' in the scrollsettings and perform “bringToCenter” operation, Refer the below sample and documentation for your reference

Code Snippet

scrollSettings :  {

            scrollLimit : 'Infinity',

      },


Sample

https://stackblitz.com/edit/angular-jgx8kl-ahbswm?file=src%2Fapp.component.ts



NH nguyen hoang phuong replied to Moulidharan Gopalakrishnan January 24, 2024 11:10 AM UTC

Hi,

Thanks for your suggestion. I will try with it.

I have another question. I also prepared a sample for my question.

https://stackblitz.com/edit/angular-11-new-jlcz3m?file=src%2Fapp%2Fapp.module.ts

If we don't click the "Toggle Expand" button and just click the "Bring To Center" button, the diagram works well.

But if we click the  "Toggle Expand" button, it means the diagram's width will change, and the "bringToCenter" method will bring the Node to the center of its old viewport. But what I want is the center of the new viewport.

The question is: Are we able to bring a Node to the center of new diagram's viewport, after we change the diagram's width? Right now, it seems like, it will bring a Node to the center of viewport, which is generated in the first mount of the diagram.


Regards,

Nguyen



MG Moulidharan Gopalakrishnan Syncfusion Team January 25, 2024 08:40 AM UTC

Hi,

We modified the provided sample  to achieve your requirement. It appears that you have changing the width of the diagram container when updating button container. To update the diagram viewport accordingly, please utilize the ‘diagram.updateViewPort()’ method for the new diagram viewport, now bringToCenter will work fine.

Code Snippet

public bringIntoCenter(): void {

   this.diagram.updateViewPort();

   this.diagram.bringToCenter(currentNode.wrapper.bounds);

}


Documentation

https://ej2.syncfusion.com/react/documentation/diagram/scroll-settings#updateviewport

 

Sample

https://stackblitz.com/edit/angular-11-new-ykzqdg?file=src%2Fapp%2Fapp.component.ts


Regards,

Moulidharan 



NH nguyen hoang phuong replied to Moulidharan Gopalakrishnan January 25, 2024 01:57 PM UTC

Hi,

That's awsome. Thanks for your help.


Regards,

Nguyen



VG Vivisa Ganesan Syncfusion Team January 26, 2024 03:07 AM UTC

Hi,

You're welcome! Please let us know if you have any further queries on this. We will be happy to assist.


Regards,

Vivisa


Marked as answer
Loader.
Up arrow icon