diff --git a/.classpath b/.classpath
index a77e904..1ea8111 100644
--- a/.classpath
+++ b/.classpath
@@ -2,7 +2,7 @@
-
+
diff --git a/.settings/com.google.gwt.eclipse.core.prefs b/.settings/com.google.gwt.eclipse.core.prefs
index 8aece0e..46b506c 100644
--- a/.settings/com.google.gwt.eclipse.core.prefs
+++ b/.settings/com.google.gwt.eclipse.core.prefs
@@ -1,3 +1,4 @@
eclipse.preferences.version=1
+entryPointModules=
filesCopiedToWebInfLib=gwt-servlet.jar
gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBW11dPjwvZXh0cmEtYXJncz48dm0tYXJncz48IVtDREFUQVstWG14NTEybV1dPjwvdm0tYXJncz48ZW50cnktcG9pbnQtbW9kdWxlPm5ldC5tb2xlei5tYW5kbG0uZm90b3N0cmVhbS5Gb3RvU3RyZWFtPC9lbnRyeS1wb2ludC1tb2R1bGU+PC9nd3QtY29tcGlsZS1zZXR0aW5ncz4\=
diff --git a/src/net/molez/mandlm/fotostream/client/FotoStream.java b/src/net/molez/mandlm/fotostream/client/FotoStream.java
index e819a20..6aa59cd 100644
--- a/src/net/molez/mandlm/fotostream/client/FotoStream.java
+++ b/src/net/molez/mandlm/fotostream/client/FotoStream.java
@@ -5,9 +5,11 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.LoadEvent;
import com.google.gwt.event.dom.client.LoadHandler;
import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
public class FotoStream implements EntryPoint
@@ -16,6 +18,10 @@ public class FotoStream implements EntryPoint
public void onModuleLoad()
{
+ final Label label = new Label();
+ RootPanel.get("textContainer").add(label);
+
+
final Image image = new Image();
image.setVisible(false);
image.addLoadHandler(new LoadHandler()
@@ -23,8 +29,27 @@ public class FotoStream implements EntryPoint
@Override
public void onLoad(LoadEvent event)
{
+ int clientHeight = Window.getClientHeight();
+ int clientWidth = Window.getClientWidth();
+
+ int imageHeight = image.getHeight();
+ int imageWidth = image.getWidth();
+
+ double heightScale = (double)clientHeight / (double)imageHeight;
+ double widthScale = (double)clientWidth / (double)imageWidth;
+
+ double scale = Math.min(heightScale, widthScale);
+
+ int targetWidth = (int) (scale * (double)imageWidth);
+ int targetHeight = (int) (scale * (double)imageHeight);
+
+ label.setText(
+ "Client: " + clientWidth + "x" + clientHeight + " " +
+ "Image: " + imageWidth + "x" + imageHeight + " " +
+ "Target: " + targetWidth + "x" + targetHeight);
+
image.setVisible(true);
- image.setWidth("100%");
+ image.setWidth("50%");
}
});
diff --git a/war/FotoStream.html b/war/FotoStream.html
index 0b9d2cd..f063b66 100644
--- a/war/FotoStream.html
+++ b/war/FotoStream.html
@@ -41,5 +41,6 @@
+