简体   繁体   中英

GoJs Diagram after expanding is changing the scroll position

I have an expand button clicking on which expands the diagram to full scale. But after scrolling, the scroll bar automatically scrolls down to the middle of the diagram. I want the very first node to be visible on screen after I expand the diagram.

On page load the image looks something like this- 在此处输入图像描述

After I click on the Full View button at the top right corner, the image looks like this- 在此处输入图像描述

The scroll automatically gets shifted to the center of the diagram. I need to show the top most node of the diagram on Full View button click.

You can set the Diagram.scale the way that you want and then call CommandHandler.scrollToPart .

  var node = ...;  // what you want to be sure to show
  myDiagram.commandHandler.scrollToPart(node);

Examples are at: https://gojs.net/latest/samples/orgChartEditor.html https://gojs.net/latest/samples/flowgrammer.html https://gojs.net/latest/samples/orgChartStatic.html (but is commented out)

A fancier example is at: https://gojs.net/latest/samples/animatedFocus.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM