1

I'm developing a GWT canvas for iPad Safari. When I rotate the device then the canvas still the same size. I don't use any CSS3, everything has been setted in the JAVA codes(and also everything is setSize("100%","100%") ). Has anyone met with this problem? Is their any solution and why this is happening?

UPDATE After a few tests it seems to be problem on every device. It doesn't resize on android devices and even on PC(after rotate the screen with 90 degrees)

1 Answer 1

0

My project's sample

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.