skin: modify coordinate information in ScreenShotDialog 08/23408/2
authorhyunjin816.lee <hyunjin816.lee@samsung.com>
Wed, 25 Jun 2014 05:48:36 +0000 (14:48 +0900)
committerhyunjin816.lee <hyunjin816.lee@samsung.com>
Wed, 25 Jun 2014 09:07:21 +0000 (18:07 +0900)
Change-Id: Ib6f752c909eae89a37eb7240568d43678024e9ce
Signed-off-by: hyunjin816.lee <hyunjin816.lee@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/screenshot/ScreenShotDialog.java

index abf487a0a03f67be70e8b9894be45c8d82562a2f..921bee63e562a1be562ad47421de2297e2051646 100644 (file)
@@ -272,13 +272,34 @@ public class ScreenShotDialog {
                                        origin.y += canvasGrabPosition.y - e.y;
                                        scrollComposite.setOrigin(origin);
                                }
-                               int curX = e.x - CANVAS_MARGIN;;
-                               int curY = e.y - CANVAS_MARGIN;;
+                               int MaxWidth = 0, MaxHeight = 0;
+                               scaleSize = scale.getSelection() - 3;
+                               int curX = (int)((e.x - CANVAS_MARGIN) * Math.pow(2, -scaleSize));
+                               int curY = (int)((e.y - CANVAS_MARGIN) * Math.pow(2, -scaleSize));
+
+                               /* checking Rotation */
+                               switch (skin.getEmulatorSkinState().getCurrentRotationId()) {
+                               case SkinRotations.LANDSCAPE_ID:
+                               case SkinRotations.REVERSE_LANDSCAPE_ID:
+                                       MaxWidth = skin.getEmulatorSkinState().getCurrentResolutionHeight();
+                                       MaxHeight = skin.getEmulatorSkinState().getCurrentResolutionWidth();
+                                       break;
+                               case SkinRotations.PORTRAIT_ID:
+                               case SkinRotations.REVERSE_PORTRAIT_ID:
+                               default:
+                                       MaxWidth = skin.getEmulatorSkinState().getCurrentResolutionWidth();
+                                       MaxHeight = skin.getEmulatorSkinState().getCurrentResolutionHeight();
+                                       break;
+                               }
 
                                if (curX < 0)
                                        curX = 0;
+                               else if (curX > MaxWidth)
+                                       curX = MaxWidth;
                                if (curY < 0)
                                        curY = 0;
+                               else if (curY > MaxHeight)
+                                       curY = MaxHeight;
 
                                labelPoint.setText(" x : " + curX + ", y : " + curY + " ");
                                labelPoint.update();