0

onResize is not called after zooming.

Current GWT implementation:

public native void initWindowResizeHandler() /*-{
    var oldOnResize = $wnd.onresize;
    $wnd.onresize = $entry(function(evt) {
      try {
        @com.google.gwt.user.client.Window::onResize()();
      } finally {
        oldOnResize && oldOnResize(evt);
      }
    });
  }-*/;

The only solutions I found for capturing resize events use polling.

  1. Is polling the best (only) way? If so, how can the Scheduler be used for optimal performance?

  2. Once the event is captured, does calling com.google.gwt.user.client.Window::onResize() seem like a good idea?

Thanks

Current solution looking for improvements

@Override
  protected void onLoad() {

    Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {

      @Override
      public boolean execute() {

        if (listOuter.getOffsetWidth() != knownWidth)
          onResize();

        return SomeListViewImpl.this.isAttached();
      }
    }, 200);

  }

onResize is called on Window.onresize and on zooming.

 @Override
  public void onResize() {

    knownWidth = listOuter.getOffsetWidth();
    GWT.log("resize: " + knownWidth);

    //some magic

  }
Community
  • 1
  • 1
Nick Siderakis
  • 1,941
  • 2
  • 20
  • 39
  • on which browser this is not working for you. In general capturing a resize works fine for me – Daniel Kurka Jun 24 '12 at 18:43
  • I've only tried it on Chrome for mac; and it looks like "there's no way to actively detect if there's a zoom." http://stackoverflow.com/questions/995914/catch-browsers-zoom-event-in-javascript – Nick Siderakis Jun 25 '12 at 00:47

0 Answers0