Layout and positioning issue

docucument co-ordintes are automatically stick with the viewport co-ordinate,


lets say in this first image “throw” is in position of go.point(0,20) now the throw stick with viewport, and I programmed the dragcomputation that the node doesn’t go beyond (0,0)


in this second image i only moved the throw node in right side now lets say the position of throw node is go.position(30,20) , now the remaining nodes are adjusted to viewport, how to disable it

simply I just wanted to fixbounds

localDig.fixedBounds = new go.Rect(0, 0, 5000, 5000)

its working but without height and width it should work

Have you looked at these samples?

In what manner is the setting of Diagram.fixedBounds insufficient for your purpose?

I want to give

new go.Rect(0,0)

heigt, width should not be given it should be taken dynamically

Maybe you want to set

no idea, how to integrate the fixed bounds and position computation

I suggested positionComputation instead of setting fixedBounds.

I have no idea about position computation, any examples …?

Try searching for “positionComputation”.

Try just having it return the Point(0,0)

when this position computation will be called

Whenever there is an attempt to scroll or zoom.

diagram.position shold be (0,0) but it overrides position when I scroll in that diagram

I still have little idea of what you want.

I’ll guess this:

      $(go.Diagram, ...,
          positionComputation: function(diag, pos) {
            return new go.Point(Math.max(pos.x, 0), Math.max(pos.y, 0));

This keeps the Diagram.position with non-negative values for x and y, therefore allowing scrolling once the Diagram.documentBounds gets large enough relative to the viewport size.