# HG changeset patch # User innparusu # Date 1465556339 -32400 # Node ID ff7fa81f36163d30c50c5d1d5a3c271aaaa473e8 # Parent a80d190a9fc14fc33f666ca67b24aadbcbccd556 Fix fitScreen with scroller diff -r a80d190a9fc1 -r ff7fa81f3616 .idea/workspace.xml --- a/.idea/workspace.xml Wed Jun 08 21:18:38 2016 +0900 +++ b/.idea/workspace.xml Fri Jun 10 19:58:59 2016 +0900 @@ -3,6 +3,7 @@ + @@ -26,6 +27,16 @@ + + + + + + + + + + @@ -44,8 +55,8 @@ - - + + @@ -76,28 +87,51 @@ - - + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -107,7 +141,7 @@ - + @@ -417,6 +451,7 @@ @@ -429,10 +464,10 @@ - @@ -552,6 +587,36 @@ - + + + + + + + - - - - - - - - + + + + + + @@ -917,7 +998,13 @@ @@ -929,21 +1016,21 @@ - + - + - + - - + + @@ -957,6 +1044,14 @@ + + + + @@ -1006,10 +1101,18 @@ + + + + + + + + - - + + @@ -1019,7 +1122,7 @@ - + @@ -1027,33 +1130,36 @@ - + - + - - + + - - + + + + - - - - - + + + + + + diff -r a80d190a9fc1 -r ff7fa81f3616 src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java --- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Wed Jun 08 21:18:38 2016 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Fri Jun 10 19:58:59 2016 +0900 @@ -191,7 +191,6 @@ if (previousViewerWindow != null) previousViewerWindow.setVisible(false); viewerWindow.fitScreen(); - viewerWindow.zoomToFit(); } } diff -r a80d190a9fc1 -r ff7fa81f3616 src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java --- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Wed Jun 08 21:18:38 2016 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Fri Jun 10 19:58:59 2016 +0900 @@ -1010,17 +1010,29 @@ int thisScreenHeight = (int) rectangles.get(leftScreenNumber).getHeight(); - int thatScreenX = (int) presenter.getX(); - int thatScreenY = (int) presenter.getY(); + final int thatScreenX = (int) presenter.getX(); + final int thatScreenY = (int) presenter.getY(); + final int thatScreenWidth = presenter.getFrameSizeWidth(); + final int thatScreenHeight = presenter.getFrameSizeHeight(); + System.out.println("thatScreenX:"+thatScreenX); + System.out.println("thatScreenY:"+thatScreenY); + System.out.println("thatScreenWidth:"+thatScreenWidth); + System.out.println("thatScreenHeight:"+thatScreenHeight); + System.out.println("getMaximum:"+scroller.getHorizontalScrollBar().getMaximum()); + System.out.println("getMinmum:"+scroller.getHorizontalScrollBar().getMinimum()); + // uiSettings.zoomToFit(2*thatScreenWidth, 2*thatScreenHeight, thisScreenWidth, thisScreenHeight); int singleWidth = viewer.getRfb().getSingleWidth() * viewer.getRfb().getRetinaScale(); int singleHeight = viewer.getRfb().getSingleHeight() * viewer.getRfb().getRetinaScale(); - frame.setSize(thisScreenWidth, thisScreenHeight); + System.out.println("singleeight:"+singleHeight); + //frame.setSize(thisScreenWidth, thisScreenHeight); uiSettings.fitScreen(thisScreenWidth, thisScreenHeight, singleWidth, singleHeight); - final Rectangle visible = new Rectangle(thatScreenX,thatScreenY,thisScreenWidth,thisScreenHeight); + final Rectangle visible = new Rectangle(thatScreenX,thatScreenY,thatScreenWidth,thatScreenHeight); SwingUtilities.invokeLater(new Runnable(){ public void run() { - scroller.scrollRectToVisible(visible); + scroller.getHorizontalScrollBar().setValue((int)(thatScreenX*1.5)); + scroller.getVerticalScrollBar().setValue((int)(thatScreenY*1.5)); + //scroller.scrollRectToVisible(visible); } }); }