I have a JGoText and a tree built with a collection of JGoLabeledLinks
and JGoTextNodes.
JGoText Node A ---------> Node B
I apply the following to scale the tree to fit the view:
private void rescaleToFit(){
double newscale = 1;
if (!getDocument().isEmpty()){
double extentWidth = getExtentSize().width;
double printWidth = getPrintDocumentSize().width;
double extentHeight = getExtentSize().height;
double printHeight = getPrintDocumentSize().height;
newscale = Math.min((extentWidth / printWidth),(extentHeight / printHeight));
}
newscale *= getScale();
if (newscale > 1)
newscale = 1;
setScale(newscale);
setViewPosition(0, 0);
double newscale = 1;
if (!getDocument().isEmpty()){
double extentWidth = getExtentSize().width;
double printWidth = getPrintDocumentSize().width;
double extentHeight = getExtentSize().height;
double printHeight = getPrintDocumentSize().height;
newscale = Math.min((extentWidth / printWidth),(extentHeight / printHeight));
}
newscale *= getScale();
if (newscale > 1)
newscale = 1;
setScale(newscale);
setViewPosition(0, 0);
}
I dont want the JGoText to be rescaled. I want the JGoText to appear
at its original location and size. Any suggestions?