Как получить аспектное соотношение в GWT? - PullRequest
0 голосов
/ 07 января 2012

есть ли способ получить aspectRatio от текущего монитора?

Я протестировал следующий код, и он отлично работает с Firefox, но не в Internet Explorer ...

 //calculate Aspect Ratio
 int gcd= gcd(getScreenWidth(),getScreenHeight());
 aspectRatio=getScreenWidth()/gcd+":"+getScreenHeight()/gcd;
 ......
 }

public static native int getScreenWidth() /*-{ 
     return $wnd.screen.width;
     }-*/;
public static native int getScreenHeight() /*-{ 
     return $wnd.screen.height;
      }-*/;
/**
 * Euclidean algorithm to calculate the gcd
 * @param a number 1
 * @param b number 2
 * @return the gcd of both numbers
 */
public int gcd (int a, int b) {
    return (b == 0) ? a : gcd (b, a%b);
}

$wnd.screen.height отлично работает в ff, но в IE (9.0) он возвращает значения выше истинного значения ... есть ли другой способ получить текущее соотношение?

greetz, destiny

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...