Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

How can I manually maintain the diagram position?

$
0
0

@cfarmerga wrote:

I have a model I'm loading where the positions have been set by an external app. Some of the node location coordinates have values less than zero, and I want those to be positioned partially out of view as in the screenshot.

I can accomplish this by setting the diagram position to (0,0), but I am stuck on the other behaviors I want to have.

I want the diagram to always start at position (0,0) and want the position never to go to negative x or y. I see that I can use autoScrollRegion to make sure that dragging nodes to the left and top doesn't cause automatic scrolling in those directions. I do want to allow autoscrolling to the bottom and right, though.

I'm trying to use the positionComputation function to set the correct position for my diagram, but I feel like I am missing something, since I have no idea how to handle the case when there are scrollbars. It seems like 0,0 is fine any time there is no scrollbar. Do I have to manually add the scroll offsets to the diagram position? How can even find the x or y scroll offset? Because I can't see anything about this in the docs, it makes me think I'm heading in the wrong direction. Is positionComputation the right way to approach this? How can I correctly set the diagram position when scrollbars are present?

thanks!

Here's a fiddle: https://jsfiddle.net/cfarmerga/4aashnuq/

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles