Goview.RescaleToFit

Hi!

I want my diagram to use the full available space. So I extent my view to the full size of the form and then I am using RescaleToFit to my view (like in the documentation. But there is still a lot of white space at the right side and at the bottom.
I use two layers one is visible and one is not visible. Are the invisible nodes also considered in the RescaleToFit, so that they are maybe in the free space?
Actually I don't think that is the problem, but the only idea I have.
Do you have any other idea?
Thanks for your help.
Monika

GoView.RescaleToFit depends on the result of GoView.ComputeDocumentBounds, which by default just calls GoDocument.ComputeBounds.

GoDocument.ComputeBounds iterates over all the GoObject in the given collection and computes the union of the Bounds of all the visible objects.
So I think you are right -- the presence of invisible layers is not contributing to the value of GoView.ComputeDocumentBounds.
What version are you using? For version 2.5 we changed the behavior of GoView.RescaleToFit not to always include the origin (i.e. the point 0,0). If you are using 2.4 or older, and if your objects all at negative coordinates, then that would explain the behavior you are seeing.
The other possibility is that your objects don't take up much space and the GoView is "too big", and because RescaleToFit doesn't increase the GoView.DocScale past 1, there will be extra space around.

Sorry, I forgot to write the version. It’s 2.5.1, so that doesn’t seem to be the problem.

The other possibility is also seems not to be the problem.
When I start the program I set the positions and size of the nodes, so that they are using all space. And only if I resize (to a smaller size) the problem occurs.
And I just noticed another problem: It doesn't seem to include all visible nodes. Only the nodes of type ContentNode (inherited of GoBasicNode) are taken into account. But not the HistoryNode (inherited of GoTextNode).
Anyway, I will use another solution, which better fits to my needs.
Thanks for the help.

You haven’t overridden any of the methods I mentioned?

Are your HistoryNode.Bounds values correct?

No, I havent’t.

And for the HistoryNode I do nothing to the bounds.
But as I allready wrote I am now using another solution (calculating the DocScale myself) without the function and it works (for my purpose even better).
But if you need more information to analyze the problem, I can try to give you.

Because you say it’s only a problem when you change your collection of nodes to occupy a smaller area, I’m wondering if there are some Visible but not seen objects remaining at the further location(s). Do you use some kind of background object?

There was a misunderstanding. At the beginning I don’t use the RescaleToFit, so it’s all my sizing and positioning. So the space is fully used.

When I now rescale either smaller or bigger, I get the white space.
No I am not using a background object. But that's a good direction to the problem. The nodes all contain a GoImage, which is quite big but for the outer nodes invisible. But I think that causes the bounds of the nodes to be bigger as they seem, so that there seem to be a lot of free space, which is really occupied by an invisble image.