@ -65,6 +65,8 @@ public class ShareGeneratePane extends BasicPane {
private static final Dimension DIALOG_SIZE = new Dimension ( 670 , 760 ) ;
private static final Dimension DIALOG_SIZE = new Dimension ( 670 , 760 ) ;
private static final Dimension DIALOG_NORMAL_SIZE = new Dimension ( 670 , 610 ) ;
private static final Dimension DIALOG_NORMAL_SIZE = new Dimension ( 670 , 610 ) ;
private static final Border DIALOG_BORDER = BorderFactory . createEmptyBorder ( 0 , 6 , 4 , 6 ) ;
private static final Border DIALOG_BORDER = BorderFactory . createEmptyBorder ( 0 , 6 , 4 , 6 ) ;
private static final double MAX_WIDTH = 500 . 0 ;
private static final double MAX_HEIGHT = 260 . 0 ;
private JPanel mainPane = null ;
private JPanel mainPane = null ;
private ShareMainPane uploadPane = null ;
private ShareMainPane uploadPane = null ;
@ -303,6 +305,7 @@ public class ShareGeneratePane extends BasicPane {
}
}
private DefaultSharableWidget transform ( DefaultSharableWidget info ) {
private DefaultSharableWidget transform ( DefaultSharableWidget info ) {
confineSize ( info ) ;
//先屏蔽
//先屏蔽
//if (shareWidget instanceof AbstractBorderStyleWidget) {
//if (shareWidget instanceof AbstractBorderStyleWidget) {
@ -327,4 +330,18 @@ public class ShareGeneratePane extends BasicPane {
}
}
private void confineSize ( DefaultSharableWidget info ) {
double width = info . getWidth ( ) ;
double height = info . getHeight ( ) ;
if ( width > 0 & & height > 0 & & ( width > MAX_WIDTH | | height > MAX_HEIGHT ) ) {
double aspectRatio = width / height ;
if ( width / height > MAX_WIDTH / MAX_HEIGHT ) {
info . setWidth ( ( int ) MAX_WIDTH ) ;
info . setHeight ( ( int ) ( MAX_WIDTH / aspectRatio ) ) ;
} else {
info . setHeight ( ( int ) MAX_HEIGHT ) ;
info . setWidth ( ( int ) ( MAX_HEIGHT * aspectRatio ) ) ;
}
}
}
}
}