Node moving above viewport bounds

I have a diagram, which has several nodes. When I move a node above the viewport bounds I want to enable verticalscroll.

I have written viewportboundsChange event to trigger when there is a node going outside view. But this event is triggered only when the focus/click returned to the diagram. Ultimatley my goal is to activate vertical scroll at the moment when the node is scrolled outside the viewbounds.

Does the default behavior (no listeners and no settings involving scrolling) not do what you want? If not, could you please describe why not and precisely how the behavior should be different?

Is there anyway that when a node is moved above the viewbounds at that moment to start the verticalscroll?

There is autoscrolling when the mouse point is just inside the edge of the viewport. Diagram | GoJS API

But in my case I can’t add auto scrolling because I have panning tool enabled and if autoscroll is there then panning will be on initially I don’t want panning initially I want panning when the node cross the viewport. So two conditions here

  1. autoscroll should be enabled when moving node and it crosses viewport.
  2. panning should be in effect when there is a scroll.

It’s still not clear what you want. When you say panning, what are you referring to? The PanningTool is used to allow the user to change the diagram’s position by dragging the mouse around.

Would something like this be what you want?

  1. Autoscrolling when a node is dragged to the edge of the viewport
  2. PanningTool to be inactive if the diagram doesn’t have any scrollbars
  3. PanningTool to be active if there are scrollbars

If so, you can probably just change PanningTool.canStart to check for the existence of scrollbars on the diagram. You can check whether the Diagram.documentsBounds are larger than the Diagram.viewportBounds.

Thanks! Worked.