I’ve got a JGoDocument that I’m adding JGoObjects to and that works fine. However, when I delete JGoObjects, I’d like to “pack” or re-size the document so that any excess “empty space” is removed.
Is there a simple method (like pack()) to do this? I know they have specific locations and I don’t want to change them, I just want the document size to shrink.
I’ve gone down the path of using computeBounds() but that doesn’t get rid of the empty space on the left and my JGoOverview gets a bit out of sync:
That looks like a good start, but you may also want to consider document.setDocumentTopLeft, view.setViewPosition, and view.setScale.
If you specify all 4 properties (DocumentTopLeft, DocumentSize, ViewPosition, and Scale), you can fully determine the document dimensions and what portion of that document is shown in the view.
There's a zoomToFitAction defined in Demo1 that you might want to look at for an example.
I played around with those methods, but there’s still a tiny part that I need that I think I’m missing. The view location is set to the new document top left but the actual document still contains the empty space on the left (after deleting objects on the left) and thus the scrollbars in the view are still adherering to the original document size and panning still goes out to the original document width and height. I can make it work if the objects on the right are deleted though.