Diagram is moving on scroll when setting toolManager.panningTool.isEnabled = true

I have GoJS diagram. I need to scroll (without using scroll bar) diagram content if the content is larger than diagram size in touch device.

So I set

diagram.toolManager.panningTool.isEnabled = true.

Now I can scroll content in touch device(without using scroll bar).

But in another case where content is less than diagram size.So no scroll bar present.
Now the diagram is moving on scroll.

My requirement is the diagram will not move if the content of the diagram is less than diagram size(When no scroll bar present)

Please suggest a solution for this issue

PanningTool.isEnabled is true by default, so that statement is not necessary.

I suppose you could implement both “ViewportBoundsChanged” and “DocumentBoundsChanged” DiagramEvent listeners that check the relative sizes of the viewport size and document size and then enable or disable scrolling by setting Diagram.allowHorizontalScroll and Diagram.allowVerticalScroll.

Thanks.It is working fine