How to grow document/view to the left and up

Still very new to GoDiagram, and I couldn’t find anything about this on the forums, so:

I have managed to get a modal pan tool working, so that users can click and drag to pan the document. I also have things set up so that the Document will automatically grow as nodes are added beyond the current bounds of the document, at least to the right (east) and down (south).

What I would like to be able to do is grow the document up (north) and left (west), ideally if a user pans on those directions. Given the starting conditions, it would mean that new objects added to the diagram would have negative coordinates (which is fine).

So far, I’ve implemented a GrowDocument(int direction,float amount) method in a subclass of GoDocument, expanding the document’s ‘Bounds’. However, I can’t get that growth to be reflected in the View. I’m most likely manipulating the wrong properties, but I’m stumped for now.

Any advice would be appreciated. Thanks much!

You don’t need to do anything in order for the GoDocument.Bounds (i.e. GoDocument.TopLeft and GoDocument.Size) to grow to include any GoObjects that it contains. This happens automatically in GoDocument.UpdateDocumentBounds.

However, there are some exceptions:
If you have set GoDocument.FixedSize to true, UpdateDocumentBounds does nothing.
If you have set GoView.ShowsNegativeCoordinates to false, the GoView (i.e. scrolling) is automatically limited to positive coordinates only.
If you have set GoView.BackgroundHasSheet to true and GoView.SheetStyle to some non-None value, the scrolling is also limited in particular manners relative to the GoView.Sheet.
There might be some other GoView or GoDocument properties that also affect where the user could scroll to. In particular, you might have overridden GoView.DocumentTopLeft and GoView.DocumentSize, and then you can implement all kinds of custom behaviors. Oh, and if you have set any of the Suspends... properties, who knows what might be happening, unless you really know what you're doing!
But if you haven't done any of these things, everything ought to expand automatically as you add GoObjects anywhere into the GoDocument, and users can always scroll to see them.

Wow, quick response thanks!

I’ve double-checked all the settings you mentioned, and I’m pretty sure there isn’t anything else I’ve done that would negate my efforts at growing the view. I am able to drag an existing object into the ‘negative’ coordinate space, ie: beyond the top and left bounds of the current View. It remains, but the view itself doesn’t update so that I can see them. I can’t scroll/pan to see those objects.

A couple of questions that may help me figure this out…

  • Does an object have to be added to the Document in order for it to grow? Or can it be done at runtime by some other way?

  • How do I force the View to show the entire bounds of the document? RescaleToFit() isn’t working.

Thanks again!

No, you don’t have to add objects to a GoDocument in order for its Bounds to grow – you can just set that property, or the Size and/or TopLeft properties.

GoView.RescaleToFit ought to work, unless the document is so big that GoView.LimitDocScale prevents the scale from getting small enough so everything fits in the view.
It sounds like there's something very odd about your application. As I said, everything should just work as I think you expect. Please try some of the sample applications. Demo1, for example, lets you see and modify many of the GoDocument and GoView properties in the Properties window.