|
@@ -45,18 +45,22 @@ public class NodeView extends JPanel {
|
|
|
|
|
|
public int getScaledX( int x )
|
|
|
{
|
|
|
- double scale = Math.min( (double)super.getWidth() / (int)model.getWidth( layout ), (double)super.getHeight() / (int)model.getHeight( layout ));
|
|
|
+ double width_scale = super.getWidth() / model.getWidth( layout );
|
|
|
+ double height_scale = super.getHeight() / model.getHeight( layout );
|
|
|
+ double scale = Math.min( width_scale, height_scale);
|
|
|
x *= scale;
|
|
|
- if( scale == (double)super.getHeight() / (int)model.getHeight( layout ) )
|
|
|
+ if( scale < width_scale )
|
|
|
x += (super.getWidth() - (model.getWidth( layout ) * scale )) / 2;
|
|
|
return x;
|
|
|
}
|
|
|
|
|
|
public int getScaledY( int y )
|
|
|
{
|
|
|
- double scale = Math.min( (double)super.getWidth() / (int)model.getWidth( layout ), (double)super.getHeight() / (int)model.getHeight( layout ));
|
|
|
+ double width_scale = super.getWidth() / model.getWidth( layout );
|
|
|
+ double height_scale = super.getHeight() / model.getHeight( layout );
|
|
|
+ double scale = Math.min( width_scale, height_scale);
|
|
|
y *= scale;
|
|
|
- if( scale == (double)super.getWidth() / (int)model.getWidth( layout ) )
|
|
|
+ if( scale < height_scale )
|
|
|
y += (super.getHeight() - (model.getHeight( layout ) * scale )) / 2;
|
|
|
return y;
|
|
|
}
|
|
@@ -66,15 +70,17 @@ public class NodeView extends JPanel {
|
|
|
{
|
|
|
if( layout == LayoutType.COMBINED && model.getColor( layout ) == null )
|
|
|
return;
|
|
|
- double scale = Math.min( (double)super.getWidth() / (int)model.getWidth( layout ), (double)super.getHeight() / (int)model.getHeight( layout ));
|
|
|
+ double width_scale = super.getWidth() / model.getWidth( layout );
|
|
|
+ double height_scale = super.getHeight() / model.getHeight( layout );
|
|
|
+ double scale = Math.min( width_scale, height_scale);
|
|
|
((Graphics2D)g).scale( scale, scale );
|
|
|
int x = 0;
|
|
|
int y = 0;
|
|
|
int width = (int)(super.getWidth() / scale);
|
|
|
int height = (int)(super.getHeight() / scale);
|
|
|
- if( scale == (double)super.getWidth() / (int)model.getWidth( layout ) )
|
|
|
+ if( scale < height_scale )
|
|
|
y += (super.getHeight() - (model.getHeight( layout ) * scale )) / scale / 2;
|
|
|
- if( scale == (double)super.getHeight() / (int)model.getHeight( layout ) )
|
|
|
+ if( scale < width_scale )
|
|
|
x += (super.getWidth() - (model.getWidth( layout ) * scale )) / scale / 2;
|
|
|
if( model.isDummyNode() )
|
|
|
{
|