2013-09-02 5 views
1

iPad 용 GWT 캔버스를 개발 중입니다. 장치를 회전 시키면 캔버스가 여전히 같은 크기가됩니다. 나는 CSS3를 사용하지 않고, 모든 것은 자바 코드로 설정되어있다. 그리고 모든 것은 setSize ("100 %", "100 %")이다. 이 문제를 만난 사람이 있습니까? 그들의 모든 해결책과 이유가 무엇입니까?iPad 사파리가 GWT 캔버스의 크기를 조정하지 않습니다

업데이트 몇 가지 테스트를 거친 후 모든 장치에 문제가있는 것으로 보입니다. 그것은

답변

0

내 프로젝트의 샘플

if(isIOS()) { 
    // for iOS 
    DOM.setElementAttribute(RootPanel.getBodyElement(), "onorientationchange", "updateOrientation();"); 
} else { 
    // for android 
    Window.addResizeHandler(this); 
} 

private final native void exportUpdateOrientationEvent() /*-{ 
    $wnd.updateOrientation = @com.xxx.Client::updateOrientation(); 
}-*/; 

public static void updateOrientation() { 
    int innerWidth = getWindowInnerWidth(); 
    int innerHeight = getWindowInnerHeight(); 
    // TODO canvas.setSize(innerWidth, innerHeight); 
} 

public static native int getWindowInnerWidth()/*-{ 
    return $wnd.innerWidth; 
}-*/; 

public static native int getWindowInnerHeight()/*-{ 
    return $wnd.innerHeight; 
}-*/; 

@Override 
public void onResize(ResizeEvent event) { 
    updateOrientation(); 
} 
+0

불행히도 나는 내 코드에서 자바 스크립트를 사용할 수 없습니다 안드로이드 장치의 크기를 조정하고 심지어 PC에 (후 90도로 화면을 회전)하지 않습니다. – Dandelion

관련 문제