Is it possible to know the location of diagram in infinite scroll mode with a visual indication in which the direction the diagram is.
Currently the diagram in at the bottom then is there a way to know that the diagram in below?
I assume you mean “to know that the diagram is below”, where you are assuming that the Diagram.documentBounds is an area which is “below” the current viewport.
First, any user can just type Shift-Z to zoom-to-fit.
Second, you could use an Overview to show the user where they are relative to the document.
Third, what if the Nodes and Links are not in one direction from the center of the viewport, but in several or all directions? Maybe there is a ring of Nodes and Links that surround the viewport? What would you want to show then?
My diagram is this, uses table layout and dont have links.
Infinite scrolling work in all four directions what if i scrolled the diagram up and now it is up .
OK, so all of your Parts will be in a single rectangular area – you won’t have multiple rectangular areas that might be scattered about.
You didn’t say whether using Overview would be a good solution.
You could show a simple unmodelled Part that was an “arrow” pointing towards the center of your Diagram.documentBounds. Hide it whenever the Diagram.documentBounds intersects with the Diagram.viewportBounds. I suppose you could position this arrow to be just inside of the viewport bounds, closest to the center of the Diagram.documentBounds. Implement this all in a “ViewportBoundsChanged” DiagramEvent listener.
Actually i am new to go js , do you have any example to demonstrate it on any single node diagram?
Here’s an example: Show Relative Document Location
As always the complete source code is in the page itself.
Thank you, It’s working.
If i want to use arrow as a indicator then how can i do that as i have to change the direction of arrow based on the location of diagram.
You’ll want to make the vb
smaller by calling Rect.inflate on it with negative numbers. That way the center of that Part will be inside the actual viewport so that you can see the whole Part.
Then set the angle to vb.center.directionPoint(db.center)
.